From fe35d950f385cb09db78c2a84ba91fe81ed0e881 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 3 Apr 2023 09:08:43 +0930 Subject: [PATCH] x64: Change MemoryStackPos to be a pointer --- Project64.sln | 1 + .../Project64-core/N64System/Recompiler/Recompiler.cpp | 10 +++------- .../Project64-core/N64System/Recompiler/Recompiler.h | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Project64.sln b/Project64.sln index d8e7bd133..4a207ae69 100644 --- a/Project64.sln +++ b/Project64.sln @@ -61,6 +61,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JoinSettings", "Source\Join EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64", "Source\Project64\Project64.vcxproj", "{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}" ProjectSection(ProjectDependencies) = postProject + {B685BB34-D700-4FCC-8503-9B6AA1A0C95D} = {B685BB34-D700-4FCC-8503-9B6AA1A0C95D} {D3F979CE-8FA7-48C9-A2B3-A33594B48536} = {D3F979CE-8FA7-48C9-A2B3-A33594B48536} EndProjectSection EndProject diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp index 60d96f24f..8266be9e6 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.cpp +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.cpp @@ -526,9 +526,6 @@ void CRecompiler::ResetLog() void CRecompiler::ResetMemoryStackPos() { -#if defined(__aarch64__) || defined(__amd64__) || defined(_M_X64) - g_Notify->BreakPoint(__FILE__, __LINE__); -#else if (m_Registers.m_GPR[29].UW[0] == 0) { m_MemoryStack = 0; @@ -540,15 +537,15 @@ void CRecompiler::ResetMemoryStackPos() { if (pAddr < m_MMU.RdramSize()) { - m_MemoryStack = (uint32_t)(m_MMU.Rdram() + pAddr); + m_MemoryStack = m_MMU.Rdram() + pAddr; } else if (pAddr > 0x04000000 && pAddr < 0x04001000) { - m_MemoryStack = (uint32_t)(m_MMU.Dmem() + pAddr - 0x04000000); + m_MemoryStack = m_MMU.Dmem() + (pAddr - 0x04000000); } else if (pAddr > 0x04001000 && pAddr < 0x04002000) { - m_MemoryStack = (uint32_t)(m_MMU.Imem() + pAddr - 0x04001000); + m_MemoryStack = m_MMU.Imem() + (pAddr - 0x04001000); } else { @@ -560,7 +557,6 @@ void CRecompiler::ResetMemoryStackPos() WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]); g_Notify->BreakPoint(__FILE__, __LINE__); } -#endif } void CRecompiler::DumpFunctionTimes() diff --git a/Source/Project64-core/N64System/Recompiler/Recompiler.h b/Source/Project64-core/N64System/Recompiler/Recompiler.h index e24804df2..83482c84f 100644 --- a/Source/Project64-core/N64System/Recompiler/Recompiler.h +++ b/Source/Project64-core/N64System/Recompiler/Recompiler.h @@ -50,7 +50,7 @@ public: void ResetFunctionTimes(); void DumpFunctionTimes(); - uint32_t & MemoryStackPos() + uint8_t *& MemoryStackPos() { return m_MemoryStack; } @@ -84,7 +84,7 @@ private: CMipsMemoryVM & m_MMU; CRegisters & m_Registers; bool & m_EndEmulation; - uint32_t m_MemoryStack; + uint8_t * m_MemoryStack; FUNCTION_PROFILE m_BlockProfile; uint32_t & PROGRAM_COUNTER; CLog * m_LogFile;