mirror of
https://github.com/libretro/parallel-ps2.git
synced 2026-11-09 11:31:34 -10:00
The fix is three lines across two files and looks obvious in hindsight, which is exactly why it is worth writing down how it was found -- it took seven attempts and four minidumps, and five of the six wrong ones were plausible enough that someone will try them again. Records what the crash was (a GS-to-EE download memcpying into RAM the recompiler had marked read-only, from a thread with no fault handler for it), what identified it (the MemoryInfoList stream: COMMIT, MAPPED, allocation protection READWRITE, current protection READONLY, which is mmap_MarkCountedRamPage's signature and nothing else's), and why Cpu->Clear was not enough on its own. Also records the audit of the other MTGS::InitAndReadFIFO caller -- ReadFIFO_VIF1 passes a stack local, which is never protected -- so nobody has to redo it. The dead ends are listed with what made each look right. Two of them are real defects that were fixed on the way past and are worth keeping: the FIFO readback offset could wrap, and DynamicArray::reserve ignored its allocation failure. The one that cost the most was reading rdx from the dump as memcpy's source argument when the pc was already deep inside memcpy and the register was scratch; that sent three rounds into paraLLEl-GS when the fault was on the destination throughout. And the reason it was possible to be wrong that long: these dumps were read by scanning the stack for module addresses rather than unwinding it, which cannot separate live frames from stale ones. A real unwind would have ended this in one command.