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