diff --git a/src/runtime/src/panic.rs b/src/runtime/src/panic.rs index ab9b8d22..a972be19 100644 --- a/src/runtime/src/panic.rs +++ b/src/runtime/src/panic.rs @@ -1,8 +1,21 @@ use libboard_zynq::{print, println}; +use libregister::RegisterR; +use libcortex_a9::regs::MPIDR; use unwind::backtrace; +static mut PANICKED: [bool; 2] = [false; 2]; + #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { + let id = MPIDR.read().cpu_id() as usize; + print!("Core {} ", id); + unsafe { + if PANICKED[id] { + println!("nested panic!"); + loop {} + } + PANICKED[id] = true; + } print!("panic at "); if let Some(location) = info.location() { print!("{}:{}:{}", location.file(), location.line(), location.column());