cpu: lower the reserved/hint NOP space in the shared lowering #1540

Merged
triggered02 merged 6 commits from upstream-pr/1547 into main 2026-11-24 17:16:07 +00:00
triggered02 commented 2026-11-24 13:48:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:48:22Z.


Implements the slice you scoped: the exact RESERVEDNOP forms the target manual documents as no-effect, ENDBR out, with the native-versus-lifted comparison as the acceptance fixture.

Lowering

iced decodes 0F 19 /r, 0F 1D /r, 0F 1E /r (unprefixed) and 0F 1F /r as RESERVEDNOP. The AMD APM documents them as reserved hint NOPs that take a ModRM but access no memory, so they lower to ; — operand not evaluated, so no address computation, no load, no fault. Forms iced decodes as another mnemonic never reach that branch and stay refused: ENDBR64/ENDBR32, CLDEMOTE, RDSSPD/RDSSPQ, the 0F 18 prefetches and the MPX forms.

Fixture 1 — cpu_hint_nop (lowering-level)

Six exact accepted patterns must lower to a body identical to an already-accepted NOP (block labels normalised, since they are numbered by instruction count). Identical bodies are the proof the instruction evaluates nothing. Four neighbours must stay refused:

accepted 0f1900, 0f1908, 0f19c0, 0f1d00, 0f1e00, 0f1f4000
refused  endbr64, endbr32, cldemote, rdsspd
PASS: 6 accepted forms lowered to a no-op, 4 neighbours still refused

Fixture 2 — cpu_hint_nop_fixture (native versus lifted execution)

One generator assembles the exact bytes and lowers the same instructions, so the two arms cannot drift apart. Prologue sets RAX from the input and the arithmetic flags from an ADD; each case executes the encoding under test and stores the flags in AH with LAHF, so a changed register or flag changes the return value. The memory forms are handed a pointer to a PAGE_NOACCESS page as the base register — if anything evaluated the operand, the call would fault instead of returning.

hn_0f19_reg   native=0x123456789ab1600 lifted=0x123456789ab1600 faulted=0 ok
hn_0f19_mem   native=0x17093520611     lifted=0x17093520611     faulted=0 ok
hn_0f1d_mem   native=0x17093520611     lifted=0x17093520611     faulted=0 ok
hn_0f1e_mem   native=0x17093520611     lifted=0x17093520611     faulted=0 ok
hn_0f1f_disp8 native=0x17093520611     lifted=0x17093520611     faulted=0 ok
control load from PAGE_NOACCESS faulted=1 ok
control register write: hint=0x123456789ab1600 write=0x12344678 ok
PASS: every hint NOP matched its lifted body without evaluating the operand

The two controls are what make the rest meaningful rather than circular: the harness must be able to see a memory access (the load faults), and a real register write must move the result (the mov eax, imm case returns a different value with the same inputs).

Fail-first: with the lowering change reverted, the generator raises on the first hint-NOP encoding and cpu_hint_nop reports the accepted forms as mismatches. cpu_aot_integer_flags, the neighbouring control for the same lowering, still passes.

What this does not establish

  • No CET/IBT behaviour. ENDBR is out of this slice by your direction, and this host has no IBT, so nothing here says anything about indirect-branch tracking.
  • Nothing about MPX or the prefetch mnemonics beyond "still refused".
  • The /O2 variant is not separate here: the fixture is built with the release preset, which is the optimised build; a Debug build would exercise the same bytes and the same lowered body.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583250965 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T13:48:22Z. --- Implements the slice you scoped: **the exact RESERVEDNOP forms the target manual documents as no-effect, ENDBR out**, with the native-versus-lifted comparison as the acceptance fixture. ## Lowering iced decodes `0F 19 /r`, `0F 1D /r`, `0F 1E /r` (unprefixed) and `0F 1F /r` as `RESERVEDNOP`. The AMD APM documents them as reserved hint NOPs that take a ModRM but access no memory, so they lower to `;` — operand not evaluated, so no address computation, no load, no fault. Forms iced decodes as another mnemonic never reach that branch and stay refused: **ENDBR64/ENDBR32**, **CLDEMOTE**, **RDSSPD/RDSSPQ**, the `0F 18` prefetches and the MPX forms. ## Fixture 1 — `cpu_hint_nop` (lowering-level) Six exact accepted patterns must lower to a body **identical** to an already-accepted NOP (block labels normalised, since they are numbered by instruction count). Identical bodies are the proof the instruction evaluates nothing. Four neighbours must stay refused: ``` accepted 0f1900, 0f1908, 0f19c0, 0f1d00, 0f1e00, 0f1f4000 refused endbr64, endbr32, cldemote, rdsspd PASS: 6 accepted forms lowered to a no-op, 4 neighbours still refused ``` ## Fixture 2 — `cpu_hint_nop_fixture` (native versus lifted execution) One generator assembles the exact bytes and lowers the same instructions, so the two arms cannot drift apart. Prologue sets RAX from the input and the arithmetic flags from an ADD; each case executes the encoding under test and stores the flags in AH with LAHF, so a changed register or flag changes the return value. The memory forms are handed a pointer to a **`PAGE_NOACCESS`** page as the base register — if anything evaluated the operand, the call would fault instead of returning. ``` hn_0f19_reg native=0x123456789ab1600 lifted=0x123456789ab1600 faulted=0 ok hn_0f19_mem native=0x17093520611 lifted=0x17093520611 faulted=0 ok hn_0f1d_mem native=0x17093520611 lifted=0x17093520611 faulted=0 ok hn_0f1e_mem native=0x17093520611 lifted=0x17093520611 faulted=0 ok hn_0f1f_disp8 native=0x17093520611 lifted=0x17093520611 faulted=0 ok control load from PAGE_NOACCESS faulted=1 ok control register write: hint=0x123456789ab1600 write=0x12344678 ok PASS: every hint NOP matched its lifted body without evaluating the operand ``` The two controls are what make the rest meaningful rather than circular: the harness must be able to *see* a memory access (the load faults), and a real register write must move the result (the `mov eax, imm` case returns a different value with the same inputs). **Fail-first:** with the lowering change reverted, the generator raises on the first hint-NOP encoding and `cpu_hint_nop` reports the accepted forms as mismatches. `cpu_aot_integer_flags`, the neighbouring control for the same lowering, still passes. ## What this does not establish - **No CET/IBT behaviour.** ENDBR is out of this slice by your direction, and this host has no IBT, so nothing here says anything about indirect-branch tracking. - **Nothing about MPX or the prefetch mnemonics** beyond "still refused". - The `/O2` variant is not separate here: the fixture is built with the release preset, which is the optimised build; a Debug build would exercise the same bytes and the same lowered body. AI-assisted (Claude Code).
