rcore-tutorial/os/src/lang_items.rs

20 lines
459 B
Rust

//! 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)
}