Commit Graph

9 Commits

Author SHA1 Message Date
d762b13973 Merge pull request #950 from barkodr/fix/x64-recomp-qemu-path
x64_recomp: find qemu through QEMU_AARCH64 or PATH, not a contributor's home folder
2026-11-30 09:13:23 +01:00
4ecb057499 Merge pull request #1483 from kett1m/x64-recomp-grp7
x64_recomp: 0F 01 /r needs its ModRM byte (X64-RECOMP-GROUP7)
2026-11-28 11:19:55 +01:00
00131bb85e main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia
After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:

- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
  fixtures are left out.

What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.

Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:58:38 -05:00
b87abdef57 Merge mandy's main into port/d3d12-nvidia
Brings the D3D12 runtime branch (d3d12/, its launcher scripts and notes, and the pull requests reviewed and applied
on it) together with mandy's main.

Conflicts (67 files, none under d3d12/): docs/, make_game.py, runtime/, scripts/build_runtime.ps1, tests/ and
tools/. Every one takes main's side: main is where that code is maintained, and this branch's copies were older
states of the same files or the same pull requests in another form. tests/test_fspx_unpack.py is main's too, as it
tests main's tools/fspx_unpack.py. Nothing under d3d12/ is changed by the merge.

Checked before pushing: python -m compileall over make_game.py, tools and tests; make_game.py --help;
scripts/check_no_game_data.py over the files this adds to main; tests/test_text_write_line_endings.py. The
translator suite, the C++ runtime build and CI have not run on the result.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 17:50:37 -05:00
15c668fb64 PR #950: x64_recomp: find qemu through QEMU_AARCH64 or PATH, not a contributor's home folder
From https://github.com/ProjectLeonida/mandy/pull/950 (head 16452e785f), applied as a reviewed patch.

Co-authored-by: barkodr <barkodr@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:19 -05:00
4a1c850a7a x64_recomp: treat a shift by cl as a writer that may leave the flags alone (#2150 review)
x86 changes no flag for a shift or rotate whose masked count is 0. The
first version patched ARM's carry when cl is 0, taking CF from ctx when no
carry writer came before the shift in its block. But flag liveness treated
the shift as always writing, so a writer in an earlier block never stored
its word, and ctx held a stale CF: cmp r8d, 2 (r8d = 1); jmp; mov cl, 0;
shl eax, cl; setc read 0 instead of 1.

_flag_analysis now treats a shift by cl as a conditional writer: liveness
does not kill the flags it writes, the writer before it stores its word as
well, and a consumer behind it reads the ctx word. With cl = 0 the shift
is skipped whole, its flag store included, so ctx keeps the earlier word.
The ARM-carry patching and shift_prev_c go; the immediate-count-0 change
stays.

Tests: the analysis checks of the patching are replaced by checks of the
new rule, and three execution cases are added (a carry from an earlier
block with cl = 0 and cl = 1, and one a logic op cleared). The first one
fails on the previous head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:37:25 -05:00
c1df54c119 x64_recomp: 0F 01 /r is a ModRM group, so the walk stops one byte late (X64-RECOMP-GROUP7)
The `0F` table had no entry for opcode `0x01`, so the whole system-instruction
group decoded as the unknown `op0f_01` and its two opcode bytes. Every form of
`0F 01 /r` carries a ModRM byte: the memory forms are SGDT/SIDT/LGDT/LIDT/SMSW/
LMSW/INVLPG, and the register forms are whole ModRM bytes (MONITOR, MWAIT,
XGETBV, XSETBV, CLZERO, MONITORX, MWAITX, RDTSCP, SWAPGS, the VMX/SVM
instructions). Stopping after the two opcode bytes made every following
instruction in the function the wrong one.

A per-instruction differential against objdump over the retail image's `.text`
(26,674,180 instructions) shows the group decoded one byte short at all 16 sites
the image uses (10 clzero, 2 xgetbv, 2 monitorx, 2 mwaitx); with the group back,
9 `.pdata` functions decode 638 instructions further and 7 of them have no
unknown instruction left. `docs/mobile.md` records the measurement and the REA
section-header evidence.

Test: tests/test_x64_recomp.py::DecodeTests::test_group7_0f01_carries_modrm
fails before the fix (`0f 01 fc` decodes to size 2) and passes after.
2026-11-25 02:09:36 +01:00
16452e785f x64_recomp: find qemu through QEMU_AARCH64 or PATH, not a contributor's home folder 2026-11-24 16:11:31 +01:00
a2070dfa10 tools: x86-64 -> arm64 recompiler groundwork for the mobile path
tools/x64_recomp.py is the start of the static recompiler the arm64 port
needs: an x86-64 decoder (prefixes/REX, ModRM+SIB, RIP-relative, hi8
regs, immediate forms, groups 1-5/8/15/1A/11) and an arm64 assembler
with label fixups. tools/recomp_census.py counts how much of a PE's
.pdata-declared code the decoder covers. docs/mobile.md records the
route (AOT lift of .text to arm64, macOS first, MoltenVK or SPIRV-Cross
for graphics) and what still blocks iOS.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-23 13:47:00 -07:00