Add abort & update panic handler
This commit is contained in:
parent
c70be3fe1f
commit
6b697a4ca5
22
src/main.rs
22
src/main.rs
|
@ -96,12 +96,24 @@ extern "C" fn start() -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn on_panic(info: &PanicInfo) -> ! {
|
||||
// print panic info and hang
|
||||
println!("{}", info);
|
||||
#[no_mangle]
|
||||
extern "C" fn eh_personality() {}
|
||||
|
||||
loop {}
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
// print panic info and abort
|
||||
println!("{}", info);
|
||||
abort();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn abort() -> ! {
|
||||
use core::arch::asm;
|
||||
loop {
|
||||
unsafe {
|
||||
asm!("wfi");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO unit testing
|
||||
|
|
Loading…
Reference in a new issue