mirror of
https://github.com/handsomezhuzhu/2025-yatcpu.git
synced 2026-02-21 04:20:14 +00:00
add csrc
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
.section .text.init
|
||||
.globl _start
|
||||
_start:
|
||||
li sp, 4096 # Initialize stack pointer
|
||||
li sp, 0x10000000 # Initialize stack pointer
|
||||
call main # Jump to main function
|
||||
loop:
|
||||
j loop # Loop forever
|
||||
@@ -26,6 +26,16 @@ enable_interrupt:
|
||||
li t0, 0x1888
|
||||
csrrw t1, mstatus, t0 # enable interrupt
|
||||
ret
|
||||
.globl enable_paging
|
||||
enable_paging:
|
||||
li t0, 0x80000005 # ppn << 12 = 0x005000
|
||||
csrw satp, t0
|
||||
ret
|
||||
.globl get_mtval
|
||||
get_mtval:
|
||||
csrr a0, mtval
|
||||
ret
|
||||
|
||||
.globl get_epc
|
||||
get_epc:
|
||||
csrr a0, mepc
|
||||
|
||||
Reference in New Issue
Block a user