better way of handling incorrect pc address

This commit is contained in:
mwojcik 2022-10-12 16:21:26 +08:00
parent 31ceee7e22
commit 93bd98f6c0
1 changed files with 6 additions and 6 deletions

View File

@ -10,8 +10,7 @@ use libcortex_a9::{
enable_fpu,
cache::{dcci_slice, iciallu, bpiall},
asm::{dsb, isb},
sync_channel,
regs::MPIDR
sync_channel
};
use libboard_zynq::{mpcore, gic};
use libsupport_zynq::ram;
@ -221,17 +220,18 @@ extern fn dl_unwind_find_exidx(pc: *const u32, len_ptr: *mut u32) -> *const u32
let length;
let start: *const EXIDX_Entry;
unsafe {
let id = MPIDR.read().cpu_id() as usize;
// try to look up kernel for core 1 only
if (&__text_start as *const u32 <= pc && pc < &__text_end as *const u32) || id == 0 {
if (&__text_start as *const u32 <= pc && pc < &__text_end as *const u32) {
length = (&__exidx_end as *const EXIDX_Entry).offset_from(&__exidx_start) as u32;
start = &__exidx_start;
} else {
} else if KERNEL_IMAGE != ptr::null() {
let exidx = KERNEL_IMAGE.as_ref()
.expect("dl_unwind_find_exidx kernel image")
.library.get().as_ref().unwrap().exidx();
length = exidx.len() as u32;
start = exidx.as_ptr();
} else {
*len_ptr = 0;
return 0 as *const u32;
}
*len_ptr = length;
}