barrier.h 1.1 KB

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copied from the kernel sources:
  3. *
  4. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  5. */
  6. #ifndef _TOOLS_LINUX_ASM_POWERPC_BARRIER_H
  7. #define _TOOLS_LINUX_ASM_POWERPC_BARRIER_H
  8. /*
  9. * Memory barrier.
  10. * The sync instruction guarantees that all memory accesses initiated
  11. * by this processor have been performed (with respect to all other
  12. * mechanisms that access memory). The eieio instruction is a barrier
  13. * providing an ordering (separately) for (a) cacheable stores and (b)
  14. * loads and stores to non-cacheable memory (e.g. I/O devices).
  15. *
  16. * mb() prevents loads and stores being reordered across this point.
  17. * rmb() prevents loads being reordered across this point.
  18. * wmb() prevents stores being reordered across this point.
  19. *
  20. * *mb() variants without smp_ prefix must order all types of memory
  21. * operations with one another. sync is the only instruction sufficient
  22. * to do this.
  23. */
  24. #define mb() __asm__ __volatile__ ("sync" : : : "memory")
  25. #define rmb() __asm__ __volatile__ ("sync" : : : "memory")
  26. #define wmb() __asm__ __volatile__ ("sync" : : : "memory")
  27. #endif /* _TOOLS_LINUX_ASM_POWERPC_BARRIER_H */