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