diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-11-19 20:40:11 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-11-19 20:40:11 +0000 |
commit | cb48b9f2c7272673d41e1d890b5e310916683005 (patch) | |
tree | 73d07128a182280e627399f8e970793e19487d12 /sys/arch/aviion | |
parent | 6ea08f8f805da6ac71cd4948ef5dd59e04c5a61c (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/aviion')
-rw-r--r-- | sys/arch/aviion/aviion/locore.S | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sys/arch/aviion/aviion/locore.S b/sys/arch/aviion/aviion/locore.S index 28ed5b28887..9f109844c1f 100644 --- a/sys/arch/aviion/aviion/locore.S +++ b/sys/arch/aviion/aviion/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.15 2011/10/09 17:01:32 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.16 2011/11/19 20:40:10 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -130,17 +130,17 @@ ASLOCAL(main_start) stcr r0, VBR FLUSH_PIPELINE -#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 /* * SCM PROM idles all secondary MPUs upon startup, so at this point * we do not have to compete with them. @@ -237,9 +237,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)) @@ -319,7 +319,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_PRIMARY | CIF_ALIVE */ /* ci_alive */ @@ -327,11 +326,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 */ - +#else + word 0 + word 0 +#endif space CPU_INFO_SIZEOF - 7 * 4 -#endif /* MULTIPROCESSOR */ #if defined(DDB) || NKSYMS > 0 GLOBAL(esym) |