Emulate SHA-NI and fix SSE4a EXTRQ/INSERTQ register form #126
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!126
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/126/head"
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?
@neobugs1 on GitHub · 2026-07-29 17:42 UTC · original
neobugs1:fix/x64-instruction-shims→main· +517 −2 · 1 files · 4 commits · merged 2026-07-30 14:21 UTCI was testing games on KytyPS5 on my Intel i7-10700. But since Intel 10th gen CPUs and prior don't support SHA-NI, a game I was trying would crash with an illegal instruction like SHA1MSG1 before it could get anywhere.
This adds software emulation for the SHA-NI instructions in x64InstructionEmulator.cpp, using the same illegal-instruction path Kyty already uses for EXTRQ and MONITORX. If the host CPU has SHA-NI natively, none of this runs, so it shouldn't regress anything.
While testing I also fixed the existing SSE4a EXTRQ/INSERTQ handler. It only handled the immediate encoding and always advanced RIP by 6 bytes. The register form is 4 bytes and gets length/index from the source XMM register, so the old code could desync the instruction stream on Intel.
It made a difference on:
@Nmzik on GitHub · 2026-07-29 18:21 UTC · original · edited 2026-07-29 18:24 UTC
@neobugs1 Please include the game name or PPSA code (please edit PR comment) for SHA-NI, and I’ll happily accept the PR. Thanks for understanding.
@Nmzik on GitHub · 2026-07-29 21:58 UTC · original
@neobugs1 Thanks for PR. There’s a definite regression in the INSERTQ changes on my Intel host. Let’s accept only the SHA-NI changes for now - I verified them on Windows and Linux(WSL2), and the results match the hardware 1:1. Could you please retest SHA-NI changes on your Intel host?
@neobugs1 on GitHub · 2026-07-30 06:49 UTC · original
Yeah I retested, this works too.