chatgpt-codex-connector[bot commented 2026-11-24 14:03:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:58:51Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ed75b1e84

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6040535033 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6040535033). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T13:58:51Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `7ed75b1e84` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 14:03:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:48:36Z.


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-24T13:58:54.078586Z 7ed75b1 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133369214 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#issuecomment-7133369214). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T13:48:36Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"7ed75b1e84134bf376422c67506b7a1c386920b7","has_any_findings":true,"has_unresolved_findings":true,"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-24T13:58:54.078586Z">2026-11-24T13:58:54.078586Z</relative-time> | `7ed75b1` | 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>
triggered02 commented 2026-11-24 14:03:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:03:13Z.


Correct — recorded in 0ba1a965.

docs/experiments.md now carries the reserved/hint NOP entry next to the existing 90/66 90 notes, and it covers what you asked for:

  • Acceptance boundary: 0F 19 /r, unprefixed 0F 1D /r and 0F 1E /r, and 0F 1F /r in any ModRM form, lowered to a no-op with the operand not evaluated.
  • Refusal boundary: ENDBR64/ENDBR32, CLDEMOTE, RDSSPD/RDSSPQ, the 0F 18 prefetches and the MPX forms — named explicitly, including why ENDBR is out of scope on a target without CET (accepting it would claim something about indirect-branch tracking that nothing here checks).
  • Reproduction: the exact commands for both controls, ctest --preset dev --no-tests=error -R '^cpu_hint_nop$' -V and ... -R '^cpu_hint_nop_fixture$' -V, with the measured native-versus-lifted result and the two controls (a real load from the inaccessible page must fault; a real register write must move the result) that make the comparison meaningful rather than circular.

docs_links_check (340 links) and bidi_controls_check pass after the addition.

