ARM64EC: Map TF to PSTATE.SS when reconstructing a native context

This commit is contained in:
Billy Laws committed 2024-08-05 17:38:45 +00:00
1 parent 9bb9e954c2
commit 507a95b817
1 file changed
+6 -1
+6 -1
View File
@@ -374,9 +374,14 @@ static ARM64_NT_CONTEXT ReconstructPackedECContext(ARM64_NT_CONTEXT& Context) {
ECContext.X24 = 0;
ECContext.X28 = 0;
// NZCV will be converted into EFlags by ntdll, the rest are lost during exception handling.
// NZCV+SS will be converted into EFlags by ntdll, the rest are lost during exception handling.
// See HandleGuestException
ECContext.Cpsr = Context.Cpsr;
uint32_t EFlags = CTX->ReconstructCompactedEFLAGS(Thread, false, nullptr, 0);
if (EFlags & (1U << FEXCore::X86State::RFLAG_TF_LOC)) {
ECContext.Cpsr |= 1 << 21; // PSTATE.SS
}
ECContext.Fpcr = Context.Fpcr;
ECContext.Fpsr = Context.Fpsr;