Add arch::cpu::halt(). Halt when panic.

toolchain_update
WangRunji 6 years ago
parent 5bc392f388
commit 6741ba399b

@ -28,4 +28,9 @@ pub unsafe fn start_others(hart_mask: usize) {
write_volatile(&mut STARTED[cpu_id], true);
}
}
}
pub fn halt() {
use super::riscv::asm::wfi;
unsafe { wfi() }
}

@ -24,4 +24,9 @@ pub fn send_ipi(cpu_id: usize) {
pub fn init() {
let mut lapic = unsafe { XApic::new(0xffffff00_fee00000) };
lapic.cpu_init();
}
pub fn halt() {
use x86_64::instructions::hlt;
hlt();
}

@ -1,4 +1,4 @@
// Rust language features implementions
// Rust language features implementations
use core::panic::PanicInfo;
use core::alloc::Layout;
@ -13,7 +13,8 @@ pub fn panic(info: &PanicInfo) -> ! {
let location = info.location().unwrap();
let message = info.message().unwrap();
error!("\n\nPANIC in {} at line {}\n {}", location.file(), location.line(), message);
loop { }
use arch::cpu::halt;
loop { halt() }
}
#[lang = "oom"]

Loading…
Cancel
Save