From ab03916a709f2ee14705c0366775372f30e4629d Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 7 Sep 2023 11:13:54 +0930 Subject: [PATCH] Core: let the stack pointer equal end of rdram --- Source/Project64-core/N64System/N64System.cpp | 4 ++-- Source/Project64-core/N64System/Recompiler/Recompiler.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Project64-core/N64System/N64System.cpp b/Source/Project64-core/N64System/N64System.cpp index a38219f2e..aa3deafa4 100644 --- a/Source/Project64-core/N64System/N64System.cpp +++ b/Source/Project64-core/N64System/N64System.cpp @@ -1484,7 +1484,7 @@ void CN64System::SyncCPU(CN64System * const SecondCPU) { uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF); uint8_t * TargetStackPos = nullptr; - if (StackPointer < m_MMU_VM.RdramSize()) + if (StackPointer <= m_MMU_VM.RdramSize()) { TargetStackPos = m_MMU_VM.Rdram() + StackPointer; } @@ -1669,7 +1669,7 @@ void CN64System::DumpSyncErrors(CN64System * SecondCPU) { uint32_t StackPointer = (m_Reg.m_GPR[29].W[0] & 0x1FFFFFFF); uint8_t * TargetStackPos = nullptr; - if (StackPointer < m_MMU_VM.RdramSize()) + if (StackPointer <= m_MMU_VM.RdramSize()) { TargetStackPos = m_MMU_VM.Rdram() + StackPointer; } diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp index dd398a2c5..6e6983d2c 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp @@ -535,7 +535,7 @@ void CRecompiler::ResetMemoryStackPos() uint32_t pAddr = 0; if (m_MMU.VAddrToPAddr(m_Registers.m_GPR[29].UW[0], pAddr)) { - if (pAddr < m_MMU.RdramSize()) + if (pAddr <= m_MMU.RdramSize()) { m_MemoryStack = m_MMU.Rdram() + pAddr; }