Skip to content

raise the fault of an emulated clzero at the title's instruction - #1773

Open
imjustprism wants to merge 1 commit into
Marvisak:mainfrom
imjustprism:fix/clzero-unwritable-line
Open

imjustprism wants to merge 1 commit into
Marvisak:mainfrom
imjustprism:fix/clzero-unwritable-line

Conversation

@imjustprism

@imjustprism imjustprism commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

an emulated clzero whose write faults (unwritable line, guard page, non-canonical rax) died inside our handler as a fatal crash at our own store, so a later handler never saw it and the report named the wrong address. the stores now sit in one small asm routine; a fault in it is caught and its code and parameters go into the title's record at its clzero, so later handlers see the fault the real instruction raises and can fix the page and retry.

rebased over #214: the two clzero loops go through the same routine and stop at the line that faults, with the registers and flags their passes leave there (nothing touched when the first line faults).

fault records of a single clzero were compared with a real clzero on a ryzen 7 9800x3d (zen 5); the loop state follows from the instruction order and was not compared with a real loop. zen 2 was not measured, and the handler has not run on an intel host; the tests reach it through a ud2 stub. handlers registered ahead of ours still only see the nested fault in our routine, and a clzero into the thread's own last stack guard page is not recovered. gate green on windows, 708 passed.

@DesertGamer

Copy link
Copy Markdown

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally merged onto origin/main (70564ae, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-loader — all 30 tests passed, 0 failed (including zero_line_zeroes_the_whole_line_that_holds_its_address, a_single_step_inside_the_line_stores_is_not_a_store_fault, and a_store_fault_keeps_its_whole_record)
  • cargo clippy -p victory-loader --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean fault recovery and exception-record preservation for emulated clzero cache-line zeroing with thorough unit tests. Looks good.

AI-assisted (Gemini 4 Neon).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae).

cargo test -p victory-loader --locked → 0 passed, 3 failed — the 3 failures are the PRE-EXISTING macOS loader ones (prepare::tests parse Mach-O as PE, broken on main for months), not this PR. Static read of the 28K diff: emulate_with_record + victory_zero_line raise the fault of an emulated clzero at the title's instruction pointer via AddVectoredExceptionHandler — the zero_line_zeroes_the_whole_line_that_holds_its_address test names the semantics. Windows-only path; a real clzero fault test on Windows would be the proof.

@imjustprism
imjustprism force-pushed the fix/clzero-unwritable-line branch from 496ae1c to b07e5a9 Compare November 25, 2026 00:44
a store of the emulated write that faults is caught by the handler, and
its code and parameters go into the title's record, so later handlers see
the fault at the title's clzero. the clzero loops stop at the line that
faults, with the registers and flags their passes leave there.
@imjustprism
imjustprism force-pushed the fix/clzero-unwritable-line branch from b07e5a9 to 35ead91 Compare November 25, 2026 00:58
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.

4 participants