summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-11-19 20:40:11 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-11-19 20:40:11 +0000
commitcb48b9f2c7272673d41e1d890b5e310916683005 (patch)
tree73d07128a182280e627399f8e970793e19487d12 /sys/arch/mvme88k
parent6ea08f8f805da6ac71cd4948ef5dd59e04c5a61c (diff)
Make sure %cr17 points to a valid cpu_info struct before attempting to do the
first few printfs (which happen before we have figured out which exact cpu we are running on). Found the hard way by aoyama@ on luna88k, and we probably have just been lucky on other platforms.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r--sys/arch/mvme88k/mvme88k/locore.S24
1 files changed, 13 insertions, 11 deletions
diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S
index d43d1aaea27..d8e8e9d71d8 100644
--- a/sys/arch/mvme88k/mvme88k/locore.S
+++ b/sys/arch/mvme88k/mvme88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.68 2011/10/09 17:01:34 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.69 2011/11/19 20:40:10 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -156,17 +156,17 @@ ASLOCAL(main_start)
bsr.n _ASM_LABEL(setup_psr)
st r8, r13, lo16(_C_LABEL(cputyp))
-#ifdef MULTIPROCESSOR
/*
* Have curcpu() point at the dummy cpuinfo structure,
- * so that cpu_number() does not dereference random memory.
- * This is necessary for early spl usage, despite the fact that
- * interrupts are disabled...
+ * and initialize cr17.
+ * This is necessary for early spl*() usage, as well as
+ * mutex diagnostic code.
*/
or.u r11, r0, hi16(_ASM_LABEL(dummy_cpu))
or r11, r11, lo16(_ASM_LABEL(dummy_cpu))
stcr r11, CPU
+#ifdef MULTIPROCESSOR
/*
* MVME BUG idles all secondary MPUs upon startup, so at this point
* we do not have to compete with them.
@@ -236,9 +236,9 @@ GLOBAL(secondary_start)
/*
* Have curcpu() point at the dummy cpuinfo structure,
- * so that cpu_number() does not dereference random memory.
- * This is necessary for early spl usage, despite the fact that
- * interrupts are disabled...
+ * and initialize cr17.
+ * This is necessary for early spl*() usage, as well as
+ * mutex diagnostic code.
*/
or.u r11, r0, hi16(_ASM_LABEL(dummy_cpu))
or r11, r11, lo16(_ASM_LABEL(dummy_cpu))
@@ -382,7 +382,6 @@ ASLOCAL(u0)
GLOBAL(proc0paddr)
word _ASM_LABEL(u0) /* KVA of proc0 uarea */
-#ifdef MULTIPROCESSOR
/* Dummy cpuinfo structure, for cpu_number() to work early. */
ASLOCAL(dummy_cpu)
word 3 /* CIF_ALIVE | CIF_PRIMARY */ /* ci_flags */
@@ -390,11 +389,14 @@ ASLOCAL(dummy_cpu)
word 0 /* ci_curpcb */
word 0 /* ci_curpmap */
word 0 /* ci_cpuid */
+#ifdef MULTIPROCESSOR
word _ASM_LABEL(dummy_mplock) /* ci_mp_atomic_begin */
word _ASM_LABEL(dummy_mplock) /* ci_mp_atomic_end */
-
- space CPU_INFO_SIZEOF - 7 * 4
+#else
+ word 0
+ word 0
#endif /* MULTIPROCESSOR */
+ space CPU_INFO_SIZEOF - 7 * 4
#if defined(DDB) || NKSYMS > 0
GLOBAL(esym)