From ecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Mon, 12 Oct 2026 08:46:23 +0330 Subject: a --- src/baremetal/start_riscv.S | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/baremetal/start_riscv.S (limited to 'src/baremetal/start_riscv.S') diff --git a/src/baremetal/start_riscv.S b/src/baremetal/start_riscv.S new file mode 100644 index 0000000..527f109 --- /dev/null +++ b/src/baremetal/start_riscv.S @@ -0,0 +1,20 @@ +/* RISC-V virt, machine mode, no firmware. Stack, clear bss, enter C. */ +.section .text.init +.global _start +_start: + /* FS = Dirty, so a compiler that emits float ops does not trap. */ + li t0, 0x6000 + csrs mstatus, t0 + la sp, _stack_top + la t0, _sbss + la t1, _ebss +1: + bgeu t0, t1, 2f + sd zero, 0(t0) + addi t0, t0, 8 + j 1b +2: + call bare_main +3: + wfi + j 3b -- cgit v1.2.3