diff options
author | Christian Cunningham <cc@localhost> | 2022-01-19 12:01:18 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-01-19 12:01:18 -0700 |
commit | 49672787286b44c07561355b290946f80f334e58 (patch) | |
tree | b6f79cc8228737eb76f5fe6f174bec54e74ec1f9 /include | |
parent | d22b1c3cde432ea96408c329fe78fbf0a9da9a8e (diff) |
Added clobbers
Diffstat (limited to 'include')
-rw-r--r-- | include/cpu.h | 14 | ||||
-rw-r--r-- | include/cpu/atomic/swap.h | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/cpu.h b/include/cpu.h index c93b3b5..eb2cdc0 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -24,6 +24,20 @@ static inline void setmode(unsigned long mode) asm volatile ("msr cpsr_c, %0" :: "r"(mode)); } +static inline void* getsysstack(void) +{ + void* sp; + asm volatile ( + "mrs r0, cpsr\n" + "bic r1, r0, #0x1F\n" + "orr r1, r1, #0x1F\n" + "msr cpsr_c, r1\n" + "mov %0, sp\n" + "msr cpsr_c, r0" + : "=r"(sp)); + return sp; +} + static inline void* getsvcstack(void) { void* sp; diff --git a/include/cpu/atomic/swap.h b/include/cpu/atomic/swap.h index cbed62c..32717fb 100644 --- a/include/cpu/atomic/swap.h +++ b/include/cpu/atomic/swap.h @@ -22,7 +22,7 @@ static inline void atm_lock(unsigned long pid, unsigned long* addr) " dmb" : "=&r" (current_lock_value), "=&r" (tmp) : "r" (pid), "r" (addr) - : "cc"); + : "cc", "memory"); } static inline void atm_release(unsigned long* addr) @@ -34,7 +34,7 @@ static inline void atm_release(unsigned long* addr) " dsb\n" " sev" :: "r" (cleared), "r" (addr) - : "cc"); + : "cc", "memory"); } #endif |