diff options
author | attilio <attilio@FreeBSD.org> | 2012-10-09 14:32:30 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2012-10-09 14:32:30 +0000 |
commit | 6997194551ffae05d71ea650af49c4551d753a1a (patch) | |
tree | 18e9f31a3018a88b46e78d76a45d0953dea5276b /sys/sparc64 | |
parent | 6a02d06d1d81ffda0499310925ef854fd237f382 (diff) | |
download | FreeBSD-src-6997194551ffae05d71ea650af49c4551d753a1a.zip FreeBSD-src-6997194551ffae05d71ea650af49c4551d753a1a.tar.gz |
Add an unified macro to deny ability from the compiler to reorder
instruction loads/stores at its will.
The macro __compiler_membar() is currently supported for both gcc and
clang, but kernel compilation will fail otherwise.
Reviewed by: bde, kib
Discussed with: dim, theraven
MFC after: 2 weeks
Diffstat (limited to 'sys/sparc64')
-rw-r--r-- | sys/sparc64/include/atomic.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h index 06a1984..447880a 100644 --- a/sys/sparc64/include/atomic.h +++ b/sys/sparc64/include/atomic.h @@ -97,7 +97,7 @@ #define atomic_cas_acq(p, e, s, sz) ({ \ itype(sz) v; \ v = atomic_cas((p), (e), (s), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ v; \ }) @@ -122,7 +122,7 @@ #define atomic_op_acq(p, op, v, sz) ({ \ itype(sz) t; \ t = atomic_op((p), op, (v), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ t; \ }) @@ -139,7 +139,7 @@ #define atomic_load_acq(p, sz) ({ \ itype(sz) v; \ v = atomic_load((p), sz); \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ v; \ }) |