summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/entry.S28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/boot/entry.S b/src/boot/entry.S
new file mode 100644
index 0000000..1a6f6b8
--- /dev/null
+++ b/src/boot/entry.S
@@ -0,0 +1,28 @@
+.section .text.entry
+.globl _start
+
+_start:
+ csrr t0, mhartid
+ bnez t0, .L_park_harts
+
+ la sp, _stack_top
+
+ la a0, _bss_start
+ la a1, _bss_end
+ bge a0, a1, .L_call_main
+
+.L_clear_bss:
+ sd zero, (a0)
+ addi a0, a0, 8
+ blt a0, a1, .L_clear_bss
+
+.L_call_main:
+ call kernel_main
+
+.L_infinite_loop:
+ wfi
+ j .L_infinite_loop
+
+.L_park_harts:
+ wfi
+ j .L_park_harts \ No newline at end of file