rCore-Tutorial-v3/os/src/lang_items.rs

13 lines
366 B
Rust

use core::panic::PanicInfo;
use crate::sbi::shutdown;
#[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()
}