summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include/atomic.h
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-12-29 06:48:43 +0000
committerjake <jake@FreeBSD.org>2001-12-29 06:48:43 +0000
commit9a06dbc23e21c4ddbc6dca64b2c0b710260e69d2 (patch)
treef821aee02059962062d3820db7ed981a89a17141 /sys/sparc64/include/atomic.h
parent9abebb43d07cee302792736300f4d2766b120c4d (diff)
downloadFreeBSD-src-9a06dbc23e21c4ddbc6dca64b2c0b710260e69d2.zip
FreeBSD-src-9a06dbc23e21c4ddbc6dca64b2c0b710260e69d2.tar.gz
Use ASI_P instead of ASI_N if _KERNEL isn't defined so that these
can be used in userland. Submitted by: tmm
Diffstat (limited to 'sys/sparc64/include/atomic.h')
-rw-r--r--sys/sparc64/include/atomic.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h
index 80c4dd4..831b8c8 100644
--- a/sys/sparc64/include/atomic.h
+++ b/sys/sparc64/include/atomic.h
@@ -33,6 +33,13 @@
#include <machine/cpufunc.h>
+/* Userland needs different ASI's. */
+#ifdef _KERNEL
+#define __ASI_ATOMIC ASI_N
+#else
+#define __ASI_ATOMIC ASI_P
+#endif
+
/*
* Various simple arithmetic on memory which is atomic in the presence
* of interrupts and multiple processors. See atomic(9) for details.
@@ -77,8 +84,8 @@
#define itype(sz) u_int ## sz ## _t
-#define atomic_cas_32(p, e, s) casa(p, e, s, ASI_N)
-#define atomic_cas_64(p, e, s) casxa(p, e, s, ASI_N)
+#define atomic_cas_32(p, e, s) casa(p, e, s, __ASI_ATOMIC)
+#define atomic_cas_64(p, e, s) casxa(p, e, s, __ASI_ATOMIC)
#define atomic_cas(p, e, s, sz) \
atomic_cas_ ## sz(p, e, s)
@@ -269,6 +276,7 @@ ATOMIC_GEN(64, long *, long, long, 64);
ATOMIC_GEN(ptr, void *, void *, uintptr_t, 64);
+#undef __ASI_ATOMIC
#undef ATOMIC_GEN
#undef atomic_cas_32
#undef atomic_cas_64
OpenPOWER on IntegriCloud