pub const fn interrupt_resume_pc(epc: u32, word_at_epc: u32) -> u32Expand description
Where psx-rt’s exception handler resumes after an interrupt: epc, or
epc + 4 when word_at_epc is a GTE command.
On silicon an interrupt taken on a GTE command lets the command run and still reports EPC at it, so resuming at EPC runs it twice (hardware-tests v1.24, case 0xC9: 38 of 38; with this rule, case 0xCB: 61 skips, none doubled or lost). The handler’s assembly makes exactly this decision.
With Cause.BD set, EPC is the branch whose delay slot was interrupted,
so word_at_epc is a branch and the result is epc: the branch and a
GTE command in its delay slot both run again. psx-spx documents that
the fix cannot cover delay slots; keep GTE commands out of them
(hazard-scan warns about any in an image).