1 #ifndef __QEMU_BARRIER_H
2 #define __QEMU_BARRIER_H 1
5 #define barrier() asm volatile("" ::: "memory")
7 #if defined(__i386__) || defined(__x86_64__)
10 * Because of the strongly ordered x86 storage model, wmb() is a nop
11 * on x86(well, a compiler barrier only). Well, at least as long as
12 * qemu doesn't do accesses to write-combining memory or non-temporal
13 * load/stores from C code.
15 #define smp_wmb() barrier()
17 #elif defined(__powerpc__)
20 * We use an eieio() for a wmb() on powerpc. This assumes we don't
21 * need to order cacheable and non-cacheable stores with respect to
24 #define smp_wmb() asm volatile("eieio" ::: "memory")
29 * For (host) platforms we don't have explicit barrier definitions
30 * for, we use the gcc __sync_synchronize() primitive to generate a
31 * full barrier. This should be safe on all platforms, though it may
34 #define smp_wmb() __sync_synchronize()