Separately, I saw R0Y00 pushed 15e42bef onto the audio pacing branch — gating acceptance on p95 with maximum and RMS kept as diagnostics, plus a deterministic control for isolated and sustained delays. I've adopted it locally rather than reworking it; that's a better shape than my max-based bound.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133761315 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#issuecomment-7133761315). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T14:03:13Z. --- Correct — recorded in `0ba1a965`. `docs/experiments.md` now carries the reserved/hint NOP entry next to the existing `90`/`66 90` notes, and it covers what you asked for: - **Acceptance boundary:** `0F 19 /r`, unprefixed `0F 1D /r` and `0F 1E /r`, and `0F 1F /r` in any ModRM form, lowered to a no-op with the operand not evaluated. - **Refusal boundary:** `ENDBR64`/`ENDBR32`, `CLDEMOTE`, `RDSSPD`/`RDSSPQ`, the `0F 18` prefetches and the MPX forms — named explicitly, including why ENDBR is out of scope on a target without CET (accepting it would claim something about indirect-branch tracking that nothing here checks). - **Reproduction:** the exact commands for both controls, `ctest --preset dev --no-tests=error -R '^cpu_hint_nop$' -V` and `... -R '^cpu_hint_nop_fixture$' -V`, with the measured native-versus-lifted result and the two controls (a real load from the inaccessible page must fault; a real register write must move the result) that make the comparison meaningful rather than circular. `docs_links_check` (340 links) and `bidi_controls_check` pass after the addition. Separately, I saw R0Y00 pushed `15e42bef` onto the audio pacing branch — gating acceptance on p95 with maximum and RMS kept as diagnostics, plus a deterministic control for isolated and sustained delays. I've adopted it locally rather than reworking it; that's a better shape than my max-based bound.
chatgpt-codex-connector[bot commented 2026-11-24 14:03:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T13:58:51Z.

Code review location: tools/ffx_version_query.py; line 3069

@@ -3066,7 +3066,13 @@ def p2_lane(sel, out_off):
             suffix, host = {1: ("8", "char"), 2: ("16", "short"), 4: ("", "long"), 8: ("64", "__int64")}[size]
             stmt = write_register(register, f"_InterlockedExchange{suffix}(reinterpret_cast<{host} volatile*>({address()}), "
                                             f"static_cast<{host}>({operand(n)}))")
-        elif op == M.NOP or (op == M.XCHG and i.op0_register == i.op1_register == R.AX):
+        elif op in (M.NOP, M.RESERVEDNOP) or (op == M.XCHG and i.op0_register == i.op1_register == R.AX):

P2 Badge Document the newly accepted reserved NOPs

Since this branch now accepts 0F 19, 0F 1D and unprefixed 0F 1E in the shared integer lowering, the CPU notes in docs/experiments.md still describe only the existing 90/66 90 NOP cases and omit both the new acceptance/refusal boundary and how to run cpu_hint_nop/cpu_hint_nop_fixture; contributors following the documented capability notes cannot reproduce this change. Please update those notes, as repository guidance requires for public capability changes.

AGENTS.md reference: AGENTS.md:L191-L192

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4681055996 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#discussion_r4681055996). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T13:58:51Z. **Code review location:** `tools/ffx_version_query.py`; line 3069 ~~~~diff @@ -3066,7 +3066,13 @@ def p2_lane(sel, out_off): suffix, host = {1: ("8", "char"), 2: ("16", "short"), 4: ("", "long"), 8: ("64", "__int64")}[size] stmt = write_register(register, f"_InterlockedExchange{suffix}(reinterpret_cast<{host} volatile*>({address()}), " f"static_cast<{host}>({operand(n)}))") - elif op == M.NOP or (op == M.XCHG and i.op0_register == i.op1_register == R.AX): + elif op in (M.NOP, M.RESERVEDNOP) or (op == M.XCHG and i.op0_register == i.op1_register == R.AX): ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Document the newly accepted reserved NOPs** Since this branch now accepts `0F 19`, `0F 1D` and unprefixed `0F 1E` in the shared integer lowering, the CPU notes in `docs/experiments.md` still describe only the existing `90`/`66 90` NOP cases and omit both the new acceptance/refusal boundary and how to run `cpu_hint_nop`/`cpu_hint_nop_fixture`; contributors following the documented capability notes cannot reproduce this change. Please update those notes, as repository guidance requires for public capability changes. AGENTS.md reference: [AGENTS.md:L191-L192](https://github.com/R0Y00/Xbox2Windows/blob/7ed75b1e84134bf376422c67506b7a1c386920b7/AGENTS.md#L191-L192) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
legacy-code-archaeologist commented 2026-11-24 15:01:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T14:51:29Z.

Review: COMMENTED


Reviewed against the AMD64 APM Vol. 3 (24594, rev. 3.39, October 2026). I'm not opening a competing PR for #1476, so this is yours.

1. The accepted set is wider than the docs and the comment say. The branch tests op in (M.NOP, M.RESERVEDNOP), which accepts every encoding iced decodes as RESERVEDNOP, not only 0F 19, 0F 1D, unprefixed 0F 1E and 0F 1F. With iced as pinned here:

0f0dc0    nop eax,eax     accepted   (0F 0D, Group P)
0f18f0    nop eax,esi     accepted   (0F 18 /6, register form)
0f18f8    nop eax,edi     accepted   (0F 18 /7, register form)
0f1a00    nop [rax],eax   accepted
0f1b00    nop [rax],eax   accepted
0f1c08    nop [rax],ecx   accepted
f30f1e00  nop [rax],eax   accepted   (prefixed 0F 1E)
  • 0F 0D is wrong for the APM. Table A-7 lists Group P as prefetches for every /reg: footnote 4 says reserved prefetch encodings alias PREFETCH Exclusive. So these are not hint NOPs.
  • 0F 18 /6 and /7 are listed as NOP in the Table A-7 Group 16 row. But the PREFETCHlevel page in the same revision documents them as PREFETCHIT1/PREFETCHIT0, gated by CPUID Fn8000_0021_EAX[PREFETCHI]. I would keep them out of a "documented no effect" slice.
  • 0F 1A, 0F 1B, 0F 1C /1-7 and prefixed 0F 1E are listed as NOP in Table A-4. Only F3 0F 1E with reg=1, mod=11 is RDSSP. So accepting them matches the APM, but the docs and the code comment then need to say so, and a test needs to pin them.

Suggestion: select by i.code rather than by mnemonic. Accept the RESERVEDNOP_RM{16,32,64}_R{16,32,64}_0F19…_0F1F codes, plus _0F18 with ModRM.reg & 7 in {4, 5} if you want Group 16 /4 and /5. Add 0f0dc0 and 0f18f0 to the refused neighbours in hint_nop_check.py, so that a later widening is visible as intended.

2. Smaller points:

  • In hint_nop_fixture.py, the lifted call is outside the __try. A lifted body that evaluates the operand would crash the test process instead of reporting MISMATCH. Wrapping it like the native call gives a clearer failure.
  • The memory-form cases address [page + 17] (or +25), because RAX is a + b after the prologue. That is still inside the inaccessible page, so the fault check holds. A comment saying so would help.
  • The two CMake blocks are inserted at column 0 between the cpu_integer_flags_controls lines, inside the indented if(EXISTS "${INTAKE_PYTHON}") block.

APM references:

  • NOP page: "rFLAGS Affected: None", "Exceptions: None".
  • Table A-4, Secondary Opcode Map, low nibble 8–Fh: row 1 lists 0F 19–0F 1F as NOP with a ModRM, plus (F3) RDSSP reg=1, mod=11.
  • Table A-7: Group 16 and Group P.
  • PREFETCHlevel page: the 0F 18 /6 and /7 encodings.

I did not build or run the branch. The acceptance results above come from decoding with iced and from applying the branch's condition.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041513526 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6041513526). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T14:51:29Z. **Review:** COMMENTED --- Reviewed against the AMD64 APM Vol. 3 (24594, rev. 3.39, October 2026). I'm not opening a competing PR for #1476, so this is yours. **1. The accepted set is wider than the docs and the comment say.** The branch tests `op in (M.NOP, M.RESERVEDNOP)`, which accepts every encoding iced decodes as `RESERVEDNOP`, not only `0F 19`, `0F 1D`, unprefixed `0F 1E` and `0F 1F`. With iced as pinned here: ``` 0f0dc0 nop eax,eax accepted (0F 0D, Group P) 0f18f0 nop eax,esi accepted (0F 18 /6, register form) 0f18f8 nop eax,edi accepted (0F 18 /7, register form) 0f1a00 nop [rax],eax accepted 0f1b00 nop [rax],eax accepted 0f1c08 nop [rax],ecx accepted f30f1e00 nop [rax],eax accepted (prefixed 0F 1E) ``` - `0F 0D` is wrong for the APM. Table A-7 lists Group P as prefetches for every `/reg`: footnote 4 says reserved prefetch encodings alias PREFETCH Exclusive. So these are not hint NOPs. - `0F 18 /6` and `/7` are listed as NOP in the Table A-7 Group 16 row. But the PREFETCHlevel page in the same revision documents them as PREFETCHIT1/PREFETCHIT0, gated by CPUID Fn8000_0021_EAX[PREFETCHI]. I would keep them out of a "documented no effect" slice. - `0F 1A`, `0F 1B`, `0F 1C /1-7` and prefixed `0F 1E` are listed as NOP in Table A-4. Only `F3 0F 1E` with reg=1, mod=11 is RDSSP. So accepting them matches the APM, but the docs and the code comment then need to say so, and a test needs to pin them. **Suggestion:** select by `i.code` rather than by mnemonic. Accept the `RESERVEDNOP_RM{16,32,64}_R{16,32,64}_0F19`…`_0F1F` codes, plus `_0F18` with `ModRM.reg & 7` in {4, 5} if you want Group 16 /4 and /5. Add `0f0dc0` and `0f18f0` to the refused neighbours in `hint_nop_check.py`, so that a later widening is visible as intended. **2. Smaller points:** - In `hint_nop_fixture.py`, the lifted call is outside the `__try`. A lifted body that evaluates the operand would crash the test process instead of reporting MISMATCH. Wrapping it like the native call gives a clearer failure. - The memory-form cases address `[page + 17]` (or `+25`), because RAX is `a + b` after the prologue. That is still inside the inaccessible page, so the fault check holds. A comment saying so would help. - The two CMake blocks are inserted at column 0 between the `cpu_integer_flags_controls` lines, inside the indented `if(EXISTS "${INTAKE_PYTHON}")` block. APM references: - NOP page: "rFLAGS Affected: None", "Exceptions: None". - Table A-4, Secondary Opcode Map, low nibble 8–Fh: row 1 lists `0F 19`–`0F 1F` as NOP with a ModRM, plus `(F3) RDSSP reg=1, mod=11`. - Table A-7: Group 16 and Group P. - PREFETCHlevel page: the `0F 18 /6` and `/7` encodings. I did not build or run the branch. The acceptance results above come from decoding with iced and from applying the branch's condition.
triggered02 commented 2026-11-24 15:02:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T14:54:51Z.


Both points were right, and the first one was a real defect rather than a documentation gap: my acceptance test was op in (M.NOP, M.RESERVEDNOP), so it accepted every encoding iced decodes as RESERVEDNOP. Fixed in 992cf643.

1. Selection by code. The lowering now accepts exactly RESERVEDNOP_RM{16,32,64}_R{16,32,64}_0F19, _0F1D, _0F1E and _0F1F, and nothing else in that space. Your three sub-points:

  • 0F 0D — agreed, Group P aliases PREFETCH Exclusive, so it is now refused. 0f0dc0 is in the refused set.
  • 0F 18 /6 and /7 — agreed, PREFETCHIT1/0 under CPUID Fn8000_0021_EAX, so refused. 0f18f0 and 0f18f8 are pinned as refused. I did not take the optional Group 16 /4 and /5; leaving the whole 0F 18 row out keeps this slice to encodings the APM calls no-effect without a CPUID dependency.
  • 0F 1A, 0F 1B, 0F 1C /1-7, prefixed 0F 1E — I checked iced here: the prefixed form really does decode to the same code as unprefixed 0F 1E (RESERVEDNOP_RM32_R32_0F1E), while ENDBR64/ENDBR32/RDSSP decode differently. So the prefixed form is accepted and the docs now say why: only reg=1 with mod=11 in that encoding is RDSSP, which matches the APM. 0F 1A, 0F 1B and 0F 1C stay out of this slice and are refused, since the slice is the 19/1D/1E/1F row.

The check now pins the boundary from both sides — seven accepted patterns and ten refused neighbours, six of which the previous test accepted:

refused 0f0dc0 (0F 0D Group P (aliases PREFETCH Exclusive)): ok
refused 0f18f0 (0F 18 /6 (PREFETCHIT1 under CPUID Fn8000_0021_EAX)): ok
refused 0f18f8 (0F 18 /7 (PREFETCHIT0)): ok
refused 0f1a00 / 0f1b00 / 0f1c08: ok
PASS: 7 accepted forms lowered to a no-op, 10 neighbours still refused

2. The smaller points, all taken.

  • The lifted call now runs under the same __try as the native call, and the line prints lifted_faulted=0 as well as faulted=0, so a lowering that evaluated the operand reports a mismatch instead of taking the process down.
  • A comment records that the memory forms address page+17 (page+25), which is still inside the single inaccessible page, so the fault control holds.
  • The CMake block is indented to match the if(EXISTS "${INTAKE_PYTHON}") it sits in.

docs/experiments.md now states the exact accepted and refused sets and why 0F 0D and 0F 18 are not hint NOPs.

Fixture still passes: PASS: every hint NOP matched its lifted body without evaluating the operand, with the load and register-write controls both holding. Thanks for the APM citations — the mnemonic shortcut was the wrong level to select at and I would not have caught it from the tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135153682 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#issuecomment-7135153682). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T14:54:51Z. --- Both points were right, and the first one was a real defect rather than a documentation gap: my acceptance test was `op in (M.NOP, M.RESERVEDNOP)`, so it accepted every encoding iced decodes as `RESERVEDNOP`. Fixed in `992cf643`. **1. Selection by code.** The lowering now accepts exactly `RESERVEDNOP_RM{16,32,64}_R{16,32,64}_0F19`, `_0F1D`, `_0F1E` and `_0F1F`, and nothing else in that space. Your three sub-points: - **`0F 0D`** — agreed, Group P aliases PREFETCH Exclusive, so it is now refused. `0f0dc0` is in the refused set. - **`0F 18 /6` and `/7`** — agreed, PREFETCHIT1/0 under CPUID Fn8000_0021_EAX, so refused. `0f18f0` and `0f18f8` are pinned as refused. I did **not** take the optional Group 16 `/4` and `/5`; leaving the whole `0F 18` row out keeps this slice to encodings the APM calls no-effect without a CPUID dependency. - **`0F 1A`, `0F 1B`, `0F 1C /1-7`, prefixed `0F 1E`** — I checked iced here: the prefixed form really does decode to the same code as unprefixed `0F 1E` (`RESERVEDNOP_RM32_R32_0F1E`), while `ENDBR64`/`ENDBR32`/`RDSSP` decode differently. So the prefixed form is accepted and the docs now say why: only reg=1 with mod=11 in that encoding is `RDSSP`, which matches the APM. `0F 1A`, `0F 1B` and `0F 1C` stay out of this slice and are refused, since the slice is the 19/1D/1E/1F row. The check now pins the boundary from both sides — seven accepted patterns and ten refused neighbours, six of which the previous test accepted: ``` refused 0f0dc0 (0F 0D Group P (aliases PREFETCH Exclusive)): ok refused 0f18f0 (0F 18 /6 (PREFETCHIT1 under CPUID Fn8000_0021_EAX)): ok refused 0f18f8 (0F 18 /7 (PREFETCHIT0)): ok refused 0f1a00 / 0f1b00 / 0f1c08: ok PASS: 7 accepted forms lowered to a no-op, 10 neighbours still refused ``` **2. The smaller points, all taken.** - The lifted call now runs under the same `__try` as the native call, and the line prints `lifted_faulted=0` as well as `faulted=0`, so a lowering that evaluated the operand reports a mismatch instead of taking the process down. - A comment records that the memory forms address `page+17` (`page+25`), which is still inside the single inaccessible page, so the fault control holds. - The CMake block is indented to match the `if(EXISTS "${INTAKE_PYTHON}")` it sits in. `docs/experiments.md` now states the exact accepted and refused sets and why `0F 0D` and `0F 18` are not hint NOPs. Fixture still passes: `PASS: every hint NOP matched its lifted body without evaluating the operand`, with the load and register-write controls both holding. Thanks for the APM citations — the mnemonic shortcut was the wrong level to select at and I would not have caught it from the tests.
tedin7 commented 2026-11-24 16:03:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:35:54Z.

Review: COMMENTED


Technical review (Linux only; the Windows pipeline and the Windows-only native fixture were not run).

Checked out the PR head in a clean tree and ran:

  • tests/cpu/hint_nop_check.py: passes (7 accepted, 10 refused).
  • tests/cpu/hint_nop_fixture.py emit: generates the C++ for the 5 cases. It needs VirtualAlloc, SEH and __declspec(allocate), so I could only read the output, not build or run it. The "matched natively" statements in docs/experiments.md are therefore unverified here.
  • Extra probes through lower() (same body as an already-accepted 0F 1F 00, labels normalised): 66/REX.W forms of 0F 19/0F 1E/0F 1F, register forms, 0F 1F with disp32 and RIP-relative operands, F2/F3/67 prefixes, F3 0F 1E with mod=11 and reg=0/2..7 (including FC, FF) all lower to the same no-op. F3 0F 1E C8/REX.W C8 (RDSSP), F0-prefixed forms (decode as invalid) and a segment prefix stay refused. This agrees with the selection by iced code described in the PR.

Local mutation check on tools/ffx_version_query.py (each reverted afterwards, tree clean):

  • drop 0F19: caught. Drop 0F1D: caught.
  • selection by mnemonic (op == M.RESERVEDNOP) instead of by code: caught (6 cases).
  • disable the new condition: caught.
  • remove operand size 16 from _RESERVED_NOP_CODES: not caught.
  • remove operand size 64: not caught.

So the statement that the set covers "every operand size" is not pinned by any test: all accepted encodings in ACCEPTED use the default size. Suggestion (non-blocking): add 660f1900, 660f1e00, 480f1900 and 480f1e00 to ACCEPTED. They pass today (verified above), so this is only a guard.

Docs (docs/experiments.md), worth fixing before merge:

  • The new "Reserved hint NOPs" paragraph starts on the line directly after the cpu_aot_xchg run line, with no blank line, so Markdown renders it as part of the preceding paragraph.
  • Inside it, ...is \RDSSP`.`cpu_hint_nop` pins the exact byte patterns` has no space or paragraph break between two sentences.
  • Five unrelated hunks only delete a blank line (near the cpu_native_section block, the LDS qword paragraphs, the Leonida paragraph, the AVX2 heading and the dxr_placed_build_ block). They are unrelated to this change and add diff noise.

CMake wiring (cpu_hint_nop under INTAKE_PYTHON, cpu_hint_nop_fixture with SKIP_RETURN_CODE 77) is consistent with the other entries in that block. One small thing: tests/cpu/hint_nop_fixture.py has no trailing newline.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042353166 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6042353166). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:35:54Z. **Review:** COMMENTED --- Technical review (Linux only; the Windows pipeline and the Windows-only native fixture were not run). Checked out the PR head in a clean tree and ran: - `tests/cpu/hint_nop_check.py`: passes (7 accepted, 10 refused). - `tests/cpu/hint_nop_fixture.py emit`: generates the C++ for the 5 cases. It needs `VirtualAlloc`, SEH and `__declspec(allocate)`, so I could only read the output, not build or run it. The "matched natively" statements in `docs/experiments.md` are therefore unverified here. - Extra probes through `lower()` (same body as an already-accepted `0F 1F 00`, labels normalised): `66`/`REX.W` forms of `0F 19`/`0F 1E`/`0F 1F`, register forms, `0F 1F` with disp32 and RIP-relative operands, `F2`/`F3`/`67` prefixes, `F3 0F 1E` with mod=11 and reg=0/2..7 (including `FC`, `FF`) all lower to the same no-op. `F3 0F 1E C8/REX.W C8` (RDSSP), `F0`-prefixed forms (decode as invalid) and a segment prefix stay refused. This agrees with the selection by iced code described in the PR. Local mutation check on `tools/ffx_version_query.py` (each reverted afterwards, tree clean): - drop `0F19`: caught. Drop `0F1D`: caught. - selection by mnemonic (`op == M.RESERVEDNOP`) instead of by code: caught (6 cases). - disable the new condition: caught. - remove operand size 16 from `_RESERVED_NOP_CODES`: **not caught**. - remove operand size 64: **not caught**. So the statement that the set covers "every operand size" is not pinned by any test: all accepted encodings in `ACCEPTED` use the default size. Suggestion (non-blocking): add `660f1900`, `660f1e00`, `480f1900` and `480f1e00` to `ACCEPTED`. They pass today (verified above), so this is only a guard. Docs (`docs/experiments.md`), worth fixing before merge: - The new "Reserved hint NOPs" paragraph starts on the line directly after the `cpu_aot_xchg` run line, with no blank line, so Markdown renders it as part of the preceding paragraph. - Inside it, `...is \`RDSSP\`.\`cpu_hint_nop\` pins the exact byte patterns` has no space or paragraph break between two sentences. - Five unrelated hunks only delete a blank line (near the `cpu_native_section` block, the LDS qword paragraphs, the Leonida paragraph, the AVX2 heading and the `dxr_placed_build_` block). They are unrelated to this change and add diff noise. CMake wiring (`cpu_hint_nop` under `INTAKE_PYTHON`, `cpu_hint_nop_fixture` with `SKIP_RETURN_CODE 77`) is consistent with the other entries in that block. One small thing: `tests/cpu/hint_nop_fixture.py` has no trailing newline. AI-assisted; commands listed were executed locally.
triggered02 commented 2026-11-24 16:03:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T16:00:03Z.


