19 lines
447 B
Rust
19 lines
447 B
Rust
//! The panic handler
|
|
|
|
use crate::sbi::shutdown;
|
|
use core::panic::PanicInfo;
|
|
|
|
#[panic_handler]
|
|
fn panic(info: &PanicInfo) -> ! {
|
|
if let Some(location) = info.location() {
|
|
println!(
|
|
"[kernel] Panicked at {}:{} {}",
|
|
location.file(),
|
|
location.line(),
|
|
info.message().unwrap()
|
|
);
|
|
} else {
|
|
println!("[kernel] Panicked: {}", info.message().unwrap());
|
|
}
|
|
shutdown()
|
|
}
|