Files
virtualjaguar-libretro/test
Joe MattielloandClaude Fable 5.1 b242c67911 fix(gpu): movei fast path, write the upper bound without adding to gpu_pc (#569) (#1139)
* fix(gpu): movei fast path, write the upper bound without adding to gpu_pc

Review of #1137: `gpu_pc + 4 <= GPU_WORK_RAM_BASE + 0x1000` wraps for a pc
within 4 bytes of 0xFFFFFFFF (a wild jump target), so such a pc passed the
range check and indexed gpu_ram_8 far out of bounds.  Compare gpu_pc
against GPU_WORK_RAM_BASE + 0x0FFC instead: the same set of in-RAM
addresses, no arithmetic on the pc.  No behaviour change for any valid pc
(frame hashes identical on Doom gameplay).

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(gpu): movei immediates at both ends of local RAM (#569)

Two placements of movei at the end of the 4 KB pin the fast-path bound
from both sides: the immediate in the last two words (pc == base +
0xFFC after the opcode, the last position the fast path may take) and
the immediate one word past the end (general path; a bound off by one
the other way reads gpu_ram_8[0x1000..0x1003], which the sanitizer CI
job turns into a failure).  Asked for in the review of #1139.

A pc of 0xFFFFFFFC itself cannot be exercised: the opcode fetched there
goes through JaguarReadWord, which masks to 24 bits and lands in
unmapped space, so no movei can be made to execute at that address.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
2026-11-01 16:19:10 -05:00
..