Degoogle lol

This commit is contained in:
gil 2024-05-16 08:19:23 -05:00
parent 5df0472703
commit 8c1f860d25

View file

@ -14,10 +14,11 @@ mod uart;
unsafe extern "C" fn _enter() -> ! { unsafe extern "C" fn _enter() -> ! {
use core::arch::asm; use core::arch::asm;
asm!( asm!(
// 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` (google 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
".option norelax", // disable relaxation so we can properly set `gp` ".option norelax", // disable relaxation so we can properly set `gp`
// this instruction compiles to: // this instruction compiles to:
@ -41,6 +42,7 @@ unsafe extern "C" fn _enter() -> ! {
"2:", "2:",
// BSS is clear! // BSS is clear!
"j 4f", "j 4f",
// busy loop if hartid =/= 0
"3:", "3:",
"wfi", "wfi",
"j 3b", "j 3b",