forked from M-Labs/artiq
1
0
Fork 0

runtime: impl riscv panic handler

This commit is contained in:
occheung 2021-08-06 10:57:38 +08:00
parent 31bf17563c
commit 252594a606
1 changed files with 4 additions and 4 deletions

View File

@ -297,9 +297,9 @@ pub fn oom(layout: core::alloc::Layout) -> ! {
} }
#[no_mangle] // https://github.com/rust-lang/rust/issues/{38281,51647} #[no_mangle] // https://github.com/rust-lang/rust/issues/{38281,51647}
#[panic_implementation] #[panic_handler]
pub fn panic_impl(info: &core::panic::PanicInfo) -> ! { pub fn panic_impl(info: &core::panic::PanicInfo) -> ! {
irq::set_ie(false); // irq::set_ie(false);
#[cfg(has_error_led)] #[cfg(has_error_led)]
unsafe { unsafe {
@ -319,9 +319,9 @@ pub fn panic_impl(info: &core::panic::PanicInfo) -> ! {
println!("backtrace for software version {}:", csr::CONFIG_IDENTIFIER_STR); println!("backtrace for software version {}:", csr::CONFIG_IDENTIFIER_STR);
let _ = unwind_backtrace::backtrace(|ip| { let _ = unwind_backtrace::backtrace(|ip| {
// Backtrace gives us the return address, i.e. the address after the delay slot, // Backtrace gives us the return address, i.e. the address after jal(r) insn,
// but we're interested in the call instruction. // but we're interested in the call instruction.
println!("{:#08x}", ip - 2 * 4); println!("{:#08x}", ip - 4);
}); });
if config::read_str("panic_reset", |r| r == Ok("1")) && if config::read_str("panic_reset", |r| r == Ok("1")) &&