x64: Change MemoryStackPos to be a pointer

This commit is contained in:
zilmar 2023-04-03 09:08:43 +09:30
parent 422a42cae3
commit fe35d950f3
3 changed files with 6 additions and 9 deletions

View File

@ -61,6 +61,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JoinSettings", "Source\Join
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64", "Source\Project64\Project64.vcxproj", "{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project64", "Source\Project64\Project64.vcxproj", "{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{B685BB34-D700-4FCC-8503-9B6AA1A0C95D} = {B685BB34-D700-4FCC-8503-9B6AA1A0C95D}
{D3F979CE-8FA7-48C9-A2B3-A33594B48536} = {D3F979CE-8FA7-48C9-A2B3-A33594B48536} {D3F979CE-8FA7-48C9-A2B3-A33594B48536} = {D3F979CE-8FA7-48C9-A2B3-A33594B48536}
EndProjectSection EndProjectSection
EndProject EndProject

View File

@ -526,9 +526,6 @@ void CRecompiler::ResetLog()
void CRecompiler::ResetMemoryStackPos() 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) if (m_Registers.m_GPR[29].UW[0] == 0)
{ {
m_MemoryStack = 0; m_MemoryStack = 0;
@ -540,15 +537,15 @@ void CRecompiler::ResetMemoryStackPos()
{ {
if (pAddr < m_MMU.RdramSize()) 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) 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) else if (pAddr > 0x04001000 && pAddr < 0x04002000)
{ {
m_MemoryStack = (uint32_t)(m_MMU.Imem() + pAddr - 0x04001000); m_MemoryStack = m_MMU.Imem() + (pAddr - 0x04001000);
} }
else else
{ {
@ -560,7 +557,6 @@ void CRecompiler::ResetMemoryStackPos()
WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]); WriteTrace(TraceRecompiler, TraceError, "Failed to translate SP address (%s)", m_Registers.m_GPR[29].UW[0]);
g_Notify->BreakPoint(__FILE__, __LINE__); g_Notify->BreakPoint(__FILE__, __LINE__);
} }
#endif
} }
void CRecompiler::DumpFunctionTimes() void CRecompiler::DumpFunctionTimes()

View File

@ -50,7 +50,7 @@ public:
void ResetFunctionTimes(); void ResetFunctionTimes();
void DumpFunctionTimes(); void DumpFunctionTimes();
uint32_t & MemoryStackPos() uint8_t *& MemoryStackPos()
{ {
return m_MemoryStack; return m_MemoryStack;
} }
@ -84,7 +84,7 @@ private:
CMipsMemoryVM & m_MMU; CMipsMemoryVM & m_MMU;
CRegisters & m_Registers; CRegisters & m_Registers;
bool & m_EndEmulation; bool & m_EndEmulation;
uint32_t m_MemoryStack; uint8_t * m_MemoryStack;
FUNCTION_PROFILE m_BlockProfile; FUNCTION_PROFILE m_BlockProfile;
uint32_t & PROGRAM_COUNTER; uint32_t & PROGRAM_COUNTER;
CLog * m_LogFile; CLog * m_LogFile;