Mask top 5 bits of PC for symbols

This commit is contained in:
2025-09-06 01:29:11 -04:00
parent f7f112f7c1
commit d610e3de14
3 changed files with 11 additions and 11 deletions
+5 -3
View File
@@ -261,7 +261,7 @@ extern "C" fn on_exception(sim: *mut VB, cause: *mut u16) -> c_int {
};
data.monitor.event = data.monitor.queued_event.take();
data.monitor.new_inline_stack = data.monitor.detect_new_inline_stack(pc);
data.monitor.queued_event = Some(SimEvent::Interrupt(cause, pc));
data.monitor.queued_event = Some(SimEvent::Interrupt(cause, pc & 0x07ffffff));
unsafe { vb_set_exception_callback(sim, None) };
if data.monitor.event.is_some() || data.monitor.new_inline_stack.is_some() {
1
@@ -439,7 +439,9 @@ impl EventMonitor {
// JAL .+4 is how programs get r31 to a known value for indirect calls
// (which we detect later.)
// Any other JAL is a function call.
return Some(SimEvent::Call(address.wrapping_add_signed(disp)));
return Some(SimEvent::Call(
address.wrapping_add_signed(disp) & 0x07ffffff,
));
}
}
@@ -453,7 +455,7 @@ impl EventMonitor {
if r31 as u32 == address.wrapping_add(2) {
// JMP anywhere else, if r31 points to after the JMP, is an indirect call
let target = unsafe { vb_get_program_register(sim, jmp_reg as u32) };
return Some(SimEvent::Call(target as u32));
return Some(SimEvent::Call(target as u32 & 0x07ffffff));
}
}