Home | History | Annotate | Download | only in blktrace
      1 #ifndef BARRIER_H
      2 #define BARRIER_H
      3 
      4 #if defined(__ia64__)
      5   #define store_barrier()         asm volatile ("mf" ::: "memory")
      6 #elif defined(__x86_64__)
      7   #define store_barrier()         asm volatile("sfence" ::: "memory")
      8 #elif defined(__i386__)
      9   #define store_barrier()         asm volatile ("": : :"memory")
     10 #elif defined(__ppc__) || defined(__powerpc__)
     11   #define store_barrier()         asm volatile ("eieio" : : : "memory")
     12 #elif defined(__s390__) || defined(__s390x__)
     13   #define store_barrier()         asm volatile ("bcr 15,0" : : : "memory")
     14 #elif defined(__alpha__)
     15   #define store_barrier()         asm volatile("wmb": : :"memory")
     16 #elif defined(__hppa__)
     17   #define store_barrier()         asm volatile("":::"memory")
     18 #elif defined(__sparc__)
     19   #define store_barrier()         asm volatile("":::"memory")
     20 #elif defined(__m68000__) || defined(__m68k__) || defined(mc68000) || defined(_M_M68K)
     21   #define store_barrier()         asm volatile("":::"memory")
     22 #elif defined(__mips__)  /* also mipsel */
     23   #define store_barrier()         do { } while(0)
     24 #elif defined(__arm__)
     25   /* taken from linux/arch/arm/kernel/entry-armv.S, thanks to pbrook! */
     26   typedef void (__kernel_dmb_t)(void);
     27   #define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0)
     28   #define store_barrier()        __kernel_dmb()
     29 #else
     30   #error Define store_barrier() for your CPU
     31 #endif
     32 
     33 #endif
     34