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/amd64/include | |
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/amd64/include')
-rw-r--r-- | sys/amd64/include/atomic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index 99a94b7..91c33e6 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -226,7 +226,7 @@ atomic_fetchadd_long(volatile u_long *p, u_long v) static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ *p = v; \ } \ struct __hack @@ -240,7 +240,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ u_##TYPE tmp; \ \ tmp = *p; \ - __asm __volatile("" : : : "memory"); \ + __compiler_membar(); \ return (tmp); \ } \ struct __hack |