From dc9578484b3c0db8c52d139c801921598ffe4d96 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 19 Jun 2014 11:29:22 +0000 Subject: Implement the membar(9) API for powerpc. ok miod@, dlg@ --- sys/arch/powerpc/include/atomic.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'sys/arch/powerpc/include/atomic.h') 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_ */ -- cgit v1.2.3