aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv64/boot/entry.S
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-12-13 01:38:14 +0100
committerAleksa Vuckovic <aleksa@vuckovic.cc>2024-04-02 23:17:31 +0200
commit36137438446c1754a522c5b3cc3aff92c43ac1ee (patch)
treef7358ef0aec7023321e52e116f94fba95e52611f /src/arch/riscv64/boot/entry.S
Initial commitHEADmaster
X86/X86_64 debug/release WORKING riscv64 WORKING uart idk
Diffstat (limited to 'src/arch/riscv64/boot/entry.S')
-rw-r--r--src/arch/riscv64/boot/entry.S37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/arch/riscv64/boot/entry.S b/src/arch/riscv64/boot/entry.S
new file mode 100644
index 0000000..f5fa092
--- /dev/null
+++ b/src/arch/riscv64/boot/entry.S
@@ -0,0 +1,37 @@
+.section .init
+
+.option norvc
+
+.type start, @function
+.global start
+start:
+ .cfi_startproc
+
+.option push
+.option norelax
+ la gp, global_pointer
+.option pop
+
+ /* Reset satp */
+ csrw satp, zero
+
+ /* Setup stack */
+ la sp, stack_top
+
+ /* Clear the BSS section */
+ la t5, bss_start
+ la t6, bss_end
+bss_clear:
+ sd zero, (t5)
+ addi t5, t5, 8
+ bltu t5, t6, bss_clear
+
+ la t0, kernel_main
+ csrw sepc, t0
+
+ /* Jump to kernel! */
+ tail kernel_main
+
+ .cfi_endproc
+
+.end