summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2019-05-05 15:43:24 +0000
committervisa <visa@openbsd.org>2019-05-05 15:43:24 +0000
commit5f307ed920eb4686b4e171698435bfbeff1c4f0c (patch)
tree5ca741e51150b64fa836cecf92f27c1912059df4
parentCall cpu_unidle() from need_resched() on mips64 like most (diff)
downloadwireguard-openbsd-5f307ed920eb4686b4e171698435bfbeff1c4f0c.tar.xz
wireguard-openbsd-5f307ed920eb4686b4e171698435bfbeff1c4f0c.zip
Use the .bss for the bootstrap stack of mips_init(). This way the memory
region is properly allocated by the firmware. Move the .bss clearing to locore.S because the section has to be ready when the stack is taken into use. This additionally makes the C environment more consistent at the start of mips_init().
-rw-r--r--sys/arch/octeon/octeon/locore.S24
-rw-r--r--sys/arch/octeon/octeon/machdep.c9
2 files changed, 24 insertions, 9 deletions
diff --git a/sys/arch/octeon/octeon/locore.S b/sys/arch/octeon/octeon/locore.S
index ff503c3d86c..3c9a0c7aa68 100644
--- a/sys/arch/octeon/octeon/locore.S
+++ b/sys/arch/octeon/octeon/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.17 2018/02/18 14:50:08 visa Exp $ */
+/* $OpenBSD: locore.S,v 1.18 2019/05/05 15:43:24 visa Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -123,9 +123,20 @@ locore_start:
sd v0, -8(t0) # store to randomdata
/*
+ * Clear the compiled BSS segment in OpenBSD code.
+ * U-Boot is supposed to have done this, though.
+ */
+ LA t0, edata
+ LA t1, end
+1:
+ sd zero, (t0)
+ blt t0, t1, 1b
+ daddu t0, t0, 8
+
+ /*
* Initialize stack and call machine startup.
*/
- LA t0, start - FRAMESZ(CF_SZ)
+ LA t0, initstack_end - FRAMESZ(CF_SZ)
PTR_S ra, CF_RA_OFFS(t0) # save uboot return address
PTR_S sp, 0(t0) # and stack
move sp, t0
@@ -157,3 +168,12 @@ LEAF(hw_cpu_spinup_trampoline, 0)
nop
END(hw_cpu_spinup_trampoline)
#endif /* MULTIPROCESSOR */
+
+/*
+ * Bootstrap stack for mips_init()
+ */
+ .bss
+ .align 3
+initstack:
+ .space 4096
+initstack_end:
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c
index 2715a82630a..f19ed23432d 100644
--- a/sys/arch/octeon/octeon/machdep.c
+++ b/sys/arch/octeon/octeon/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.109 2019/04/01 07:00:52 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.110 2019/05/05 15:43:24 visa Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -230,7 +230,7 @@ mips_init(register_t a0, register_t a1, register_t a2, register_t a3)
struct boot_info *boot_info;
uint32_t config4;
- extern char start[], edata[], end[];
+ extern char start[], end[];
extern char exception[], e_exception[];
extern void xtlb_miss;
@@ -244,11 +244,6 @@ mips_init(register_t a0, register_t a1, register_t a2, register_t a3)
*/
setcurcpu(&cpu_info_primary);
#endif
- /*
- * Clear the compiled BSS segment in OpenBSD code.
- */
-
- bzero(edata, end - edata);
/*
* Set up early console output.