summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-04-27 19:22:48 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-04-27 19:22:48 +0000
commit130112583326582b5dd8af1253131cdc9260715e (patch)
tree257dad105040c07969ce611a7e6f3a2f3c9c39aa /sys/arch
parent6e27c05c633ed899380a441aa7105b0e7ee5e390 (diff)
Disable interrupts around bit operations; ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/include/atomic.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/sparc/include/atomic.h b/sys/arch/sparc/include/atomic.h
index 72beef1ec48..0788777e6a3 100644
--- a/sys/arch/sparc/include/atomic.h
+++ b/sys/arch/sparc/include/atomic.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomic.h,v 1.2 2007/02/19 17:18:43 deraadt Exp $ */
+/* $OpenBSD: atomic.h,v 1.3 2007/04/27 19:22:47 miod Exp $ */
/* Public Domain */
@@ -10,13 +10,23 @@
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
+ int psr;
+
+ psr = getpsr();
+ setpsr(psr | PSR_PIL);
*uip |= v;
+ setpsr(psr);
}
static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
+ int psr;
+
+ psr = getpsr();
+ setpsr(psr | PSR_PIL);
*uip &= ~v;
+ setpsr(psr);
}
#endif /* defined(_KERNEL) */