cpu: lower XSAVE and XRSTOR state save and restore instructions #1058
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1065"
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 Ammmae0x on 2026-11-24T00:04:08Z.
Change
Add a bounded leaf AOT translator ( ools/cpu_xsave_aot.py) and source-built MASM/Python differential fixture ( ests/cpu/xsave_state.asm, ests/cpu/xsave_state.def, ests/cpu/xsave_state_check.py, CMakeLists.txt target cpu_aot_xsave_state, and docs/experiments.md) covering four uncovered x64 XSAVE forms from docs/coverage/x64_zen2.tsv:
The translator models the bounded 832-byte standard-format x87|SSE|AVX (XCR0[2:0] = 7) XState locally without mutating host nonvolatile XMM6..15, x87, or MXCSR:
et.
Verification
elease (/O2) presets:
Evidence and follow-up
Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:13:38Z.
Review: CHANGES_REQUESTED
Windows Release passed all 70 native/lifted/reference cases with the fixture's initialized entry state. I then reused its source-built native trampoline with SSE in use, MXCSR 0x3f80 and the low XMM0 lane set to 0x3f800000. Both plain XSAVE exports saved those values natively. Both lifted exports saved MXCSR 0x1f80 and a zero lane. The ordinary three-pointer ABI currently gives the caller no way to supply or check this entry state.
Please make the initialized guest state an explicit opt-in profile at the translation entry and in its generated contract, or reject bodies that can observe state from entry before a preceding definition. Keep the existing initialized-state controls and add the nondefault entry case to check the boundary that you choose. This applies to partially initialized restore/save paths as well as the two entry-only exports.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:45:23Z.
Review: APPROVED
The revised entry contract addresses my previous finding. The default now requires definition before a save can observe the incoming state, and the canonical opt-in names the initialized profile. I reran Windows Release on
60467c27. All 70 differential cases matched, the non-default entry control was detected, and dead-read, fault-ordering and output controls passed. Ready on these conditions once both Windows CI jobs pass.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:58:06Z.
The Windows runner reports heap corruption in cpu_aot_xsave_state. I found that the test harness saves every enabled host component but used fixed-size buffers, including the shorter FIP/FDP probe output. The new candidate sizes each full-state host area from CPUID leaf 0xD subleaf 0 EBX and checks the probe guard bytes. The translated guest profile is still the existing bounded 832-byte profile. Both local Windows presets passed all 70 differential cases and fault and entry controls. This host reports 832 bytes, so the CI rerun is needed to verify the original failure is gone. Intel CPUID reference
Candidate:
ee082f52f0