Refactor SystemStack function for arm targets.
Removing usage of AsmFull in favor of writing inline assembly in C.
Этот коммит содержится в:
		
							родитель
							
								
									360f6904f5
								
							
						
					
					
						коммит
						a3fdbec13d
					
				
					 2 изменённых файлов: 16 добавлений и 4 удалений
				
			
		
							
								
								
									
										12
									
								
								src/internal/task/task_stack_cortexm.c
									
										
									
									
									
										Обычный файл
									
								
							
							
						
						
									
										12
									
								
								src/internal/task/task_stack_cortexm.c
									
										
									
									
									
										Обычный файл
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
uintptr_t SystemStack() {
 | 
			
		||||
    uintptr_t sp;
 | 
			
		||||
    asm volatile(
 | 
			
		||||
        "mrs %0, MSP"
 | 
			
		||||
        : "=r"(sp)
 | 
			
		||||
        :
 | 
			
		||||
        : "memory"
 | 
			
		||||
    );
 | 
			
		||||
    return sp;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,8 +8,8 @@ package task
 | 
			
		|||
// PSP, which is used for goroutines) so that goroutines do not need extra stack
 | 
			
		||||
// space for interrupts.
 | 
			
		||||
 | 
			
		||||
import "C"
 | 
			
		||||
import (
 | 
			
		||||
	"device/arm"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -67,6 +67,6 @@ func (s *state) pause() {
 | 
			
		|||
 | 
			
		||||
// SystemStack returns the system stack pointer. On Cortex-M, it is always
 | 
			
		||||
// available.
 | 
			
		||||
func SystemStack() uintptr {
 | 
			
		||||
	return arm.AsmFull("mrs {}, MSP", nil)
 | 
			
		||||
}
 | 
			
		||||
//
 | 
			
		||||
//export SystemStack
 | 
			
		||||
func SystemStack() uintptr
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче