summaryrefslogtreecommitdiff
path: root/src/start.S
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-06-11 11:14:40 -0500
committerNathan Lee <me@nwlee.tech>2026-06-11 11:14:40 -0500
commit4d843a5e03c91867614c94829c5255bc067a90c6 (patch)
tree9618e91da3053a51d1fefd8cf69cebddad3df435 /src/start.S
initial commit
Diffstat (limited to 'src/start.S')
-rw-r--r--src/start.S20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/start.S b/src/start.S
new file mode 100644
index 0000000..118b1c1
--- /dev/null
+++ b/src/start.S
@@ -0,0 +1,20 @@
+.section .text._start
+.global _start
+.type _start, @function
+
+_start:
+ # csrw mstatus, zero
+ # csrw mie, zero
+
+ la sp, __stack_top
+
+ la t0, __bss_start
+ la t1, __bss_end
+ beq t0, t1, 2f
+1:
+ sw zero, 0(t0)
+ addi t0, t0, 4
+ bltu t0, t1, 1b
+2:
+ call kernel_main
+ j .