Skip to main content

decode_fakeptr_pc

Function decode_fakeptr_pc 

Source
pub fn decode_fakeptr_pc(pc: u32) -> Option<String>
Expand description

If pc matches a GetTrapAddress fake-pointer pattern, return a human-readable hint identifying the trap that the game most likely tried to JMP/JSR through. Else None.

Background: GetTrapAddress (and friends) on Systemless return a unique-per-trap fake address so apps can compare against _Unimplemented without hitting cache aliasing. Apps that ONLY compare the address (the documented use) are fine. Apps that actually JMP (A0) / JSR (A0) through the fake pointer land in unmapped or garbage-filled memory and trip an IllegalInstruction 30-100 instructions later. Surfacing the trap word at halt time lets future investigators identify the missing trampoline at a glance instead of having to disassemble around the halted PC.

Fake-pointer ranges (matching trap/memory.rs ranges): OS-style: $00F00000 | (trap_word as u32) — range $00F00000-$00F0FFFF. Tool-style: $CAFE0000 + (trap_word & 0x3FF) — range $CAFE0000-$CAFE03FF.