commit 076c950cbce75bd1a65f78262f7bfd9832a5724e
parent dc3894952fe274f58ddb0751d171a5dc234104d2
Author: Brian Swetland <swetland@frotz.net>
Date: Mon, 9 May 2022 11:43:42 -0700
hw: update start code to zero the BSS
Diffstat:
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/hw/src/start.S b/hw/src/start.S
@@ -3,11 +3,25 @@
#include <hw/platform.h>
+.section ".start"
+
.globl _start
_start:
+ /* zero BSS */
+ la t0, __bss_start
+ la t1, __bss_end
+zero_loop:
+ beq t0, t1, zero_done
+ sw zero, 0(t0)
+ add a0, a0, 4
+ j zero_loop
+zero_done:
+
+ /* setup initial stack */
li sp, (DRAM_BASE + DRAM_SIZE)
+
+ /* enter C code */
jal start
-.globl exit
-exit:
+ /* infinite loop */
j .