test: extra malformed-encoding and per-instruction controls for VLDMXCSR/VSTMXCSR #1181

Manually merged
github merged 1 commit from gh-pr/1181/head into gh-pr/1181/base 2026-11-26 22:46:45 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:45 UTC · original
tedin7:x2w-cpu-mxcsr-vex-extra-tests → main · +61 −5 · 3 files · 1 commits · merged 2026-11-24 04:15 UTC

Change

Test-only follow-up to #1134. It adds cases from the closed-in-favour branch of #1130 that the shared VLDMXCSR/VSTMXCSR lowering tests do not yet pin. No change to tools/. This work is AI-assisted.

  • cpu_aot_vmxcsr_malformed (new, no fixture, no AVX): six malformed VEX loads and six malformed stores (VEX.L = 1 in both prefix lengths, vvvv other than 1111, pp = 01, a register operand, map 0F38) must be refused by lower at their own address in the host-MXCSR profile. #1134 checks only that the decoder calls them invalid, and only for the load. The well-formed VLDMXCSR and VSTMXCSR beside them, with and without VEX.W, must lower to _mm_setcsr and _mm_getcsr.
  • unmasked control: the unmasked-exception refusal is disabled, so mxcsr_after accepts 0x1D80 and must break a rule.
  • Four single-instruction controls on the mixed exports, one per MXCSR instruction (mixldload, mixvstread, mixvldload, mixstread). Each must break a rule in that very export, so a wrong lowering of one form is caught even where the other form is right.

Refs #1093, #1134, #1130.

Verification

  • python3 -B tests/cpu/vmxcsr.py check malformed on this branch: exit 0, "12 malformed VEX loads and stores are refused by the lowering at their address; ...".
  • Negative control 1, VSTMXCSR removed from the lowering: the same command fails with unsupported query operation at 0x1000: vstmxcsr dword ptr [rax].
  • Negative control 2, the lowering made to accept malformed bytes: the same command fails with an assertion.
  • python3 -B tests/rdna2_tools_check.py: OK (skipped=10).
  • Not run locally: the Windows fixture build and cpu_aot_vmxcsr with the five new controls (needs MSVC and ml64); the Windows CI jobs run them. The new variants are generated by editing one export's C++ and the check requires the broken rule to name that export.

Evidence and follow-up

No new binary fixture: the malformed check uses hex bytes written in the test, the controls reuse vmxcsr.asm. MIT, original code, no game files.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠tedin7** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1181) `tedin7:x2w-cpu-mxcsr-vex-extra-tests` → `main` · +61 −5 · 3 files · 1 commits · merged 2026-11-24 04:15 UTC ## Change Test-only follow-up to #1134. It adds cases from the closed-in-favour branch of #1130 that the shared VLDMXCSR/VSTMXCSR lowering tests do not yet pin. No change to `tools/`. This work is AI-assisted. - `cpu_aot_vmxcsr_malformed` (new, no fixture, no AVX): six malformed VEX loads and six malformed stores (VEX.L = 1 in both prefix lengths, vvvv other than 1111, pp = 01, a register operand, map 0F38) must be refused by `lower` at their own address in the host-MXCSR profile. #1134 checks only that the decoder calls them invalid, and only for the load. The well-formed VLDMXCSR and VSTMXCSR beside them, with and without VEX.W, must lower to `_mm_setcsr` and `_mm_getcsr`. - `unmasked` control: the unmasked-exception refusal is disabled, so `mxcsr_after` accepts 0x1D80 and must break a rule. - Four single-instruction controls on the mixed exports, one per MXCSR instruction (`mixldload`, `mixvstread`, `mixvldload`, `mixstread`). Each must break a rule in that very export, so a wrong lowering of one form is caught even where the other form is right. Refs #1093, #1134, #1130. ## Verification - `python3 -B tests/cpu/vmxcsr.py check malformed` on this branch: exit 0, "12 malformed VEX loads and stores are refused by the lowering at their address; ...". - Negative control 1, `VSTMXCSR` removed from the lowering: the same command fails with `unsupported query operation at 0x1000: vstmxcsr dword ptr [rax]`. - Negative control 2, the lowering made to accept malformed bytes: the same command fails with an assertion. - `python3 -B tests/rdna2_tools_check.py`: OK (skipped=10). - Not run locally: the Windows fixture build and `cpu_aot_vmxcsr` with the five new controls (needs MSVC and ml64); the Windows CI jobs run them. The new variants are generated by editing one export's C++ and the check requires the broken rule to name that export. ## Evidence and follow-up No new binary fixture: the malformed check uses hex bytes written in the test, the controls reuse `vmxcsr.asm`. MIT, original code, no game files. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
Adds cpu_aot_vmxcsr_malformed (lowering refuses six malformed VLDMXCSR and six malformed VSTMXCSR forms, well-formed neighbours lower), an unmasked control, and one control per MXCSR instruction of the mixed exports. Test-only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:46:45 +00:00
github manually merged commit 4de52b0513 into gh-pr/1181/base 2026-11-26 22:46:45 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 03:27 UTC · original · edited 2026-11-24 03:31 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T03:31:06.422696Z 4de52b0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 03:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1181#issuecomment-7121118300) · edited 2026-11-24 03:31 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"4de52b0513df4e6d42461f27c2e7a4f409fb7b3b","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T03:31:06.422696Z">2026-11-24T03:31:06.422696Z</relative-time> | `4de52b0` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.