summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-01-01 23:37:17 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-01-01 23:37:17 +0000
commit7378d8481a7f0ed0a48c47c12fa53df87df6a12b (patch)
treed6b8980a9486343f5dac1b4c07280dcf27eaf0d9 /sys/arch/sparc64
parent883994669f8a59021bf6a2fb7589922767a54c9a (diff)
Implement an MP-safe rw_cas() based upon the casx instruction; ok kettenis@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/include/lock.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/arch/sparc64/include/lock.h b/sys/arch/sparc64/include/lock.h
index c880043998b..7c8d35490a4 100644
--- a/sys/arch/sparc64/include/lock.h
+++ b/sys/arch/sparc64/include/lock.h
@@ -1,10 +1,11 @@
-/* $OpenBSD: lock.h,v 1.2 2007/11/05 20:19:22 miod Exp $ */
+/* $OpenBSD: lock.h,v 1.3 2008/01/01 23:37:16 miod Exp $ */
/* public domain */
#ifndef _SPARC64_LOCK_H_
#define _SPARC64_LOCK_H_
+#include <machine/atomic.h>
#include <machine/ctlreg.h>
typedef volatile u_int8_t __cpu_simple_lock_t;
@@ -50,4 +51,6 @@ __cpu_simple_unlock(__cpu_simple_lock_t *l)
*l = __SIMPLELOCK_UNLOCKED;
}
+#define rw_cas_sparc64 (sparc64_casx(p, o, n) != o)
+
#endif /* _SPARC64_LOCK_H_ */