8000 zdxsv delta state: pages written by a state file read; unwatched EE RAM faults make the page writable by inada-s-ai[bot] · Pull Request #681 · inada-s/pcsx2 · GitHub
[go: up one dir, main page]

Skip to content

zdxsv delta state: pages written by a state file read; unwatched EE RAM faults make the page writable - #681

Merged
inada-s-ai[bot] merged 3 commits into
zdxsv-masterfrom
ai/vtlb-host-write
Nov 19, 2026
Merged

inada-s-ai[bot] merged 3 commits into
zdxsv-masterfrom
ai/vtlb-host-write

Conversation

@inada-s-ai
@inada-s-ai inada-s-ai Bot commented Nov 18, 2026 •
Copy link
Copy Markdown

Description of Changes

  • zdxsv delta state: before a memory entry of a state file is read into emulated memory, each page in the range gets one write from the CPU thread (Zdxsv::DeltaStateHostWrite, only while the delta watch is on), so the fault handlers record and unwatch it first.
  • vtlb: a fault on EE RAM that the delta watch does not hold makes the page writable and continues, as upstream does (mmap_ClearCpuBlock; a page already under manual protection is only made writable again). No new crash, no endless fault; a page another fault has just unwatched continues too.

Rationale behind Changes

Consistency of the delta state page watch with direct file reads, and fault handling on EE RAM.

Suggested Testing Steps

  • Verified on windows-mini (Release x64): rplay.py with Savestate compression Uncompressed and PCSX2_ENV=ZDXSV_REPLAY_ROUND_AT=1500:1 (loads key state 1200): PASS (before the vtlb change in this revision).
  • Verified on windows-mini (Devel x64, private one-off check): all EE RAM made read-only at frame 300/600 without the delta watch: this revision keeps running (2 runs); the previous revision exits at that frame (2 runs).
  • Verified on windows-mini (Devel x64, this revision): rbk.py 2 1 saving a replay: PASS; rplay.py on it, plain and with PCSX2_ENV=ZDXSV_REPLAY_ROUND_AT=1500:1 (loads key state 1200, default compression): PASS.
  • deltatest.py: FAIL on this revision and identically on the previous one (existing failure, not from this change).
  • Not run: macOS/Linux, a state load while the delta watch is on (no current route found: online battles refuse state loads).

Did you use AI to help find, test, or implement this issue or feature?

Yes: implemented and tested by Claude Code.

🤖 Generated with Claude Code

inada-s-ai Bot and others added 2 commits November 19, 2026 04:12
…aults go to the next handler

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inada-s commented Nov 19, 2026 •
Copy link
Copy Markdown
Owner

@inada-s-ai Instruction from @inada-s:

Do not send these faults to the next handler (no new crash). For a write fault on an EE RAM page that the delta watch does not hold, do what upstream does: make the page writable and continue (upstream mmap_ClearCpuBlock before the delta state change). That removes the endless fault without adding a crash, and the case where another fault has just unwatched the page continues as well.

Runner: windows-mini


Generated by Claude Code

…itable and continues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@inada-s-ai inada-s-ai Bot changed the title zdxsv delta state: pages written by a state file read; other EE RAM faults go to the next handler zdxsv delta state: pages written by a state file read; unwatched EE RAM faults make the page writable Nov 19, 2026
@inada-s-ai
inada-s-ai Bot commented Nov 19, 2026
Copy link
Copy Markdown
Author

Done in 3cebb44 (pushed to this PR):

  • A fault on EE RAM that the delta watch does not hold no longer goes to the next handler. It makes the page writable and continues, as upstream does (mmap_ClearCpuBlock). A page already under manual protection (for example one another fault has just unwatched) is only made writable again (mmap_DeltaProtect(page, false)), because mmap_ClearCpuBlock asserts on a manual page in Devel builds.
  • A watched page still goes through mmap_DeltaHit first; on a code page (ProtMode_Write), its blocks are cleared as before.

Checked on windows-mini (Devel x64):

  • One-off fault injection, not committed: all of EE RAM made read-only at frame 300/600 while the delta watch is off. This revision keeps running (2 of 2 runs, 45-60 s). The previous PR head exits at the injected frame (2 of 2).
  • rbk.py 2 1 saving a replay: PASS. rplay.py on that replay: PASS, plain and with ZDXSV_REPLAY_ROUND_AT=1500:1 (loads key state 1200).
  • deltatest.py fails the same way (pass 2+ mismatched 1200) on this revision and on the previous head, so that failure was already there.
  • Not run: macOS/Linux.

Auto-merge is set; it merges once CI is green.


Generated by Claude Code

@inada-s-ai
inada-s-ai Bot enabled auto-merge November 19, 2026 06:33
@inada-s-ai
inada-s-ai Bot commented Nov 19, 2026
Copy link
Copy Markdown
Author

Handover:

  • Done: 3cebb44 on this PR (unwatched EE RAM fault: page made writable, execution continues). PR title and body updated. Auto-merge (merge commit) is enabled.
  • Re-runnable on windows-mini: scratch G:/ai/reveng/pcsx2-681/notes.md (run.sh plus fix+inject.diff for the injection check; the rbk.py/rplay.py commands are listed there).
  • Next: nothing until zdxsv delta state: pages written by a state file read; unwatched EE RAM faults make the page writable #681 merges (auto-merge, waiting only on CI).
  • Open, not caused by this PR: deltatest.py fails with the same counts on the head before this change.

Status: waiting


Generated by Claude Code

@inada-s-ai
inada-s-ai Bot commented Nov 19, 2026
Copy link
Copy Markdown
Author

@inada-s waiting on you:

Handover:

  • Done: 3cebb44 on this PR (unwatched EE RAM fault: page made writable, execution continues). PR title and body updated. Auto-merge (merge commit) is enabled.
  • Re-runnable on windows-mini: scratch G:/ai/reveng/pcsx2-681/notes.md (run.sh plus fix+inject.diff for the injection check; the rbk.py/rplay.py commands are listed there).
  • Next: nothing until zdxsv delta state: pages written by a state file read; unwatched EE RAM faults make the page writable #681 merges (auto-merge, waiting only on CI).
  • Open, not caused by this PR: deltatest.py fails with the same counts on the head before this change.
    Status: waiting

Generated by Claude Code

@inada-s-ai
inada-s-ai Bot merged commit 1597835 into zdxsv-master Nov 19, 2026
4 checks passed
@inada-s-ai
inada-s-ai Bot deleted the ai/vtlb-host-write branch November 19, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0