From: Mathieu Desnoyers Date: Mon, 19 Oct 2009 23:39:15 +0000 (-0400) Subject: uatomic: update atomic set/read, use STORE_SHARED/LOAD_SHARED X-Git-Tag: v0.2.4~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b46b23cb9949c585ddf8ccb691458c8c7c60c7ad;p=userspace-rcu.git uatomic: update atomic set/read, use STORE_SHARED/LOAD_SHARED Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/uatomic_arch_ppc.h b/urcu/uatomic_arch_ppc.h index 68b5faa..08a622d 100644 --- a/urcu/uatomic_arch_ppc.h +++ b/urcu/uatomic_arch_ppc.h @@ -21,6 +21,7 @@ */ #include +#include #ifndef __SIZEOF_LONG__ #ifdef __powerpc64__ @@ -36,12 +37,8 @@ #define ILLEGAL_INSTR ".long 0xd00d00" -#define uatomic_set(addr, v) \ -do { \ - ACCESS_ONCE(*(addr)) = (v); \ -} while (0) - -#define uatomic_read(addr) ACCESS_ONCE(*(addr)) +#define uatomic_set(addr, v) STORE_SHARED(*(addr), (v)) +#define uatomic_read(addr) LOAD_SHARED(*(addr)) /* * Using a isync as second barrier for exchange to provide acquire semantic. diff --git a/urcu/uatomic_arch_s390.h b/urcu/uatomic_arch_s390.h index b37e5f0..db05b15 100644 --- a/urcu/uatomic_arch_s390.h +++ b/urcu/uatomic_arch_s390.h @@ -28,6 +28,9 @@ * IN THE SOFTWARE. */ +#include +#include + #ifndef __SIZEOF_LONG__ #ifdef __s390x__ #define __SIZEOF_LONG__ 8 @@ -40,12 +43,8 @@ #define BITS_PER_LONG (__SIZEOF_LONG__ * 8) #endif -#define uatomic_set(addr, v) \ -do { \ - ACCESS_ONCE(*(addr)) = (v); \ -} while (0) - -#define uatomic_read(addr) ACCESS_ONCE(*(addr)) +#define uatomic_set(addr, v) STORE_SHARED(*(addr), (v)) +#define uatomic_read(addr) LOAD_SHARED(*(addr)) static inline __attribute__((always_inline)) unsigned int uatomic_exchange_32(volatile unsigned int *addr, unsigned int val)