cpu: lower register-indexed memory bit tests #2024

Merged
louisdibiasi merged 1 commit from upstream-pr/2031 into main 2026-11-24 23:43:17 +00:00
louisdibiasi commented 2026-11-24 23:29:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-24T23:29:14Z.


Change

Lower the register-offset memory forms of BT, BTS, BTR and BTC in cpu_switch_aot. A signed bit offset selects a word before or after the memory base; CF comes from the original bit. Frame-backed, image-relative and 32-bit-address forms remain refused because the existing address proofs only cover the nominal access. LOCK remains refused.

Refs #446; follows the bit-string follow-up described in #1209. Open #1784 tests the current refusal in its independent fuzz generator, so that control will need coordination if these changes meet.

Verification

Windows x64, MSVC 19.44.35230.0 and ML64 14.44.35230.0. Tested commit 47fa55b5 based on upstream 8ec25533. The previously reviewed patch was rebased unchanged; its stable patch ID remained 9667c23d.

. .\tools\dev.ps1
cmake --build --preset dev --target cpu_switch_bit_string_lifted cpu_switch_bit_tests_lifted cpu_register_probe
ctest --preset dev --no-tests=error -R '^cpu_aot_switch_bit_(string|tests)$' --output-on-failure
cmake --build --preset release --target cpu_switch_bit_string_lifted cpu_switch_bit_tests_lifted cpu_register_probe
ctest --preset release --no-tests=error -R '^cpu_aot_switch_bit_(string|tests)$' --output-on-failure
cmake --build --preset pr
ctest --preset pr --no-tests=error

The focused tests passed 2/2 in each configuration. The new original MASM fixture compares 648 cases across native, translated and Python byte-reference results, covering positive and negative word boundaries, unaligned memory, high register bits and an address/index alias. It checks frame, image, address-size and undefined-register refusals and compares access violations for an inaccessible read and read-only writes. These fault checks do not verify fault address, ordering or guest exception registers.

The PR preset build completed; 26 tests passed and four MinLOD WARP tests reported capability skips. tests/docs_links_check.py and tests/bidi_controls_check.py passed after the rebase; git diff --check upstream/main...HEAD passed.

A separately compiled /O2 mutant set the computed word index to zero. The fixture rejected it at bt16_string, offset -16 (native/reference CF 0, mutant CF 1). The fixture is source-built and the change does not establish game startup or native console execution.

AI-assisted (Codex), including the implementation, fixture and review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593523687 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2031). Originally posted by [louisdibiasi](https://github.com/louisdibiasi) on 2026-11-24T23:29:14Z. --- ### Change Lower the register-offset memory forms of BT, BTS, BTR and BTC in `cpu_switch_aot`. A signed bit offset selects a word before or after the memory base; CF comes from the original bit. Frame-backed, image-relative and 32-bit-address forms remain refused because the existing address proofs only cover the nominal access. LOCK remains refused. Refs #446; follows the bit-string follow-up described in #1209. Open #1784 tests the current refusal in its independent fuzz generator, so that control will need coordination if these changes meet. ### Verification Windows x64, MSVC 19.44.35230.0 and ML64 14.44.35230.0. Tested commit `47fa55b5` based on upstream `8ec25533`. The previously reviewed patch was rebased unchanged; its stable patch ID remained `9667c23d`. ```powershell . .\tools\dev.ps1 cmake --build --preset dev --target cpu_switch_bit_string_lifted cpu_switch_bit_tests_lifted cpu_register_probe ctest --preset dev --no-tests=error -R '^cpu_aot_switch_bit_(string|tests)$' --output-on-failure cmake --build --preset release --target cpu_switch_bit_string_lifted cpu_switch_bit_tests_lifted cpu_register_probe ctest --preset release --no-tests=error -R '^cpu_aot_switch_bit_(string|tests)$' --output-on-failure cmake --build --preset pr ctest --preset pr --no-tests=error ``` The focused tests passed 2/2 in each configuration. The new original MASM fixture compares 648 cases across native, translated and Python byte-reference results, covering positive and negative word boundaries, unaligned memory, high register bits and an address/index alias. It checks frame, image, address-size and undefined-register refusals and compares access violations for an inaccessible read and read-only writes. These fault checks do not verify fault address, ordering or guest exception registers. The PR preset build completed; 26 tests passed and four MinLOD WARP tests reported capability skips. `tests/docs_links_check.py` and `tests/bidi_controls_check.py` passed after the rebase; `git diff --check upstream/main...HEAD` passed. A separately compiled `/O2` mutant set the computed word index to zero. The fixture rejected it at `bt16_string`, offset -16 (native/reference CF 0, mutant CF 1). The fixture is source-built and the change does not establish game startup or native console execution. AI-assisted (Codex), including the implementation, fixture and review.
upstream-sync closed this pull request 2026-11-25 00:05:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2024
No description provided.