Add to-do and set interrupt CSRs
This commit is contained in:
parent
aaf64d0a2d
commit
be4bc6e270
|
@ -12,6 +12,7 @@ mod uart;
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
#[link_section = ".text.init"]
|
#[link_section = ".text.init"]
|
||||||
unsafe extern "C" fn _enter() -> ! {
|
unsafe extern "C" fn _enter() -> ! {
|
||||||
|
// TODO see if possible to replace this somehow...
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
asm!(
|
asm!(
|
||||||
// load hartid into t0; if t0 =/= 0, then jump to busy loop
|
// load hartid into t0; if t0 =/= 0, then jump to busy loop
|
||||||
|
@ -42,6 +43,11 @@ unsafe extern "C" fn _enter() -> ! {
|
||||||
"bne t0, t1, 1b",
|
"bne t0, t1, 1b",
|
||||||
"2:",
|
"2:",
|
||||||
// BSS is clear!
|
// BSS is clear!
|
||||||
|
|
||||||
|
// delegate all traps to S-mode trap handler
|
||||||
|
"li t5, 0xffff",
|
||||||
|
"csrw medeleg, t5", // delegate all machine exceptions
|
||||||
|
"csrw mideleg, t5", // delegate all machine interrupts
|
||||||
"j 4f",
|
"j 4f",
|
||||||
|
|
||||||
// busy loop if hartid =/= 0
|
// busy loop if hartid =/= 0
|
||||||
|
|
Loading…
Reference in a new issue