uatomic: update atomic set/read, use STORE_SHARED/LOAD_SHARED
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 19 Oct 2009 23:39:15 +0000 (19:39 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 19 Oct 2009 23:39:15 +0000 (19:39 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu/uatomic_arch_ppc.h
urcu/uatomic_arch_s390.h

index 68b5faaf7c0510f41455bb4ac1b08edbccda8102..08a622dfe6f93cd547b0684ebfd398bf9284fe92 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <urcu/compiler.h>
+#include <urcu/system.h>
 
 #ifndef __SIZEOF_LONG__
 #ifdef __powerpc64__
 
 #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.
index b37e5f0fbf4a771aec326e04e3c6abc468f4a4ff..db05b15b996a36f61a0a9ed3fff96fddcbb977c4 100644 (file)
@@ -28,6 +28,9 @@
  * IN THE SOFTWARE.
  */
 
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
 #ifndef __SIZEOF_LONG__
 #ifdef __s390x__
 #define __SIZEOF_LONG__ 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)
This page took 0.026491 seconds and 4 git commands to generate.