diff options
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r-- | sys/arch/powerpc/include/atomic.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/arch/powerpc/include/atomic.h b/sys/arch/powerpc/include/atomic.h index 77a24d4a84d..497b63bfee6 100644 --- a/sys/arch/powerpc/include/atomic.h +++ b/sys/arch/powerpc/include/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.6 2014/03/29 18:09:30 guenther Exp $ */ +/* $OpenBSD: atomic.h,v 1.7 2014/06/19 11:29:21 kettenis Exp $ */ /* Public Domain */ @@ -33,5 +33,21 @@ atomic_clearbits_int(volatile unsigned int *uip, unsigned int v) " sync" : "=&r" (tmp) : "r" (v), "r" (uip) : "cc", "memory"); } +#define __membar(_f) do { __asm __volatile(_f ::: "memory"); } while (0) + +#ifdef MULTIPROCESSOR +#define membar_enter() __membar("isync") +#define membar_exit() __membar("sync") +#define membar_producer() __membar("sync") +#define membar_consumer() __membar("isync") +#define membar_sync() __membar("sync") +#else +#define membar_enter() __membar("") +#define membar_exit() __membar("") +#define membar_producer() __membar("") +#define membar_consumer() __membar("") +#define membar_sync() __membar("") +#endif + #endif /* defined(_KERNEL) */ #endif /* _POWERPC_ATOMIC_H_ */ |