Loop for non-0 hartid's

This commit is contained in:
gil 2024-05-16 08:19:15 -05:00
parent 9aa8460825
commit 5df0472703

View file

@ -14,6 +14,8 @@ mod uart;
unsafe extern "C" fn _enter() -> ! { unsafe extern "C" fn _enter() -> ! {
use core::arch::asm; use core::arch::asm;
asm!( asm!(
"csrr t0, mhartid",
"bnez t0, 3f",
// before we use the `la` pseudo-instruction for the first time, // before we use the `la` pseudo-instruction for the first time,
// we need to set `gp` (google linker relaxation) // we need to set `gp` (google linker relaxation)
".option push", // pushes the current option stack ".option push", // pushes the current option stack
@ -38,6 +40,11 @@ unsafe extern "C" fn _enter() -> ! {
"bne t0, t1, 1b", "bne t0, t1, 1b",
"2:", "2:",
// BSS is clear! // BSS is clear!
"j 4f",
"3:",
"wfi",
"j 3b",
"4:",
// "tail-call" to {start} (call without saving a return address) // "tail-call" to {start} (call without saving a return address)
"tail {start}", "tail {start}",