summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/atomic.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-10-08 20:58:24 +0000
committerjhb <jhb@FreeBSD.org>2001-10-08 20:58:24 +0000
commitea70c6700861a03619a32c505dbcd8a2d0cba415 (patch)
tree7a930f31a6170373f1da0e34040e7441f9a58f59 /sys/amd64/include/atomic.h
parentefbb61ecafa43ad7cd83ab2a86375b721536a2a9 (diff)
downloadFreeBSD-src-ea70c6700861a03619a32c505dbcd8a2d0cba415.zip
FreeBSD-src-ea70c6700861a03619a32c505dbcd8a2d0cba415.tar.gz
Allow atomic ops to be somewhat safely used in userland. We always use
lock prefixes in the userland case so that the binaries will work on both SMP and UP systems.
Diffstat (limited to 'sys/amd64/include/atomic.h')
-rw-r--r--sys/amd64/include/atomic.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h
index cb899a6..17ef468 100644
--- a/sys/amd64/include/atomic.h
+++ b/sys/amd64/include/atomic.h
@@ -75,15 +75,19 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v);
#else /* !KLD_MODULE */
-#if defined(SMP)
+/*
+ * For userland, assume the SMP case and use lock prefixes so that
+ * the binaries will run on both types of systems.
+ */
+#if defined(SMP) || !defined(_KERNEL)
#if defined(LOCORE)
#define MPLOCKED lock ;
#else /* !LOCORE */
#define MPLOCKED "lock ; "
#endif /* LOCORE */
-#else /* !SMP */
+#else /* SMP || !_KERNEL */
#define MPLOCKED
-#endif /* SMP */
+#endif /* SMP || !_KERNEL */
#if !defined(LOCORE)
/*
OpenPOWER on IntegriCloud