From ec714cd90d8b694e0b3ca78023d2145150c9e861 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 23 May 2024 11:41:15 +0930 Subject: [PATCH] Core: in CX86RecompilerOps::CompileCheckFPUResult64 protect RegPointer before Map_TempReg(asmjit::x86::eax) --- .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 6c911a3d9..1d5986e59 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -8427,6 +8427,11 @@ void CX86RecompilerOps::CompileCheckFPUResult32(int32_t DestReg) void CX86RecompilerOps::CompileCheckFPUResult64(asmjit::x86::Gp RegPointer) { m_RegWorkingSet.UnMap_FPStatusReg(); + bool RegPointerProtect = m_RegWorkingSet.GetX86Protected(GetIndexFromX86Reg(RegPointer)); + if (!RegPointerProtect) + { + m_RegWorkingSet.SetX86Protected(GetIndexFromX86Reg(RegPointer), true); + } asmjit::x86::Gp TempReg = m_RegWorkingSet.Map_TempReg(asmjit::x86::eax, -1, false, false); if (RegPointer == TempReg) { @@ -8434,11 +8439,6 @@ void CX86RecompilerOps::CompileCheckFPUResult64(asmjit::x86::Gp RegPointer) m_Assembler.mov(RegPointerValue, RegPointer); RegPointer = RegPointerValue; } - bool RegPointerProtect = m_RegWorkingSet.GetX86Protected(GetIndexFromX86Reg(RegPointer)); - if (!RegPointerProtect) - { - m_RegWorkingSet.SetX86Protected(GetIndexFromX86Reg(RegPointer), true); - } asmjit::x86::Gp TempReg2 = m_RegWorkingSet.Map_TempReg(x86Reg_Unknown, -1, false, false); m_Assembler.fnstsw(asmjit::x86::ax);