Back to home page

LXR

 
 

    


0001 #if defined(__i386__) || defined(__x86_64__)
0002 #define barrier() asm volatile("" ::: "memory")
0003 #define virt_mb() __sync_synchronize()
0004 #define virt_rmb() barrier()
0005 #define virt_wmb() barrier()
0006 /* Atomic store should be enough, but gcc generates worse code in that case. */
0007 #define virt_store_mb(var, value)  do { \
0008     typeof(var) virt_store_mb_value = (value); \
0009     __atomic_exchange(&(var), &virt_store_mb_value, &virt_store_mb_value, \
0010               __ATOMIC_SEQ_CST); \
0011     barrier(); \
0012 } while (0);
0013 /* Weak barriers should be used. If not - it's a bug */
0014 # define mb() abort()
0015 # define rmb() abort()
0016 # define wmb() abort()
0017 #else
0018 #error Please fill in barrier macros
0019 #endif
0020