All three points taken, in f64f7e38. And your mutation result was the useful one: the operand-size claim was genuinely unpinned.

Operand sizes. ACCEPTED now includes 660f1900, 660f1e00, 480f1900 and 480f1e00. Your two surviving mutations now fail:

remove 16 -> accepted 660f1900 MISMATCH (unsupported query operation at 0x0: nop [rax],ax)
remove 64 -> accepted 480f1900 MISMATCH (unsupported query operation at 0x0: nop [rax],rax)
restored  -> PASS: 11 accepted forms lowered to a no-op, 10 neighbours still refused

So the "every operand size" statement in the docs is now backed by the test rather than by the implementation.

Docs. I rebuilt docs/experiments.md from main and inserted only the block, so the five unrelated blank-line hunks are gone — the file's diff against main is now a 6-line addition. The block starts on its own paragraph, and the two sentences that ran together (...is \RDSSP`.`cpu_hint_nop` pins...`) are separated.

Trailing newline added to tests/cpu/hint_nop_fixture.py.

On your Linux-only caveat: the native half did run here, on Windows, release preset:

hn_0f19_reg   native=0x123456789ab1600 lifted=0x123456789ab1600 faulted=0 lifted_faulted=0 ok
hn_0f19_mem / hn_0f1d_mem / hn_0f1e_mem / hn_0f1f_disp8: native == lifted, faulted=0
control load from PAGE_NOACCESS faulted=1 ok
control register write: hint=0x123456789ab1600 write=0x12344678 ok
PASS: every hint NOP matched its lifted body without evaluating the operand

