ProjectScarlett: insertq (SSE4a) crashes on Intel CPUs when the start screen comes up #152
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/brcly--TuxBox#152
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?
@3kynox on GitHub · 2026-11-25 08:56 UTC · original
Summary
With
clzero,monitorxandmwaitxhandled (#146), ProjectScarlett 1.0.2.1 still executes one more AMD-only instruction on an Intel host:insertq, from SSE4a. Zen 2 implements SSE4a. No Intel CPU does, so the instruction raisesEXCEPTION_ILLEGAL_INSTRUCTION. The first site is reached at about the time the player-selection prompt is first presented.insertq xmm1, xmm2, imm8, imm8copies a bit field from the low quadword of the source into the low quadword of the destination. The first immediate is the field length and the second is its bit index.On 24 November, with a local build that already served the other three instructions but not this one, two launches exited with code 29 after 68 s and 85 s. Both logs contain:
I have not reproduced the exit on unmodified
main: my one launch ofmainat0a8d2eeended after 144 s, before the prompt was presented. The same commit with the handler from the pull request reaches the site and logsemulated unsupported insertq at RVA 0x2e7ff1, so the instruction is executed on that path.Affected sites
A byte scan of
.textfor the immediate form with register operands (F2 [REX] 0F 78 /r ib ib) finds 19 candidates. It finds none forextrq(66 0F 78,66 0F 79) or forinsertqwithout immediates (F2 0F 79). A scan is not a disassembly, so some candidates may be data.RVAs: 0x27C8F2, 0x27E9F1, 0x2E7FF1, 0x7F1AC9, 0x7F1B29, 0x7F1B38, 0x7F1B44, 0xF75FB3, 0xF762B7, 0xF765B5, 0xF768B0, 0x269DCB2, 0x32BC150, 0x43D440E, 0x43D491B, 0x455BAC7, 0x5084782, 0x546D4A2, 0x55B1811.
Three of them have been executed on this machine so far:
f2 0f 78 c1 10 10insertq xmm0, xmm1, 16, 16f2 0f 78 c0 08 18insertq xmm0, xmm0, 8, 24f2 44 0f 78 cf 08 00insertq xmm9, xmm7, 8, 0System
mainat0a8d2eefor the launches above