diff options
author | Christian Cunningham <cc@localhost> | 2021-12-19 21:06:09 -0800 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2021-12-19 21:06:09 -0800 |
commit | 0924065511087d9ef3cf84183029ce8e834ff84a (patch) | |
tree | 63b1236a636f6315bc0d2bef4fcc599456479a18 /src/cpu/atomic/swap.a.h | |
parent | 43db8c57ebe496bea03d66e2ddd0aa6bc298738c (diff) |
Configured atomic swap
Diffstat (limited to 'src/cpu/atomic/swap.a.h')
-rw-r--r-- | src/cpu/atomic/swap.a.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cpu/atomic/swap.a.h b/src/cpu/atomic/swap.a.h index 63dd50b..1ca2a52 100644 --- a/src/cpu/atomic/swap.a.h +++ b/src/cpu/atomic/swap.a.h @@ -1,7 +1,12 @@ +#include "../../util/mutex.h" + #ifndef CPU_ATOMIC_SWAP_A_H #define CPU_ATOMIC_SWAP_A_H /// https://stackoverflow.com/questions/16329123/use-of-strexeq-instead-of-strex-for-spinlock-implementation-in-arm +/// https://elixir.bootlin.com/linux/v4.9/source/arch/arm/include/asm/spinlock.h +/// https://elixir.bootlin.com/linux/v4.9/source/arch/arm/include/asm/spinlock_types.h#L23 +/// https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html static inline void atm_lock(unsigned long pid, unsigned long* addr) { unsigned long tmp, current_lock_value; @@ -18,8 +23,8 @@ static inline void atm_lock(unsigned long pid, unsigned long* addr) { : "cc"); } -static inline void atm_unlock(unsigned long* addr) { - unsigned long cleared = 0; +static inline void atm_release(unsigned long* addr) { + unsigned long cleared = NULL_PID; asm volatile( " dmb\n" " str %0, [%1]\n" |