So the "matched natively" statements are verified on one Windows machine, not just read from the generated source — but only for the five memory/register/displacement cases in ACCEPTED that the fixture emits; the four operand-size forms are pinned only at the lowering level, which the docs now describe that way.

cpu_hint_nop and cpu_hint_nop_fixture both pass; docs_links_check (348 links) and bidi_controls_check pass. Thanks — the mutation table is what turned a comment into a requirement.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7136959290 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#issuecomment-7136959290). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T16:00:03Z. --- All three points taken, in `f64f7e38`. And your mutation result was the useful one: the operand-size claim was genuinely unpinned. **Operand sizes.** `ACCEPTED` now includes `660f1900`, `660f1e00`, `480f1900` and `480f1e00`. Your two surviving mutations now fail: ``` remove 16 -> accepted 660f1900 MISMATCH (unsupported query operation at 0x0: nop [rax],ax) remove 64 -> accepted 480f1900 MISMATCH (unsupported query operation at 0x0: nop [rax],rax) restored -> PASS: 11 accepted forms lowered to a no-op, 10 neighbours still refused ``` So the "every operand size" statement in the docs is now backed by the test rather than by the implementation. **Docs.** I rebuilt `docs/experiments.md` from `main` and inserted only the block, so the five unrelated blank-line hunks are gone — the file's diff against main is now a 6-line addition. The block starts on its own paragraph, and the two sentences that ran together (`...is \`RDSSP\`.\`cpu_hint_nop\` pins...`) are separated. **Trailing newline** added to `tests/cpu/hint_nop_fixture.py`. On your Linux-only caveat: the native half did run here, on Windows, release preset: ``` hn_0f19_reg native=0x123456789ab1600 lifted=0x123456789ab1600 faulted=0 lifted_faulted=0 ok hn_0f19_mem / hn_0f1d_mem / hn_0f1e_mem / hn_0f1f_disp8: native == lifted, faulted=0 control load from PAGE_NOACCESS faulted=1 ok control register write: hint=0x123456789ab1600 write=0x12344678 ok PASS: every hint NOP matched its lifted body without evaluating the operand ``` So the "matched natively" statements are verified on one Windows machine, not just read from the generated source — but only for the five memory/register/displacement cases in `ACCEPTED` that the fixture emits; the four operand-size forms are pinned only at the lowering level, which the docs now describe that way. `cpu_hint_nop` and `cpu_hint_nop_fixture` both pass; `docs_links_check` (348 links) and `bidi_controls_check` pass. Thanks — the mutation table is what turned a comment into a requirement.
tedin7 commented 2026-11-24 17:01:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:59:14Z.

