os/
lang_items.rs

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