1 /* 2 * Copyright 2014, Paweł Dziepak, pdziepak@quarnos.org. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alexander von Gluck IV <kallisti5@unixzen.com> 7 */ 8 #ifndef _KERNEL_ARCH_PPC_ATOMIC_H 9 #define _KERNEL_ARCH_PPC_ATOMIC_H 10 11 12 static inline void 13 memory_read_barrier_inline(void) 14 { 15 #ifdef __powerpc64__ 16 asm volatile("lwsync" : : : "memory"); 17 #else 18 asm volatile("sync" : : : "memory"); 19 #endif 20 } 21 22 23 static inline void 24 memory_write_barrier_inline(void) 25 { 26 #ifdef __powerpc64__ 27 asm volatile("lwsync" : : : "memory"); 28 #else 29 asm volatile("eieio" : : : "memory"); 30 #endif 31 } 32 33 34 static inline void 35 memory_full_barrier_inline(void) 36 { 37 asm volatile("sync" : : : "memory"); 38 } 39 40 41 #define memory_read_barrier memory_read_barrier_inline 42 #define memory_write_barrier memory_write_barrier_inline 43 #define memory_full_barrier memory_full_barrier_inline 44 45 46 #endif // _KERNEL_ARCH_PPC_ATOMIC_H 47