规范化调整启动汇编,先初始化寄存器,再压栈,再开中断

This commit is contained in:
Ruige Lee
2025-01-27 21:48:17 +08:00
parent b75e724948
commit 0d20af8297
2 changed files with 20 additions and 14 deletions

View File

@@ -9,14 +9,7 @@
_prog_start:
la t0, trap_entry
csrw mtvec, t0
li t0, 1 << 11
csrw mie, t0
csrr t0, mstatus
ori t0, t0, 1<<3
csrw mstatus, t0
li x1, 0
li x2, 0
@@ -50,7 +43,17 @@ _prog_start:
li x30, 0
li x31, 0
la t0, trap_entry
csrw mtvec, t0
li t0, 1 << 11
csrw mie, t0
li sp, 0x40011000
csrr t0, mstatus
ori t0, t0, 1<<3
csrw mstatus, t0
call main
ecall