diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-04-27 19:22:48 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-04-27 19:22:48 +0000 |
commit | 130112583326582b5dd8af1253131cdc9260715e (patch) | |
tree | 257dad105040c07969ce611a7e6f3a2f3c9c39aa /sys/arch | |
parent | 6e27c05c633ed899380a441aa7105b0e7ee5e390 (diff) |
Disable interrupts around bit operations; ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc/include/atomic.h | 12 |
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) */ |