summaryrefslogtreecommitdiff
path: root/sys/arch/m88k/include
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-02-20 20:40:02 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-02-20 20:40:02 +0000
commit7f4aa089b96fe48e07b63c1c91109c5fd9864ce1 (patch)
treee0eafccc8752157886570792f44ca299a16ef3d7 /sys/arch/m88k/include
parent1d19b5a49aca0084a40d4958c0ef7e1f2fb0b62c (diff)
atomic_{set,clear}bits_int were not safe enough on 88110 systems, as they
can be interrupted by NMI; move the SMP version of these routines from inlines to a separate file (kernel text shrinks 20KB...). Since the implementation for 88110 becomes really hairy, the pre-main() code is responsible for copying the appropriate code over for kernels configured for both 88100 and 88110 cpus, to avoid having to choose the atomicity strategy at runtime. Hairy, I said. This gets GENERIC.MP run much further on 197DP. Not enough to reach multiuser mode, but boots up to starting sshd and then panics.
Diffstat (limited to 'sys/arch/m88k/include')
-rw-r--r--sys/arch/m88k/include/atomic.h29
1 files changed, 11 insertions, 18 deletions
diff --git a/sys/arch/m88k/include/atomic.h b/sys/arch/m88k/include/atomic.h
index 874764cd729..6dba1393f5a 100644
--- a/sys/arch/m88k/include/atomic.h
+++ b/sys/arch/m88k/include/atomic.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomic.h,v 1.5 2007/12/05 22:09:13 miod Exp $ */
+/* $OpenBSD: atomic.h,v 1.6 2009/02/20 20:40:01 miod Exp $ */
/* Public Domain */
@@ -7,14 +7,17 @@
#if defined(_KERNEL)
+#ifdef MULTIPROCESSOR
+
+/* actual implementation is hairy, see atomic.S */
+void atomic_setbits_int(__volatile unsigned int *, unsigned int);
+void atomic_clearbits_int(__volatile unsigned int *, unsigned int);
+
+#else
+
#include <machine/asm_macro.h>
-#include <machine/lock.h>
#include <machine/psl.h>
-#ifdef MULTIPROCESSOR
-extern __cpu_simple_lock_t __atomic_lock;
-#endif
-
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
@@ -22,13 +25,7 @@ atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
psr = get_psr();
set_psr(psr | PSR_IND);
-#ifdef MULTIPROCESSOR
- __cpu_simple_lock(&__atomic_lock);
-#endif
*uip |= v;
-#ifdef MULTIPROCESSOR
- __cpu_simple_unlock(&__atomic_lock);
-#endif
set_psr(psr);
}
@@ -39,15 +36,11 @@ atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
psr = get_psr();
set_psr(psr | PSR_IND);
-#ifdef MULTIPROCESSOR
- __cpu_simple_lock(&__atomic_lock);
-#endif
*uip &= ~v;
-#ifdef MULTIPROCESSOR
- __cpu_simple_unlock(&__atomic_lock);
-#endif
set_psr(psr);
}
+#endif /* MULTIPROCESSOR */
+
#endif /* defined(_KERNEL) */
#endif /* __M88K_ATOMIC_H__ */