From 0924065511087d9ef3cf84183029ce8e834ff84a Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 19 Dec 2021 21:06:09 -0800 Subject: Configured atomic swap --- src/cpu/atomic/swap.a.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/cpu/atomic') 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" -- cgit v1.2.1