MONITORX/MWAITX crash on Intel hosts when static --to-intel conversion cannot apply #27564
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-11-26T18:10:26Z.
Problem
Titles that use MONITORX/MWAITX spin-wait primitives crash on Intel hosts with
STATUS_ILLEGAL_INSTRUCTION(0xc000001d) even after CLZERO emulation (#27524, PR #27532), because no runtime emulation exists for the AMD-only monitor/mwait pair. The vectored exception handler already diagnoses them (MONITORX is an AMD-only instruction this CPU lacks) but then the process dies.Why the static path cannot cover this
--to-intellowering for MONITORX/MWAITX exists since #201, and MWAITX correctly lowers topausebecause spurious wakeups are architecturally permitted. But the relink itself fails on at least one observed AAA binary withFAIL: Branch enters an AMD-only instruction— a branch target lands inside an instruction the lowering must rewrite, which static rewriting cannot survive. (This is the same conversion limitation that motivates runtime CLZERO emulation in #27532.)Proposed fix
Runtime emulation in the vectored exception handler, mirroring the SSE4a/CLZERO header pattern:
0F 01 FA): skip. Arming the monitor is an optimization hint with no mandatory architectural effect, so a no-op is semantics-exact.0F 01 FB): skip (optionally with a light yield). Wakeups are voluntary — software must re-test its condition in a loop — so returning immediately is architecturally correct. The trade-off versus native behavior is spin-loop power/CPU cost, matching what the staticpauselowering already accepts.Evidence
Crash report from an Intel i7-10700 boot of PPSA38500, immediately after the title's first GPU frame submission (PM4 FLIP):
The faulting rip is inside statically converted guest code — this binary is exactly the case
--to-intelcannot convert (its relink fails as described above), so the instruction reaches the host CPU unrewritten.Notes
0 emulated so farrefers to the SSE4a counter).