diff --git a/src/entry.rs b/src/entry.rs index 724c355..adfa75a 100644 --- a/src/entry.rs +++ b/src/entry.rs @@ -1,14 +1,21 @@ -unsafe extern "C" fn _enter() -> ! { +use crate::abort; + +unsafe extern "C" fn _enter() { let id = riscv::register::mhartid::read(); - crate::entry::write_tp(&id); + write_tp(&id); + // TODO: set up stack for all harts + // TODO: set up CSRs for all harts + if id != 0 { abort(); } + + // TODO: clear BSS + // TODO: do hardware inits and wake other harts } #[inline] -unsafe fn write_tp(id: &usize) -> ! { +unsafe fn write_tp(id: &usize) { use core::arch::asm; asm!( "csrw mhartid, {id}", id = in(reg) id, - options(noreturn) ); } \ No newline at end of file