Regroup asm blocks

This commit is contained in:
gil 2024-05-16 08:21:50 -05:00
parent 8c1f860d25
commit ef07d172ff

View file

@ -17,6 +17,7 @@ unsafe extern "C" fn _enter() -> ! {
// load hartid into t0; if t0 =/= 0, then jump to busy loop // load hartid into t0; if t0 =/= 0, then jump to busy loop
"csrr t0, mhartid", "csrr t0, mhartid",
"bnez t0, 3f", "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` (look up linker relaxation) // we need to set `gp` (look up linker relaxation)
".option push", // pushes the current option stack ".option push", // pushes the current option stack
@ -42,12 +43,13 @@ unsafe extern "C" fn _enter() -> ! {
"2:", "2:",
// BSS is clear! // BSS is clear!
"j 4f", "j 4f",
// busy loop if hartid =/= 0 // busy loop if hartid =/= 0
"3:", "3:",
"wfi", "wfi", // wait for interrupt (or nop)
"j 3b", "j 3b",
"4:",
"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}",
start = sym start, // {start} refers to the function [start] below start = sym start, // {start} refers to the function [start] below