From 1486a08de557b8f237a066a57cc2c74961ba36e0 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Wed, 29 Nov 2017 15:36:56 +1000 Subject: core/lock: Introduce atomic cmpxchg and implement try_lock with it cmpxchg will be used in a subsequent change, and this reduces the amount of asm code. Signed-off-by: Nicholas Piggin [stewart: fix some ifdef __TEST__ foo to ensure unittests work] Signed-off-by: Stewart Smith --- include/processor.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/processor.h') diff --git a/include/processor.h b/include/processor.h index 77110d0..69c5d4a 100644 --- a/include/processor.h +++ b/include/processor.h @@ -233,6 +233,8 @@ static inline bool is_power9n(uint32_t version) return true; } +#ifndef __TEST__ + /* * SMT priority */ @@ -370,6 +372,8 @@ static inline void st_le32(uint32_t *addr, uint32_t val) asm volatile("stwbrx %0,0,%1" : : "r"(val), "r"(addr), "m"(*addr)); } +#endif /* __TEST__ */ + #endif /* __ASSEMBLY__ */ #endif /* __PROCESSOR_H */ -- cgit v1.1