Refactor EnableInterrupts and DisableInterrupts

Removes usage of AsmFull which required an optimization pass to remove the map parameter passed into it. This caused issues when compiling with -opt=0 where memory for the map was being allocated as an unintended side-effect of using AsmFull with no optimizations enabled.
This commit is contained in:
Justin A. Wilson
2023-03-04 10:19:27 -06:00
committed by Ron Evans
parent d87e3ce330
commit 313c9e31dd
2 changed files with 29 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
#include <stdint.h>
void EnableInterrupts(uintptr_t mask) {
asm volatile(
"msr PRIMASK, %0"
:
: "r"(mask)
: "memory"
);
}
uintptr_t DisableInterrupts() {
uintptr_t mask;
asm volatile(
"mrs %0, PRIMASK\n\t"
"cpsid i"
: "=r"(mask)
:
: "memory"
);
return mask;
}