Files
iss_pc/.gitignore
HayatoGandClaude Opus 5.5 a5120b1b33 fix: protect the guest red zone from Windows exception frames (#29, #41)
PS4 leaf functions keep locals in the 128 bytes below rsp. Windows writes its
exception frame there on every GPU page-tracking fault, so the text-quad writer
at 0x1cf4e0 lost [rsp-20h] and crashed at 0x1cfaaf (write 0x92) or 0x1cf8f9.

Following shadPS4's static red-zone protection (upstream 15abf68, PRs #4802,
#5216), scripts/red_zone.py (run by isa_rewrite.py --red-zone) does three things:
- finds the functions from .eh_frame_hdr and decodes their control flow,
  including PIC jump tables;
- runs a per-byte red-zone liveness pass that follows rsp;
- moves every faultable memory instruction that runs while the red zone is live
  into a stub: lea rsp,[rsp-128]; insn; lea rsp,[rsp+128]; jmp back.
Short sites take neighbouring instructions with them, never across branch
targets or calls. Failing that, a short jmp reaches a relay in the padding or
in a moved host span. A fault there puts Windows' frame below the red zone,
however deep the handler goes.

The stubs and patch groups go in a new section of the G3ISA1 table, which the
loader verifies byte by byte and applies after the emulation rewrite. A
JMP_RELOCATE emulation stub now steps over the red zone around a faultable
relocated instruction. The table is cached by image hash and script CRC.

Defaults: on for Windows, ISS_RED_ZONE_REWRITE=0 turns it off, and =1 turns it
on for Linux. New Linux test switch: TLG_CLOBBER_RED_ZONE=<bytes> (1 = 128)
zeroes the bytes below rsp after each handled fault; guest threads get a
sigaltstack when the value is over 128.

inFAMOUS 1.07: 6453 instructions protected in 5898 patches; 25 short sites
are left unprotected in 2 functions with an unbounded jump-table dispatch.
Clobber=1 without protection crashes at 0x1cfaaf. With protection,
clobber=2048 runs 150 s with no fault and 29 Frame stats, alone or with the
SSE4A rewrite forced. FPS is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KHxhRF717FsAPVntc7R6zU
2026-10-14 21:14:30 -03:00

36 lines
794 B
Plaintext

# Arquivos do jogo (copyright da Sony/genDESIGN): NUNCA versionar
/dump/
*.psarc
*.bin
*.prx
*.sprx
*.sfo
*.plt
# Exception: synthetic 448-byte x86 image for the ISA rewrite tests (upstream gow3_pc), no game code
!port/tests/data/isa_fixture.bin
# Exception: synthetic red-zone test image and table (tests/test_red_zone.py --write), no game code
!port/tests/data/red_zone_image.bin
!port/tests/data/red_zone_table.bin
# Ferramentas de terceiros (Ghidra, JDK, GhidraOrbis): instaladas localmente
/tools/
# Saída bruta de descompilação (código derivado do jogo) e caches do REA/Ghidra
analysis/raw/
analysis/*.c
*.rea-snapshot
*.gpr
*.rep/
# Outros
__pycache__/
*.pyc
.DS_Store
# Saídas de build do port e dados locais do jogo preparados
port/out/
port/pgo/
port/user/
/game/
port/dist/