2016-08-15 22:34:20 +02:00
|
|
|
//! Intrinsics for panic handling
|
|
|
|
|
2016-08-18 03:34:33 +02:00
|
|
|
use interrupt;
|
2016-08-15 22:34:20 +02:00
|
|
|
|
|
|
|
#[cfg(not(test))]
|
|
|
|
#[lang = "eh_personality"]
|
|
|
|
extern "C" fn eh_personality() {}
|
|
|
|
|
|
|
|
#[cfg(not(test))]
|
|
|
|
/// Required to handle panics
|
|
|
|
#[lang = "panic_fmt"]
|
|
|
|
extern "C" fn panic_fmt(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! {
|
|
|
|
println!("PANIC: {}", fmt);
|
|
|
|
println!("FILE: {}", file);
|
|
|
|
println!("LINE: {}", line);
|
|
|
|
|
2016-08-18 03:34:33 +02:00
|
|
|
unsafe { interrupt::stack_trace(); }
|
2016-08-15 22:34:20 +02:00
|
|
|
|
|
|
|
println!("HALT");
|
|
|
|
loop {
|
2016-08-18 03:34:33 +02:00
|
|
|
unsafe { interrupt::halt(); }
|
2016-08-15 22:34:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(non_snake_case)]
|
|
|
|
#[no_mangle]
|
|
|
|
/// Required to handle panics
|
|
|
|
pub extern "C" fn _Unwind_Resume() -> ! {
|
|
|
|
loop {
|
2016-08-18 03:34:33 +02:00
|
|
|
unsafe { interrupt::halt(); }
|
2016-08-15 22:34:20 +02:00
|
|
|
}
|
|
|
|
}
|