summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-08-10 07:41:17 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-08-10 07:41:17 +0000
commit113132e0732cc61bec8f6a8ee1d20bca4d106b07 (patch)
tree64df716e256f53960fbe4eb371e352f9b789b333 /sys/arch
parent5a29fa2c8746cc91b2fe44eb4fa4e181664f92f8 (diff)
Only clear the bss after we have picked a cpu as master, and on this cpu only;
fixes a potential race where a secondary cpu resets carefully computed variables. ok aoyama@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/luna88k/luna88k/locore.S18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S
index 0f03e8e10d6..fb57b06f439 100644
--- a/sys/arch/luna88k/luna88k/locore.S
+++ b/sys/arch/luna88k/luna88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.25 2013/01/05 11:20:55 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.26 2013/08/10 07:41:16 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -96,14 +96,6 @@ ASLOCAL(main_start)
stcr %r0, VBR /* set Vector Base Register to 0, ALWAYS! */
FLUSH_PIPELINE
- /* clear BSS. PROM might have already done this... */
- or.u %r2, %r0, %hi16(_C_LABEL(edata))
- or %r2, %r2, %lo16(_C_LABEL(edata))
- or.u %r4, %r0, %hi16(_C_LABEL(end))
- or %r4, %r4, %lo16(_C_LABEL(end))
- bsr.n _C_LABEL(bzero) /* bzero(edata, end-edata) */
- subu %r3, %r4, %r2
-
/*
* Now we will compete with the other processors to see which one
* will be elected as the main one.
@@ -148,6 +140,14 @@ ASLOCAL(main_start)
* cpu_hatch_mutex held).
*/
ASLOCAL(main_init)
+ /* clear BSS. PROM might have already done this... */
+ or.u %r2, %r0, %hi16(_C_LABEL(edata))
+ or %r2, %r2, %lo16(_C_LABEL(edata))
+ or.u %r4, %r0, %hi16(_C_LABEL(end))
+ or %r4, %r4, %lo16(_C_LABEL(end))
+ bsr.n _C_LABEL(bzero) /* bzero(edata, end-edata) */
+ subu %r3, %r4, %r2
+
/*
* Have curcpu() point to the dummy cpuinfo structure,
* and initialize cr17.