summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-06-19 11:29:22 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-06-19 11:29:22 +0000
commitdc9578484b3c0db8c52d139c801921598ffe4d96 (patch)
tree5532e2e6a303bb03f3cab0b1d05edde4ec3c6ac4 /sys/arch/powerpc
parentce1b14d937e251c09e90c8ad74d2ecd864769b11 (diff)
Implement the membar(9) API for powerpc.
ok miod@, dlg@
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/include/atomic.h18
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_ */