1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
//! The panic handler
use crate::sbi::shutdown;
use core::panic::PanicInfo;
use log::*;
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
if let Some(location) = info.location() {
error!(
"[kernel] Panicked at {}:{} {}",
location.file(),
location.line(),
info.message().unwrap()
);
} else {
error!("[kernel] Panicked: {}", info.message().unwrap());
}
shutdown(true)
}