Review: COMMENTED


Re-review of head f3b9f52f (the earlier review was on e418311c).

What the change does

  • tools/ffx_version_query.py lowers the reserved hint NOP forms (0F 19, 0F 1D, 0F 1E, 0F 1F with any ModRM, in 16, 32 and 64-bit operand size) to a no-op. The set is chosen by iced code (_RESERVED_NOP_CODES), not by mnemonic, so 0F 0D, 0F 18 /6-/7, 0F 1A, 0F 1B, CLDEMOTE, RDSSP and ENDBR stay refused. That is the right call: those decode as the same reserved-NOP mnemonic family but are not all hint NOPs.
  • The operand is not evaluated, so a memory form with an inaccessible address cannot fault in the lowered code.

Findings

  • None blocking. The accepted and refused lists in tests/cpu/hint_nop_check.py match the doc (11 accepted, 10 refused).
  • Minor: tests/cpu/hint_nop_fixture.py covers the five unprefixed 32-bit cases only. The F3 and 16/64-bit forms are exercised by the Python check, not by the native-versus-lifted fixture. That is enough for this PR, but a later case would close it.
  • Minor: both new Python files end without a newline.
  • ENDBR64/32 being refused is stated in the docs. Code built with CET will still hit the refusal; that is a separate slice.

Checks run (Linux only; cpu_hint_nop_fixture compiles with MSVC __try and needs Windows, so it was not run)

  • git diff --check origin/main...HEAD: clean.
  • python3 tests/docs_links_check.py: self-test passed, 16 files, 348 links.
  • python3 tests/bidi_controls_check.py: self-test passed, 1275 files, no bidirectional controls.
  • tests/cpu/hint_nop_check.py with iced-x86 from requirements-dev.txt: PASS, 11 accepted forms lowered to the same body as a plain NOP, 10 neighbours still refused.
  • tests/cpu/hint_nop_fixture.py emit runs and writes the fixture. MinGW cannot compile it (MSVC-only __assume and __try), as expected.
  • tests/cpu/lower_prefixes_check.py: passes with the change.
  • Mutation 1, 0F1D removed from the code set: KILLED (accepted 0f1d00 fails).
  • Mutation 2, 16-bit operand size removed: KILLED (the two 66 forms fail).
  • Mutation 3, the whole iced RESERVEDNOP space accepted: KILLED (six refused cases, among them 0f0dc0 and 0f18f0, are accepted and reported).
  • All mutations were reverted; the checkout was clean afterwards.

Verification is Linux-only; the native comparison needs the Windows run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043734700 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6043734700). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T16:59:14Z. **Review:** COMMENTED --- Re-review of head f3b9f52f (the earlier review was on e418311c). **What the change does** - `tools/ffx_version_query.py` lowers the reserved hint NOP forms (`0F 19`, `0F 1D`, `0F 1E`, `0F 1F` with any ModRM, in 16, 32 and 64-bit operand size) to a no-op. The set is chosen by iced code (`_RESERVED_NOP_CODES`), not by mnemonic, so `0F 0D`, `0F 18 /6-/7`, `0F 1A`, `0F 1B`, CLDEMOTE, RDSSP and ENDBR stay refused. That is the right call: those decode as the same reserved-NOP mnemonic family but are not all hint NOPs. - The operand is not evaluated, so a memory form with an inaccessible address cannot fault in the lowered code. **Findings** - None blocking. The accepted and refused lists in `tests/cpu/hint_nop_check.py` match the doc (11 accepted, 10 refused). - Minor: `tests/cpu/hint_nop_fixture.py` covers the five unprefixed 32-bit cases only. The `F3` and 16/64-bit forms are exercised by the Python check, not by the native-versus-lifted fixture. That is enough for this PR, but a later case would close it. - Minor: both new Python files end without a newline. - `ENDBR64/32` being refused is stated in the docs. Code built with CET will still hit the refusal; that is a separate slice. **Checks run (Linux only; `cpu_hint_nop_fixture` compiles with MSVC `__try` and needs Windows, so it was not run)** - `git diff --check origin/main...HEAD`: clean. - `python3 tests/docs_links_check.py`: self-test passed, 16 files, 348 links. - `python3 tests/bidi_controls_check.py`: self-test passed, 1275 files, no bidirectional controls. - `tests/cpu/hint_nop_check.py` with iced-x86 from `requirements-dev.txt`: PASS, 11 accepted forms lowered to the same body as a plain NOP, 10 neighbours still refused. - `tests/cpu/hint_nop_fixture.py emit` runs and writes the fixture. MinGW cannot compile it (MSVC-only `__assume` and `__try`), as expected. - `tests/cpu/lower_prefixes_check.py`: passes with the change. - Mutation 1, `0F1D` removed from the code set: KILLED (`accepted 0f1d00` fails). - Mutation 2, 16-bit operand size removed: KILLED (the two `66` forms fail). - Mutation 3, the whole iced `RESERVEDNOP` space accepted: KILLED (six refused cases, among them `0f0dc0` and `0f18f0`, are accepted and reported). - All mutations were reverted; the checkout was clean afterwards. Verification is Linux-only; the native comparison needs the Windows run. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 18:02:11 +00:00
tedin7 commented 2026-11-24 18:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:14:56Z.

Review: COMMENTED


Re-review of the delta for head 4fb81a5f against my previous review at f3b9f52f (comment only, no approval).

