raise the fault of an emulated clzero at the title's instruction #1773
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1773
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1773/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@imjustprism on GitHub · 2026-11-24 22:19 UTC · original
imjustprism:fix/clzero-unwritable-line→main· +734 −39 · 1 files · 1 commits · closed without mergingan 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 on GitHub · 2026-11-24 22:23 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 06:21 UTC · original
Automated triage for the maintainers.
Needs work. In
crates/victory-loader/src/crash.rs, an emulatedclzerothat faults now hands its fault back to the title's exception record instead of faulting inside our handler. It does this with aglobal_asm!store routine (victory_zero_line) and a second recovery path (recover_line_fault) that rewritesRip/Rdxwhen one of its stores faults. The goal makes sense. As it stands, though, it is hard to accept:cmp_flagsgains OF, there is a newadd_flags, and flags are now set per pass. That is emulation behaviour, and the PR gives no evidence for it (the instruction-set reference for the exact loop sequence the title uses, or the title's own code at the loop). Please split it into its own PR with that evidence.VirtualQuerybefore zeroing.recover_line_faulttrustscontext.Rdxto point at theStoreFaultslot. That holds only while the fault is insidevictory_zero_line_stores..stored. Please add a comment or test that pins this.CI: no check runs on the head commit.
Generated by Claude Code
@imjustprism on GitHub · 2026-11-25 13:28 UTC · original
@Marvisak a question on the triage note before i rework this.
it asks to split the flags change into its own pull request. reading the diff again, a loop that runs to its end leaves the same flags as on main:
cmp_flagsalready had OF there (the mask was 0x8d5 on main too, it is only renamed), its body moved intoresult_flags, and both loops still end with the flags of their lastcmp.add_flagsand the flags set on each pass are there only for a loop that stops at a line whose write faults, so the context shows what the title's instructions had done up to thatclzero.compare_sets_flags_like_the_cpuandadd_sets_flags_like_the_cpucheck both helpers against the cpu's owncmpandadd. split out,add_flagswould have no caller. do you still want that part separate, or can it stay here?the other two points (which case this fixes in practice, and pinning
Rdx) i will answer here after checking what the title does around its clzero loops.ci did run on
962dd5cand is green.@imjustprism on GitHub · 2026-11-25 14:49 UTC · original
closing this one. while reviewing the shrunk version (a report line naming the title's instruction) i checked what the report already prints: its backtrace walks through the exception dispatcher back into the title, so the frame right after the ntdll frames is already the title's clzero. the extra line would only repeat that, at the cost of per-thread state in the handler.
the recovery path is off the table per the triage note, so nothing is left here. no need to answer my question above. thanks for the look.
Pull request closed