From 1810bfda5c732081bc7166d66b2fefaab4cb6acf Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 21 Dec 2023 10:38:49 +1030 Subject: [PATCH] Core: Handle unaligned CX86RecompilerOps::CompileLoadMemoryValue for 64bit ops --- .../N64System/Recompiler/x86/x86RecompilerOps.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp index a439786fe..7ae4b4b93 100644 --- a/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/x86/x86RecompilerOps.cpp @@ -9942,6 +9942,14 @@ void CX86RecompilerOps::CompileLoadMemoryValue(asmjit::x86::Gp & AddressReg, asm CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_AddressErrorExceptionRead32, false, &CX86Ops::JneLabel); m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); } + else if (ValueSize == 64) + { + m_Assembler.MoveX86regToVariable(&m_TempValue32, "TempValue32", AddressReg); + m_Assembler.test(AddressReg, 7); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_System->CountPerOp()); + CompileExit(m_CompilePC, m_CompilePC, m_RegWorkingSet, ExitReason_AddressErrorExceptionRead32, false, &CX86Ops::JneLabel); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_System->CountPerOp()); + } m_Assembler.mov(TempReg, AddressReg); m_Assembler.shr(TempReg, 12);