From 45fb2ad9654e533df17cedb7de397a6435cda776 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 21 Mar 2024 17:44:53 +1030 Subject: [PATCH] Core: In X86RecompilerOps::CompileCheckFPUResult64 make sure RegPointer is protected --- .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index 49e9678dc..c64878512 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -9153,6 +9153,12 @@ 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); m_Assembler.and_(asmjit::x86::ax, 0x3D); @@ -9207,6 +9213,11 @@ void CX86RecompilerOps::CompileCheckFPUResult64(asmjit::x86::Gp RegPointer) CompileExit(m_CompilePC + 4, m_CompilePC + 4, ExitRegSet, ExitReason_Normal, false, &CX86Ops::JmpLabel); m_Assembler.bind(ValueSame); m_Assembler.bind(DoNoModify); + + if (!RegPointerProtect) + { + m_RegWorkingSet.SetX86Protected(GetIndexFromX86Reg(RegPointer), false); + } } void CX86RecompilerOps::CompileCop1Test()