Verdict: no blocking findings in the delta.

What changed since f3b9f52f:

  • The branch was rebased, so f3b9f52f is no longer an ancestor of the head. I compared the PR's own diff against its merge base before and after the rebase. The only differences are in tests/cpu/hint_nop_check.py and tests/cpu/hint_nop_fixture.py: both files now end with a newline (both end in 0a), and hint_nop_fixture.py has five new native-versus-lifted cases (F3 0F 1E [rax], 66 0F 19, 66 0F 1E, 48 0F 19, 48 0F 1E). CMakeLists.txt, docs/experiments.md and tools/ffx_version_query.py are byte-identical across the rebase.
  • The five new fixture byte strings match the encodings that hint_nop_check.py already lists as accepted, so the Python check and the Windows fixture now cover the same eleven forms (the fixture keeps its own five unprefixed cases for 32-bit, so ten in total, as the commit message says). The docs paragraph ("seven accepted encodings plus the 16-bit and 64-bit forms", "ten neighbours") still matches the code.
  • No assertion is weakened or removed, and the added lines are plain ASCII.

Checks run on Linux (Python 3 venv with the versions pinned in requirements-dev.txt: iced-x86 1.21.0, pefile 2024.8.26):

  • python3 -I -B tests/cpu/hint_nop_check.py: PASS (11 accepted forms lowered to a no-op, 10 neighbours still refused).
  • python3 -I -B tests/cpu/hint_nop_fixture.py emit: emits 10 cases, and the five new names are in the generated C++.
  • git diff --check over the PR files: clean. python3 -I tests/docs_links_check.py: self-test passed, 17 files, 363 links. python3 -I tests/bidi_controls_check.py: self-test passed, 1282 files, none found.
  • No temp files left behind (scratch lived in a private directory that is removed after the review).

Mutation checks I actually ran on tools/ffx_version_query.py (one change at a time, restored after each; every one is caught by hint_nop_check.py, exit 1):

  1. Dropped the 64-bit size from the code set: 2 mismatches, 480f1900 and 480f1e00.
  2. Dropped the 16-bit size: 2 mismatches, 660f1900 and 660f1e00.
  3. Dropped 0F19, 0F1D or 0F1E from the opcode list: 5, 1 and 4 mismatches.
  4. Added 0F1A to the accepted set: 0f1a00 reported as wrongly accepted.
  5. Selected by mnemonic (op == M.RESERVEDNOP) instead of by iced code: 6 mismatches, starting with 0f0dc0.
  6. Accepted ENDBR64, CLDEMOTE or RDSSPD one at a time: each is caught by its own refused case.
  7. Lowered the reserved NOPs to a register write instead of ;: 10 mismatches.
    So the five new fixture cases are not what protects the lowering on Linux. The Python check already does, and the new cases extend the Windows-only native comparison, which I could not run.

Non-blocking notes (none are caused by the delta):

  • The module docstring of hint_nop_check.py says the memory-form cases include a non-canonical pointer in RAX and a RIP-relative displacement, but the ACCEPTED table has neither. I checked by hand that 0f190500000000 (RIP-relative) lowers to the same no-op body, and so do 670f1900, f20f1900 and f30f1e08 (F3 0F 1E /1 with a memory operand, which the docs say is not RDSSP). f00f1900 (LOCK) is refused. Adding 0f190500000000 and f30f1e08 to ACCEPTED would pin the claims the docstring and the docs make.
  • The Windows-only parts (the cpu_hint_nop_fixture native run, the PAGE_NOACCESS and register-write controls) are as reported by the author; I did not reproduce them.

Limits: Linux only. I ran no ctest preset and no Windows build, and the stand-alone Python check uses the iced version pinned by the repo, not the newest release.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043977814 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6043977814). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:14:56Z. **Review:** COMMENTED --- Re-review of the delta for head `4fb81a5f` against my previous review at `f3b9f52f` (comment only, no approval). **Verdict: no blocking findings in the delta.** What changed since `f3b9f52f`: - The branch was rebased, so `f3b9f52f` is no longer an ancestor of the head. I compared the PR's own diff against its merge base before and after the rebase. The only differences are in `tests/cpu/hint_nop_check.py` and `tests/cpu/hint_nop_fixture.py`: both files now end with a newline (both end in `0a`), and `hint_nop_fixture.py` has five new native-versus-lifted cases (`F3 0F 1E [rax]`, `66 0F 19`, `66 0F 1E`, `48 0F 19`, `48 0F 1E`). `CMakeLists.txt`, `docs/experiments.md` and `tools/ffx_version_query.py` are byte-identical across the rebase. - The five new fixture byte strings match the encodings that `hint_nop_check.py` already lists as accepted, so the Python check and the Windows fixture now cover the same eleven forms (the fixture keeps its own five unprefixed cases for 32-bit, so ten in total, as the commit message says). The docs paragraph ("seven accepted encodings plus the 16-bit and 64-bit forms", "ten neighbours") still matches the code. - No assertion is weakened or removed, and the added lines are plain ASCII. Checks run on Linux (Python 3 venv with the versions pinned in `requirements-dev.txt`: iced-x86 1.21.0, pefile 2024.8.26): - `python3 -I -B tests/cpu/hint_nop_check.py`: PASS (11 accepted forms lowered to a no-op, 10 neighbours still refused). - `python3 -I -B tests/cpu/hint_nop_fixture.py emit`: emits 10 cases, and the five new names are in the generated C++. - `git diff --check` over the PR files: clean. `python3 -I tests/docs_links_check.py`: self-test passed, 17 files, 363 links. `python3 -I tests/bidi_controls_check.py`: self-test passed, 1282 files, none found. - No temp files left behind (scratch lived in a private directory that is removed after the review). Mutation checks I actually ran on `tools/ffx_version_query.py` (one change at a time, restored after each; every one is caught by `hint_nop_check.py`, exit 1): 1. Dropped the 64-bit size from the code set: 2 mismatches, `480f1900` and `480f1e00`. 2. Dropped the 16-bit size: 2 mismatches, `660f1900` and `660f1e00`. 3. Dropped `0F19`, `0F1D` or `0F1E` from the opcode list: 5, 1 and 4 mismatches. 4. Added `0F1A` to the accepted set: `0f1a00` reported as wrongly accepted. 5. Selected by mnemonic (`op == M.RESERVEDNOP`) instead of by iced code: 6 mismatches, starting with `0f0dc0`. 6. Accepted ENDBR64, CLDEMOTE or RDSSPD one at a time: each is caught by its own refused case. 7. Lowered the reserved NOPs to a register write instead of `;`: 10 mismatches. So the five new fixture cases are not what protects the lowering on Linux. The Python check already does, and the new cases extend the Windows-only native comparison, which I could not run. Non-blocking notes (none are caused by the delta): - The module docstring of `hint_nop_check.py` says the memory-form cases include a non-canonical pointer in RAX and a RIP-relative displacement, but the `ACCEPTED` table has neither. I checked by hand that `0f190500000000` (RIP-relative) lowers to the same no-op body, and so do `670f1900`, `f20f1900` and `f30f1e08` (F3 0F 1E /1 with a memory operand, which the docs say is not RDSSP). `f00f1900` (LOCK) is refused. Adding `0f190500000000` and `f30f1e08` to `ACCEPTED` would pin the claims the docstring and the docs make. - The Windows-only parts (the `cpu_hint_nop_fixture` native run, the PAGE_NOACCESS and register-write controls) are as reported by the author; I did not reproduce them. Limits: Linux only. I ran no ctest preset and no Windows build, and the stand-alone Python check uses the iced version pinned by the repo, not the newest release. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-24 18:02:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T17:15:47Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043991185 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#pullrequestreview-6043991185). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T17:15:47Z. **Review:** COMMENTED --- _No description provided._
triggered02 commented 2026-11-24 18:02:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T17:03:25Z.


