cpu: reject EIP-relative operands and cover 32-bit loads and stores #230
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/233"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Spaghetih on 2026-11-21T18:52:20Z.
Change
Follow-up to #205, as offered in my review comment.
lower()intools/ffx_version_query.pynow rejects 67h EIP-relative operands withValueError("unsupported EIP-relative operand at 0x…: …"). They took the RIP-relative branch before the #205 truncation. There they ended in a bareKeyErrorfromglobals_, or bound to a global at the truncated RVA, while the hardware adds the low 32 bits of the runtime RIP. Compilers do not emit this form, so this is a clearer rejection, not a new capability.cpu_aot_address_size: a separate source-built MASM image with four 67h-prefixed functions. It is translated bylower()and both images are compared with a 32-bit reference.lea_sum3267 48 8d 04 11lea rax,[ecx+edx]lea_scaled3267 48 8d 44 d1 f8lea rax,[ecx+edx*8-8]load3267 8b 04 11mov eax,[ecx+edx]store3267 44 89 04 11mov [ecx+edx],r8dThe inputs combine 32-bit wraparound with upper-half noise (
0,0xdeadbeef00000000,0xffffffff00000000). The loads and stores use a page committed below 4 GiB, including a base +0xffffff14index that wraps back into the page. Each store must leave the rest of the page unchanged. The-8case matters because iced reports a 32-bit-mode displacement as0xfffffff8.addr32_probefrom #205 coversleaonly, so this adds memory operands and the negative displacement.docs/experiments.mddescribes the 67h behavior, which #205 did not document, and gives the command.Verification
Commit
d10ab7fone8895ad. Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.14.6,iced-x861.21.0,pefile2024.8.26.72 lea and 42 load/store cases matched the 32-bit reference on the native and translated images, then the EIP-relative rejection check. Passed.tools/ffx_version_query.pyfrome8895ad: the 114 differential cases pass, because the #205 truncation is already present. The EIP-relative check then fails withKeyError: 4119.lower()before #205:lifted lea_sum32(0xffffffff, 0x1) = 0x100000000, expected 0x0.ctestgave 112 passed, 0 failed and 3 capability skips:bvh_wave64_hardware,bvh_wave64_warp(lane range excludes 64) andwave_shuffle_warp. The hardware tests ran on an NVIDIA GeForce RTX 4070 Ti, driver 32.0.16.1088.form_coverage_checkprintedform coverage checks passed.Local package check. I used a local copy of the loader and upscaler whose SHA-256 values match the
LOADERandUPSCALERprofiles.ffx_version_query.py,ffx_device_init.pyandffx_create_context.pygenerated byte-identical C++ before and after this change (171, 1290 and 109 lines). In a separate build configured with-DFFX_UPSCALER_IMAGE, the 8ffx_*tests passed. The full suite there gave 113 passed and the same 3 skips.Evidence and follow-up
tests/cpu/address_size.asm,.defand.pyare original source written for this repository under its MIT license. They need no game files. The public test verifies the 67h forms listed above. The local package check verifies only that the existing package translations are unaffected.Checklist
AI-assisted (Claude Code). Every result above was run locally on the configuration listed.