os/
lang_items.rs

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