Both minors are done in 4fb81a5f, and the Windows run you could not do is now in the PR.

Native coverage for the prefixed and 16/64-bit forms. The fixture has ten cases now, adding F3 0F 1E [rax] and the four 66/48 operand-size forms. Each compares the executed bytes against the lifted body with a PAGE_NOACCESS base, so evaluating the operand would fault rather than return:

hn_f3_0f1e   F3 0F 1E [rax]                        native=0x2db08950611 lifted=0x2db08950611 faulted=0 ok
hn_0f19_16   66 0F 19 [rax], 16-bit operand size   native == lifted, faulted=0
hn_0f1e_16   66 0F 1E [rax], 16-bit operand size   native == lifted, faulted=0
hn_0f19_64   48 0F 19 [rax], 64-bit operand size   native == lifted, faulted=0
hn_0f1e_64   48 0F 1E [rax], 64-bit operand size   native == lifted, faulted=0
control load from PAGE_NOACCESS faulted=1 ok
control register write: hint=0x123456789ab1600 write=0x12344678 ok

Both controls still fire, so "did not fault" is meaningful rather than a dead assertion.

dev:     cpu_hint_nop Passed 0.44 s, cpu_hint_nop_fixture Passed 0.04 s
release: cpu_hint_nop Passed 0.42 s, cpu_hint_nop_fixture Passed 0.03 s

Trailing newlines are added to both new Python files.

One note on the pre-existing five cases: they already covered 0F 19, 0F 1D, 0F 1E and 0F 1F at 32-bit, so the set now spans all four opcodes in the accepted list at the sizes the doc claims, with F3 covered once. ENDBR64/32 stays refused, as you noted — that is its own slice.

Thanks for the mutation work; the 16-bit removal mutation was the one that caught the operand-size gap, and that is exactly the case this fixture addition now pins natively as well.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138617168 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#issuecomment-7138617168). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T17:03:25Z. --- Both minors are done in `4fb81a5f`, and the Windows run you could not do is now in the PR. **Native coverage for the prefixed and 16/64-bit forms.** The fixture has ten cases now, adding `F3 0F 1E [rax]` and the four `66`/`48` operand-size forms. Each compares the executed bytes against the lifted body with a `PAGE_NOACCESS` base, so evaluating the operand would fault rather than return: ``` hn_f3_0f1e F3 0F 1E [rax] native=0x2db08950611 lifted=0x2db08950611 faulted=0 ok hn_0f19_16 66 0F 19 [rax], 16-bit operand size native == lifted, faulted=0 hn_0f1e_16 66 0F 1E [rax], 16-bit operand size native == lifted, faulted=0 hn_0f19_64 48 0F 19 [rax], 64-bit operand size native == lifted, faulted=0 hn_0f1e_64 48 0F 1E [rax], 64-bit operand size native == lifted, faulted=0 control load from PAGE_NOACCESS faulted=1 ok control register write: hint=0x123456789ab1600 write=0x12344678 ok ``` Both controls still fire, so "did not fault" is meaningful rather than a dead assertion. ``` dev: cpu_hint_nop Passed 0.44 s, cpu_hint_nop_fixture Passed 0.04 s release: cpu_hint_nop Passed 0.42 s, cpu_hint_nop_fixture Passed 0.03 s ``` **Trailing newlines** are added to both new Python files. One note on the pre-existing five cases: they already covered `0F 19`, `0F 1D`, `0F 1E` and `0F 1F` at 32-bit, so the set now spans all four opcodes in the accepted list at the sizes the doc claims, with F3 covered once. `ENDBR64/32` stays refused, as you noted — that is its own slice. Thanks for the mutation work; the 16-bit removal mutation was the one that caught the operand-size gap, and that is exactly the case this fixture addition now pins natively as well.
R0Y00 commented 2026-11-24 18:03:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T17:15:46Z.

Code review location: tools/ffx_version_query.py; line 3069

@@ -3066,7 +3066,13 @@ def p2_lane(sel, out_off):
             suffix, host = {1: ("8", "char"), 2: ("16", "short"), 4: ("", "long"), 8: ("64", "__int64")}[size]
             stmt = write_register(register, f"_InterlockedExchange{suffix}(reinterpret_cast<{host} volatile*>({address()}), "
                                             f"static_cast<{host}>({operand(n)}))")
-        elif op == M.NOP or (op == M.XCHG and i.op0_register == i.op1_register == R.AX):
+        elif op in (M.NOP, M.RESERVEDNOP) or (op == M.XCHG and i.op0_register == i.op1_register == R.AX):

Verified the experiment notes on 4fb81a5f. They document the accepted encodings, refusals and both CTest commands. The two Windows Release checks passed independently.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4683781789 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1547#discussion_r4683781789). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T17:15:46Z. **Code review location:** `tools/ffx_version_query.py`; line 3069 ~~~~diff @@ -3066,7 +3066,13 @@ def p2_lane(sel, out_off): suffix, host = {1: ("8", "char"), 2: ("16", "short"), 4: ("", "long"), 8: ("64", "__int64")}[size] stmt = write_register(register, f"_InterlockedExchange{suffix}(reinterpret_cast<{host} volatile*>({address()}), " f"static_cast<{host}>({operand(n)}))") - elif op == M.NOP or (op == M.XCHG and i.op0_register == i.op1_register == R.AX): + elif op in (M.NOP, M.RESERVEDNOP) or (op == M.XCHG and i.op0_register == i.op1_register == R.AX): ~~~~ --- Verified the experiment notes on 4fb81a5f. They document the accepted encodings, refusals and both CTest commands. The two Windows Release checks passed independently.
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!1540
No description provided.