[Project64] Get Memory Virtual Mem.cpp cleanup and use standard types

This commit is contained in:
zilmar 2015-11-09 05:04:32 +11:00
parent 08cc72f6ed
commit f6160e3d68
17 changed files with 5349 additions and 5356 deletions

View File

@ -204,7 +204,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 ) if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
{ {
uint32_t PAddr; uint32_t PAddr;
if (!g_TransVaddr->TranslateVaddr(VAddr,(DWORD &)PAddr)) if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
{ {
if (g_LogOptions.LogUnknown) if (g_LogOptions.LogUnknown)
{ {
@ -226,7 +226,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -253,7 +253,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -274,7 +274,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SP_PC (%08X)",PC, Value); LogMessage("%08X: read from SP_PC (%08X)",PC, Value);
return; return;
} }
@ -284,7 +284,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -304,7 +304,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -320,7 +320,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -346,7 +346,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -364,7 +364,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -389,7 +389,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
@ -409,7 +409,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SI_DRAM_ADDR_REG (%08X)",PC, Value); LogMessage("%08X: read from SI_DRAM_ADDR_REG (%08X)",PC, Value);
return; return;
} }
@ -419,7 +419,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SI_PIF_ADDR_RD64B_REG (%08X)",PC, Value); LogMessage("%08X: read from SI_PIF_ADDR_RD64B_REG (%08X)",PC, Value);
return; return;
} }
@ -429,7 +429,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SI_PIF_ADDR_WR64B_REG (%08X)",PC, Value); LogMessage("%08X: read from SI_PIF_ADDR_WR64B_REG (%08X)",PC, Value);
return; return;
} }
@ -439,7 +439,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value); LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value);
return; return;
} }
@ -453,7 +453,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{ {
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value); LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value);
return; return;
} }
@ -468,7 +468,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
return; return;
} }
g_MMU->LW_VAddr(VAddr,(DWORD &)Value); g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr) switch (VAddr)
{ {
case 0xB0000004: LogMessage("%08X: read from Rom Clock Rate (%08X)",PC, Value); break; case 0xB0000004: LogMessage("%08X: read from Rom Clock Rate (%08X)",PC, Value); break;
@ -497,7 +497,7 @@ void Log_SW (uint32_t PC, uint32_t VAddr, uint32_t Value)
if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 ) if ( VAddr < 0xA0000000 || VAddr >= 0xC0000000 )
{ {
uint32_t PAddr; uint32_t PAddr;
if (!g_TransVaddr->TranslateVaddr(VAddr,(DWORD &)PAddr)) if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
{ {
if (g_LogOptions.LogUnknown) if (g_LogOptions.LogUnknown)
{ {

View File

@ -326,7 +326,7 @@ void CDebugMemorySearch::SearchForValue(void)
} }
break; break;
case _32Bit: case _32Bit:
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue); valid = g_MMU->LW_PAddr(Result.PAddr, (uint32_t &)NewValue);
break; break;
default: default:
g_Notify->BreakPoint(__FILEW__, __LINE__); g_Notify->BreakPoint(__FILEW__, __LINE__);
@ -461,7 +461,7 @@ void CDebugMemorySearch::SearchForUnknown()
} }
break; break;
case _32Bit: case _32Bit:
valid = g_MMU->LW_PAddr(Result.PAddr, NewValue); valid = g_MMU->LW_PAddr(Result.PAddr, (uint32_t &)NewValue);
break; break;
default: default:
g_Notify->BreakPoint(__FILEW__, __LINE__); g_Notify->BreakPoint(__FILEW__, __LINE__);

View File

@ -402,14 +402,14 @@ void CDebugMemoryView::RefreshMemory(bool ResetCompare)
if (m_DataVAddrr) if (m_DataVAddrr)
{ {
if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW)) if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, (uint32_t &)word.UW))
{ {
ValidData = false; ValidData = false;
} }
} }
else else
{ {
if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, word.UW)) if (!g_MMU->LW_PAddr(m_DataStartLoc & ~3, (uint32_t &)word.UW))
{ {
ValidData = false; ValidData = false;
} }
@ -438,14 +438,14 @@ void CDebugMemoryView::RefreshMemory(bool ResetCompare)
if (m_DataVAddrr) if (m_DataVAddrr)
{ {
if (!g_MMU->LW_VAddr(Pos, word.UW)) if (!g_MMU->LW_VAddr(Pos, (uint32_t &)word.UW))
{ {
ValidData = false; ValidData = false;
} }
} }
else else
{ {
if (!g_MMU->LW_PAddr(Pos, word.UW)) if (!g_MMU->LW_PAddr(Pos, (uint32_t &)word.UW))
{ {
ValidData = false; ValidData = false;
} }

View File

@ -21,7 +21,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
{ {
OPCODE Command; OPCODE Command;
if (!g_MMU->LW_VAddr(PC + 4, (DWORD &)Command.Hex)) if (!g_MMU->LW_VAddr(PC + 4, Command.Hex))
{ {
//g_Notify->DisplayError(L"Failed to load word 2"); //g_Notify->DisplayError(L"Failed to load word 2");
//ExitThread(0); //ExitThread(0);
@ -276,7 +276,7 @@ void CInterpreterCPU::ExecuteCPU()
{ {
while (!Done) while (!Done)
{ {
if (g_MMU->LW_VAddr(PROGRAM_COUNTER, (DWORD &)Opcode.Hex)) if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex))
{ {
/*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000)
{ {
@ -367,7 +367,7 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
return; return;
} }
if (g_MMU->LW_VAddr(PROGRAM_COUNTER, (DWORD &)Opcode.Hex)) if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex))
{ {
/*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000)
{ {

View File

@ -929,7 +929,7 @@ void R4300iOp32::LWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -956,7 +956,7 @@ void R4300iOp32::LW()
Log_LW((*_PROGRAM_COUNTER),Address); Log_LW((*_PROGRAM_COUNTER),Address);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -1015,7 +1015,7 @@ void R4300iOp32::LWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
g_Notify->BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
if (bShowTLBMisses()) if (bShowTLBMisses())
@ -1037,7 +1037,7 @@ void R4300iOp32::LWU()
ADDRESS_ERROR_EXCEPTION(Address, true); ADDRESS_ERROR_EXCEPTION(Address, true);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -1060,7 +1060,7 @@ void R4300iOp32::LL()
ADDRESS_ERROR_EXCEPTION(Address, true); ADDRESS_ERROR_EXCEPTION(Address, true);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {

View File

@ -1093,7 +1093,7 @@ void R4300iOp::LWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
g_Notify->BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
if (bShowTLBMisses()) if (bShowTLBMisses())
@ -1120,7 +1120,7 @@ void R4300iOp::LW()
Log_LW((*_PROGRAM_COUNTER),Address); Log_LW((*_PROGRAM_COUNTER),Address);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -1179,7 +1179,7 @@ void R4300iOp::LWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
g_Notify->BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
if (bShowTLBMisses()) if (bShowTLBMisses())
@ -1201,7 +1201,7 @@ void R4300iOp::LWU()
ADDRESS_ERROR_EXCEPTION(Address, true); ADDRESS_ERROR_EXCEPTION(Address, true);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -1258,7 +1258,7 @@ void R4300iOp::SWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
if (bHaveDebugger()) if (bHaveDebugger())
{ {
@ -1414,7 +1414,7 @@ void R4300iOp::SWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3; Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value)) if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{ {
if (bHaveDebugger()) if (bHaveDebugger())
{ {
@ -1461,7 +1461,7 @@ void R4300iOp::LL()
ADDRESS_ERROR_EXCEPTION(Address, true); ADDRESS_ERROR_EXCEPTION(Address, true);
} }
if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) if (!g_MMU->LW_VAddr(Address,(uint32_t &)_GPR[m_Opcode.rt].UW[0]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {
@ -1484,7 +1484,7 @@ void R4300iOp::LWC1()
{ {
ADDRESS_ERROR_EXCEPTION(Address, true); ADDRESS_ERROR_EXCEPTION(Address, true);
} }
if (!g_MMU->LW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) if (!g_MMU->LW_VAddr(Address,*(uint32_t *)_FPR_S[m_Opcode.ft]))
{ {
if (bShowTLBMisses()) if (bShowTLBMisses())
{ {

View File

@ -10,78 +10,75 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
#include <objbase.h> __interface CMipsMemory_CallBack
interface CMipsMemory_CallBack
{ {
//Protected memory has been written to, returns true if that memory has been unprotected //Protected memory has been written to, returns true if that memory has been unprotected
virtual bool WriteToProtectedMemory (DWORD Address, int length) = 0; virtual bool WriteToProtectedMemory (uint32_t Address, int32_t length) = 0;
}; };
class CMipsMemory __interface CMipsMemory
{ {
public: virtual uint8_t * Rdram () = 0;
virtual BYTE * Rdram () = 0; virtual uint32_t RdramSize() = 0;
virtual DWORD RdramSize() = 0; virtual uint8_t * Dmem () = 0;
virtual BYTE * Dmem () = 0; virtual uint8_t * Imem () = 0;
virtual BYTE * Imem () = 0; virtual uint8_t * PifRam () = 0;
virtual BYTE * PifRam () = 0;
virtual bool LB_VAddr ( DWORD VAddr, BYTE & Value ) = 0;
virtual bool LH_VAddr ( DWORD VAddr, WORD & Value ) = 0;
virtual bool LW_VAddr ( DWORD VAddr, DWORD & Value ) = 0;
virtual bool LD_VAddr ( DWORD VAddr, QWORD & Value ) = 0;
virtual bool LB_PAddr ( DWORD PAddr, BYTE & Value ) = 0; virtual bool LB_VAddr ( uint32_t VAddr, uint8_t & Value ) = 0;
virtual bool LH_PAddr ( DWORD PAddr, WORD & Value ) = 0; virtual bool LH_VAddr ( uint32_t VAddr, uint16_t & Value ) = 0;
virtual bool LW_PAddr ( DWORD PAddr, DWORD & Value ) = 0; virtual bool LW_VAddr ( uint32_t VAddr, uint32_t & Value ) = 0;
virtual bool LD_PAddr ( DWORD PAddr, QWORD & Value ) = 0; virtual bool LD_VAddr ( uint32_t VAddr, uint64_t & Value ) = 0;
virtual bool SB_VAddr ( DWORD VAddr, BYTE Value ) = 0; virtual bool LB_PAddr ( uint32_t PAddr, uint8_t & Value ) = 0;
virtual bool SH_VAddr ( DWORD VAddr, WORD Value ) = 0; virtual bool LH_PAddr ( uint32_t PAddr, uint16_t & Value ) = 0;
virtual bool SW_VAddr ( DWORD VAddr, DWORD Value ) = 0; virtual bool LW_PAddr ( uint32_t PAddr, uint32_t & Value ) = 0;
virtual bool SD_VAddr ( DWORD VAddr, QWORD Value ) = 0; virtual bool LD_PAddr ( uint32_t PAddr, uint64_t & Value ) = 0;
virtual bool SB_PAddr ( DWORD PAddr, BYTE Value ) = 0; virtual bool SB_VAddr ( uint32_t VAddr, uint8_t Value ) = 0;
virtual bool SH_PAddr ( DWORD PAddr, WORD Value ) = 0; virtual bool SH_VAddr ( uint32_t VAddr, uint16_t Value ) = 0;
virtual bool SW_PAddr ( DWORD PAddr, DWORD Value ) = 0; virtual bool SW_VAddr ( uint32_t VAddr, uint32_t Value ) = 0;
virtual bool SD_PAddr ( DWORD PAddr, QWORD Value ) = 0; virtual bool SD_VAddr ( uint32_t VAddr, uint64_t Value ) = 0;
virtual bool ValidVaddr ( DWORD VAddr ) const = 0; virtual bool SB_PAddr ( uint32_t PAddr, uint8_t Value ) = 0;
virtual bool SH_PAddr ( uint32_t PAddr, uint16_t Value ) = 0;
virtual bool SW_PAddr ( uint32_t PAddr, uint32_t Value ) = 0;
virtual bool SD_PAddr ( uint32_t PAddr, uint64_t Value ) = 0;
virtual int MemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer ) = 0; virtual bool ValidVaddr ( uint32_t VAddr ) const = 0;
virtual void UpdateFieldSerration ( unsigned int interlaced ) = 0;
//Protect the Memory from being written to virtual int32_t MemoryFilter ( uint32_t dwExptCode, void * lpExceptionPointer ) = 0;
virtual void ProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0; virtual void UpdateFieldSerration ( uint32_t interlaced ) = 0;
virtual void UnProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0;
//Compilation Functions //Protect the Memory from being written to
virtual void ResetMemoryStack () = 0; virtual void ProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
virtual void UnProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
virtual void Compile_LB () = 0;
virtual void Compile_LBU () = 0; //Compilation Functions
virtual void Compile_LH () = 0; virtual void ResetMemoryStack () = 0;
virtual void Compile_LHU () = 0;
virtual void Compile_LW () = 0; virtual void Compile_LB () = 0;
virtual void Compile_LL () = 0; virtual void Compile_LBU () = 0;
virtual void Compile_LWC1 () = 0; virtual void Compile_LH () = 0;
virtual void Compile_LWU () = 0; virtual void Compile_LHU () = 0;
virtual void Compile_LWL () = 0; virtual void Compile_LW () = 0;
virtual void Compile_LWR () = 0; virtual void Compile_LL () = 0;
virtual void Compile_LD () = 0; virtual void Compile_LWC1 () = 0;
virtual void Compile_LDC1 () = 0; virtual void Compile_LWU () = 0;
virtual void Compile_LDL () = 0; virtual void Compile_LWL () = 0;
virtual void Compile_LDR () = 0; virtual void Compile_LWR () = 0;
virtual void Compile_SB () = 0; virtual void Compile_LD () = 0;
virtual void Compile_SH () = 0; virtual void Compile_LDC1 () = 0;
virtual void Compile_SW () = 0; virtual void Compile_LDL () = 0;
virtual void Compile_SWL () = 0; virtual void Compile_LDR () = 0;
virtual void Compile_SWR () = 0; virtual void Compile_SB () = 0;
virtual void Compile_SD () = 0; virtual void Compile_SH () = 0;
virtual void Compile_SDL () = 0; virtual void Compile_SW () = 0;
virtual void Compile_SDR () = 0; virtual void Compile_SWL () = 0;
virtual void Compile_SC () = 0; virtual void Compile_SWR () = 0;
virtual void Compile_SWC1 () = 0; virtual void Compile_SD () = 0;
virtual void Compile_SDC1 () = 0; virtual void Compile_SDL () = 0;
virtual void Compile_SDR () = 0;
virtual void Compile_SC () = 0;
virtual void Compile_SWC1 () = 0;
virtual void Compile_SDC1 () = 0;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -11,12 +11,12 @@
#pragma once #pragma once
/* /*
* 64-bit Windows exception recovery facilities will expect to interact with * 64-bit Windows exception recovery facilities will expect to interact with
* the 64-bit registers of the Intel architecture (e.g., rax instead of eax). * the 64-bit registers of the Intel architecture (e.g., rax instead of eax).
* *
* Attempting to read the 32-bit subsets seems to be erroneous and forbidden. * Attempting to read the 32-bit subsets seems to be erroneous and forbidden.
* Refer to "MemoryFilter" in `Memory Virtual Mem.cpp`. * Refer to "MemoryFilter" in `Memory Virtual Mem.cpp`.
*/ */
#ifdef _WIN64 #ifdef _WIN64
#define Eax Rax #define Eax Rax
#define Ebx Rbx #define Ebx Rbx
@ -42,160 +42,160 @@
*/ */
class CMipsMemoryVM : class CMipsMemoryVM :
public CMipsMemory, public CMipsMemory,
public CTransVaddr, public CTransVaddr,
private CRecompilerOps, private CRecompilerOps,
private R4300iOp, private R4300iOp,
private CPifRam, private CPifRam,
private CFlashram, private CFlashram,
private CSram, private CSram,
private CDMA private CDMA
{ {
public: public:
CMipsMemoryVM(CMipsMemory_CallBack * CallBack, bool SavesReadOnly); CMipsMemoryVM(CMipsMemory_CallBack * CallBack, bool SavesReadOnly);
~CMipsMemoryVM(); ~CMipsMemoryVM();
static void ReserveMemory();
static void FreeReservedMemory();
bool Initialize (); static void ReserveMemory();
void Reset ( bool EraseMemory ); static void FreeReservedMemory();
BYTE * Rdram ();
DWORD RdramSize ();
BYTE * Dmem ();
BYTE * Imem ();
BYTE * PifRam ();
bool LB_VAddr ( DWORD VAddr, BYTE & Value ); bool Initialize ();
bool LH_VAddr ( DWORD VAddr, WORD & Value ); void Reset ( bool EraseMemory );
bool LW_VAddr ( DWORD VAddr, DWORD & Value );
bool LD_VAddr ( DWORD VAddr, QWORD & Value );
bool LB_PAddr ( DWORD PAddr, BYTE & Value ); uint8_t * Rdram ();
bool LH_PAddr ( DWORD PAddr, WORD & Value ); uint32_t RdramSize ();
bool LW_PAddr ( DWORD PAddr, DWORD & Value ); uint8_t * Dmem ();
bool LD_PAddr ( DWORD PAddr, QWORD & Value ); uint8_t * Imem ();
uint8_t * PifRam ();
bool SB_VAddr ( DWORD VAddr, BYTE Value ); bool LB_VAddr ( uint32_t VAddr, uint8_t & Value );
bool SH_VAddr ( DWORD VAddr, WORD Value ); bool LH_VAddr ( uint32_t VAddr, uint16_t & Value );
bool SW_VAddr ( DWORD VAddr, DWORD Value ); bool LW_VAddr ( uint32_t VAddr, uint32_t & Value );
bool SD_VAddr ( DWORD VAddr, QWORD Value ); bool LD_VAddr ( uint32_t VAddr, uint64_t & Value );
bool SB_PAddr ( DWORD PAddr, BYTE Value ); bool LB_PAddr ( uint32_t PAddr, uint8_t & Value );
bool SH_PAddr ( DWORD PAddr, WORD Value ); bool LH_PAddr ( uint32_t PAddr, uint16_t & Value );
bool SW_PAddr ( DWORD PAddr, DWORD Value ); bool LW_PAddr ( uint32_t PAddr, uint32_t & Value );
bool SD_PAddr ( DWORD PAddr, QWORD Value ); bool LD_PAddr ( uint32_t PAddr, uint64_t & Value );
int MemoryFilter(DWORD dwExptCode, void * lpExceptionPointer); bool SB_VAddr ( uint32_t VAddr, uint8_t Value );
void UpdateFieldSerration(unsigned int interlaced); bool SH_VAddr ( uint32_t VAddr, uint16_t Value );
bool SW_VAddr ( uint32_t VAddr, uint32_t Value );
//Protect the Memory from being written to bool SD_VAddr ( uint32_t VAddr, uint64_t Value );
void ProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
void UnProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
//Compilation Functions bool SB_PAddr ( uint32_t PAddr, uint8_t Value );
void ResetMemoryStack(); bool SH_PAddr ( uint32_t PAddr, uint16_t Value );
bool SW_PAddr ( uint32_t PAddr, uint32_t Value );
bool SD_PAddr ( uint32_t PAddr, uint64_t Value );
void Compile_LB(); int32_t MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer);
void Compile_LBU(); void UpdateFieldSerration(uint32_t interlaced);
void Compile_LH();
void Compile_LHU();
void Compile_LW();
void Compile_LL();
void Compile_LWC1();
void Compile_LWU();
void Compile_LWL();
void Compile_LWR();
void Compile_LD();
void Compile_LDC1();
void Compile_LDL();
void Compile_LDR();
void Compile_SB();
void Compile_SH();
void Compile_SW();
void Compile_SWL();
void Compile_SWR();
void Compile_SD();
void Compile_SDL();
void Compile_SDR();
void Compile_SC();
void Compile_SWC1();
void Compile_SDC1();
void ResetMemoryStack ( CRegInfo& RegInfo ); //Protect the Memory from being written to
void Compile_LB ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend ); void ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
void Compile_LH ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend ); void UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
void Compile_LW ( CX86Ops::x86Reg Reg, DWORD Addr );
void Compile_SB_Const ( BYTE Value, DWORD Addr );
void Compile_SB_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
void Compile_SH_Const ( WORD Value, DWORD Addr );
void Compile_SH_Register ( CX86Ops::x86Reg Reg, DWORD Addr );
void Compile_SW_Const ( DWORD Value, DWORD Addr );
void Compile_SW_Register ( CX86Ops::x86Reg Reg, DWORD Addr ); //Compilation Functions
void ResetMemoryStack();
//Functions for TLB notification
void TLB_Mapped(DWORD VAddr, DWORD Len, DWORD PAddr, bool bReadOnly); void Compile_LB();
void TLB_Unmaped(DWORD Vaddr, DWORD Len); void Compile_LBU();
void Compile_LH();
// CTransVaddr interface void Compile_LHU();
bool TranslateVaddr(DWORD VAddr, DWORD &PAddr) const; void Compile_LW();
bool ValidVaddr(DWORD VAddr) const; void Compile_LL();
bool VAddrToRealAddr(DWORD VAddr, void * &RealAddress) const; void Compile_LWC1();
void Compile_LWU();
// Labels void Compile_LWL();
LPCTSTR LabelName(DWORD Address) const; void Compile_LWR();
void Compile_LD();
void Compile_LDC1();
void Compile_LDL();
void Compile_LDR();
void Compile_SB();
void Compile_SH();
void Compile_SW();
void Compile_SWL();
void Compile_SWR();
void Compile_SD();
void Compile_SDL();
void Compile_SDR();
void Compile_SC();
void Compile_SWC1();
void Compile_SDC1();
void ResetMemoryStack ( CRegInfo& RegInfo );
void Compile_LB ( CX86Ops::x86Reg Reg, uint32_t Addr, bool SignExtend );
void Compile_LH ( CX86Ops::x86Reg Reg, uint32_t Addr, bool SignExtend );
void Compile_LW ( CX86Ops::x86Reg Reg, uint32_t Addr );
void Compile_SB_Const ( uint8_t Value, uint32_t Addr );
void Compile_SB_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
void Compile_SH_Const ( uint16_t Value, uint32_t Addr );
void Compile_SH_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
void Compile_SW_Const ( uint32_t Value, uint32_t Addr );
void Compile_SW_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
//Functions for TLB notification
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
void TLB_Unmaped(uint32_t Vaddr, uint32_t Len);
// CTransVaddr interface
bool TranslateVaddr(uint32_t VAddr, uint32_t &PAddr) const;
bool ValidVaddr(uint32_t VAddr) const;
bool VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const;
// Labels
const char * LabelName(uint32_t Address) const;
private: private:
CMipsMemoryVM(); // Disable default constructor CMipsMemoryVM(); // Disable default constructor
CMipsMemoryVM(const CMipsMemoryVM&); // Disable copy constructor CMipsMemoryVM(const CMipsMemoryVM&); // Disable copy constructor
CMipsMemoryVM& operator=(const CMipsMemoryVM&); // Disable assignment CMipsMemoryVM& operator=(const CMipsMemoryVM&); // Disable assignment
void Compile_LW ( bool ResultSigned, bool bRecordLLbit ); void Compile_LW ( bool ResultSigned, bool bRecordLLbit );
void Compile_SW ( bool bCheckLLbit ); void Compile_SW ( bool bCheckLLbit );
static void RdramChanged ( CMipsMemoryVM * _this ); static void RdramChanged ( CMipsMemoryVM * _this );
static void ChangeSpStatus (); static void ChangeSpStatus ();
static void ChangeMiIntrMask(); static void ChangeMiIntrMask();
bool LB_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend ); bool LB_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
bool LH_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend ); bool LH_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
bool LW_NonMemory ( DWORD PAddr, DWORD * Value ); bool LW_NonMemory ( uint32_t PAddr, uint32_t * Value );
bool SB_NonMemory ( DWORD PAddr, BYTE Value ); bool SB_NonMemory ( uint32_t PAddr, uint8_t Value );
bool SH_NonMemory ( DWORD PAddr, WORD Value ); bool SH_NonMemory ( uint32_t PAddr, uint16_t Value );
bool SW_NonMemory ( DWORD PAddr, DWORD Value ); bool SW_NonMemory ( uint32_t PAddr, uint32_t Value );
void Compile_StoreInstructClean (x86Reg AddressReg, int Length ); void Compile_StoreInstructClean (x86Reg AddressReg, int32_t Length );
CMipsMemory_CallBack * const m_CBClass; CMipsMemory_CallBack * const m_CBClass;
//Memory Locations //Memory Locations
static BYTE * m_Reserve1, * m_Reserve2; static uint8_t * m_Reserve1, * m_Reserve2;
BYTE * m_RDRAM, * m_DMEM, * m_IMEM; uint8_t * m_RDRAM, * m_DMEM, * m_IMEM;
DWORD m_AllocatedRdramSize; uint32_t m_AllocatedRdramSize;
//Rom Information //Rom Information
bool m_RomMapped; bool m_RomMapped;
BYTE * m_Rom; uint8_t * m_Rom;
DWORD m_RomSize; uint32_t m_RomSize;
bool m_RomWrittenTo; bool m_RomWrittenTo;
DWORD m_RomWroteValue; uint32_t m_RomWroteValue;
//Current Half line //Current Half line
void UpdateHalfLine(); void UpdateHalfLine();
DWORD m_HalfLine; uint32_t m_HalfLine;
DWORD m_HalfLineCheck; uint32_t m_HalfLineCheck;
DWORD m_FieldSerration; uint32_t m_FieldSerration;
DWORD m_TempValue; uint32_t m_TempValue;
//Initializing and resetting information about the memory system //Initializing and resetting information about the memory system
void FreeMemory(); void FreeMemory();
mutable char m_strLabelName[100]; mutable char m_strLabelName[100];
//BIG look up table to quickly translate the tlb to real mem address //BIG look up table to quickly translate the tlb to real mem address
size_t * m_TLB_ReadMap; size_t * m_TLB_ReadMap;
size_t * m_TLB_WriteMap; size_t * m_TLB_WriteMap;
}; };

View File

@ -10,10 +10,9 @@
****************************************************************************/ ****************************************************************************/
#pragma once #pragma once
class CTransVaddr __interface CTransVaddr
{ {
public: virtual bool TranslateVaddr ( uint32_t VAddr, uint32_t &PAddr) const = 0;
virtual bool TranslateVaddr ( DWORD VAddr, DWORD &PAddr) const = 0; virtual bool ValidVaddr ( uint32_t VAddr ) const = 0;
virtual bool ValidVaddr ( DWORD VAddr ) const = 0; virtual bool VAddrToRealAddr ( uint32_t VAddr, void * &RealAddress ) const = 0;
virtual bool VAddrToRealAddr ( DWORD VAddr, void * &RealAddress ) const = 0;
}; };

View File

@ -1364,7 +1364,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU)
for (count = -10; count < 10; count++) for (count = -10; count < 10; count++)
{ {
DWORD OpcodeValue, Addr = m_Reg.m_PROGRAM_COUNTER + (count << 2); DWORD OpcodeValue, Addr = m_Reg.m_PROGRAM_COUNTER + (count << 2);
if (g_MMU->LW_VAddr(Addr,OpcodeValue)) if (g_MMU->LW_VAddr(Addr,(uint32_t &)OpcodeValue))
{ {
Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr)); Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr));
} }
@ -1375,7 +1375,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU)
for (count = 0; count < 50; count++) for (count = 0; count < 50; count++)
{ {
DWORD OpcodeValue, Addr = m_LastSuccessSyncPC[0] + (count << 2); DWORD OpcodeValue, Addr = m_LastSuccessSyncPC[0] + (count << 2);
if (g_MMU->LW_VAddr(Addr,OpcodeValue)) if (g_MMU->LW_VAddr(Addr,(uint32_t &)OpcodeValue))
{ {
Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr)); Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr));
} }
@ -1857,7 +1857,7 @@ void CN64System::RunRSP()
DWORD Task = 0; DWORD Task = 0;
if (m_RspBroke) if (m_RspBroke)
{ {
g_MMU->LW_VAddr(0xA4000FC0,Task); g_MMU->LW_VAddr(0xA4000FC0,(uint32_t &)Task);
if (Task == 1 && (m_Reg.DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0) if (Task == 1 && (m_Reg.DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0)
{ {
WriteTrace(TraceRSP, __FUNCTION__ ": Dlist that is frozen"); WriteTrace(TraceRSP, __FUNCTION__ ": Dlist that is frozen");
@ -2060,7 +2060,7 @@ void CN64System::RefreshScreen()
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); } // if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
} }
bool CN64System::WriteToProtectedMemory (DWORD Address, int length) bool CN64System::WriteToProtectedMemory (uint32_t Address, int length)
{ {
WriteTraceF(TraceDebug,__FUNCTION__ ": Address: %X Len: %d",Address,length); WriteTraceF(TraceDebug,__FUNCTION__ ": Address: %X Len: %d",Address,length);
if (m_Recomp) if (m_Recomp)

View File

@ -111,7 +111,7 @@ private:
void CpuStopped(); void CpuStopped();
//Function in CMipsMemory_CallBack //Function in CMipsMemory_CallBack
virtual bool WriteToProtectedMemory(DWORD Address, int length); virtual bool WriteToProtectedMemory(uint32_t Address, int length);
//Functions in CTLB_CB //Functions in CTLB_CB
void TLB_Mapped(DWORD VAddr, DWORD Len, DWORD PAddr, bool bReadOnly); void TLB_Mapped(DWORD VAddr, DWORD Len, DWORD PAddr, bool bReadOnly);

View File

@ -397,7 +397,7 @@ bool CCodeBlock::AnalyzeInstruction ( DWORD PC, DWORD & TargetPC, DWORD & Contin
PermLoop = false; PermLoop = false;
OPCODE Command; OPCODE Command;
if (!g_MMU->LW_VAddr(PC, (DWORD &)Command.Hex)) if (!g_MMU->LW_VAddr(PC, Command.Hex))
{ {
g_Notify->BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;
@ -730,7 +730,7 @@ bool CCodeBlock::Compile()
} }
CompileExitCode(); CompileExitCode();
DWORD PAddr; uint32_t PAddr;
g_TransVaddr->TranslateVaddr(VAddrFirst(),PAddr); g_TransVaddr->TranslateVaddr(VAddrFirst(),PAddr);
MD5(g_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash); MD5(g_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);

View File

@ -17,7 +17,7 @@ bool DelaySlotEffectsCompare(DWORD PC, DWORD Reg1, DWORD Reg2);
static bool DelaySlotEffectsJump(DWORD JumpPC) { static bool DelaySlotEffectsJump(DWORD JumpPC) {
OPCODE Command; OPCODE Command;
if (!g_MMU->LW_VAddr(JumpPC, (DWORD &)Command.Hex)) if (!g_MMU->LW_VAddr(JumpPC, Command.Hex))
return true; return true;
switch (Command.op) { switch (Command.op) {
@ -58,7 +58,7 @@ static bool DelaySlotEffectsJump(DWORD JumpPC) {
bool EffectDelaySlot = false; bool EffectDelaySlot = false;
OPCODE NewCommand; OPCODE NewCommand;
if (!g_MMU->LW_VAddr(JumpPC + 4, (DWORD &)NewCommand.Hex)) { if (!g_MMU->LW_VAddr(JumpPC + 4, NewCommand.Hex)) {
return true; return true;
} }
@ -932,7 +932,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
do { do {
__try { __try {
if (!g_MMU->LW_VAddr(m_CompilePC,(DWORD &)m_Opcode.Hex)) if (!g_MMU->LW_VAddr(m_CompilePC,m_Opcode.Hex))
{ {
g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD)); g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD));
ExitThread(0); ExitThread(0);

View File

@ -167,7 +167,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section)
CPU_Message("ContinueSectionPC = %08X",ContinueSectionPC); CPU_Message("ContinueSectionPC = %08X",ContinueSectionPC);
do { do {
if (!g_MMU->LW_VAddr(m_PC, (DWORD &)m_Command.Hex)) if (!g_MMU->LW_VAddr(m_PC, m_Command.Hex))
{ {
g_Notify->BreakPoint(__FILEW__,__LINE__); g_Notify->BreakPoint(__FILEW__,__LINE__);
return false; return false;

View File

@ -345,7 +345,7 @@ void CRecompiler::RecompilerMain_Lookup()
} else { } else {
DWORD opsExecuted = 0; DWORD opsExecuted = 0;
while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize()) while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
{ {
CInterpreterCPU::ExecuteOps(g_System->CountPerOp()); CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
opsExecuted += g_System->CountPerOp(); opsExecuted += g_System->CountPerOp();
@ -516,10 +516,10 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
while(!m_EndEmulation) while(!m_EndEmulation)
{ {
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr))
{ {
m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER); m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER);
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr))
{ {
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str()); g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str());
m_EndEmulation = true; m_EndEmulation = true;
@ -549,7 +549,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
{ {
DWORD opsExecuted = 0; DWORD opsExecuted = 0;
while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize()) while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
{ {
CInterpreterCPU::ExecuteOps(g_System->CountPerOp()); CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
opsExecuted += g_System->CountPerOp(); opsExecuted += g_System->CountPerOp();
@ -597,7 +597,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
} else { } else {
DWORD opsExecuted = 0; DWORD opsExecuted = 0;
while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize()) while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
{ {
CInterpreterCPU::ExecuteOps(g_System->CountPerOp()); CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
opsExecuted += g_System->CountPerOp(); opsExecuted += g_System->CountPerOp();
@ -618,10 +618,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
while(!m_EndEmulation) while(!m_EndEmulation)
{ {
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr))
{ {
m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER); m_Registers.DoTLBReadMiss(false,PROGRAM_COUNTER);
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr))
{ {
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str()); g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER).ToUTF16().c_str());
m_EndEmulation = true; m_EndEmulation = true;
@ -667,7 +667,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
} else { } else {
DWORD opsExecuted = 0; DWORD opsExecuted = 0;
while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize()) while (g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, (uint32_t &)PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
{ {
CInterpreterCPU::ExecuteOps(g_System->CountPerOp()); CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
opsExecuted += g_System->CountPerOp(); opsExecuted += g_System->CountPerOp();
@ -847,7 +847,7 @@ void CRecompiler::RecompilerMain_ChangeMemory()
CCompiledFunc * CRecompiler::CompilerCode() CCompiledFunc * CRecompiler::CompilerCode()
{ {
DWORD pAddr = 0; DWORD pAddr = 0;
if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER,pAddr)) if (!g_TransVaddr->TranslateVaddr(PROGRAM_COUNTER,(uint32_t &)pAddr))
{ {
WriteTraceF(TraceError,__FUNCTION__ ": Failed to translate %X",PROGRAM_COUNTER); WriteTraceF(TraceError,__FUNCTION__ ": Failed to translate %X",PROGRAM_COUNTER);
return NULL; return NULL;
@ -859,7 +859,7 @@ CCompiledFunc * CRecompiler::CompilerCode()
for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next()) for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next())
{ {
DWORD PAddr; DWORD PAddr;
if (g_TransVaddr->TranslateVaddr(Func->MinPC(),PAddr)) if (g_TransVaddr->TranslateVaddr(Func->MinPC(),(uint32_t &)PAddr))
{ {
MD5Digest Hash; MD5Digest Hash;
MD5(g_MMU->Rdram() + PAddr,(Func->MaxPC() - Func->MinPC())+ 4).get_digest(Hash); MD5(g_MMU->Rdram() + PAddr,(Func->MaxPC() - Func->MinPC())+ 4).get_digest(Hash);
@ -970,7 +970,7 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
case FuncFind_PhysicalLookup: case FuncFind_PhysicalLookup:
{ {
DWORD pAddr = 0; DWORD pAddr = 0;
if (g_TransVaddr->TranslateVaddr(Address,pAddr)) if (g_TransVaddr->TranslateVaddr(Address,(uint32_t &)pAddr))
{ {
ClearRecompCode_Phys(pAddr,length,Reason); ClearRecompCode_Phys(pAddr,length,Reason);
} }
@ -995,7 +995,7 @@ void CRecompiler::ResetMemoryStackPos()
} }
DWORD pAddr = 0; DWORD pAddr = 0;
if (g_TransVaddr->TranslateVaddr(m_Registers.m_GPR[29].UW[0],pAddr)) if (g_TransVaddr->TranslateVaddr(m_Registers.m_GPR[29].UW[0],(uint32_t &)pAddr))
{ {
m_MemoryStack = (DWORD)(g_MMU->Rdram() + pAddr); m_MemoryStack = (DWORD)(g_MMU->Rdram() + pAddr);
} else { } else {

View File

@ -61,7 +61,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc,
{ {
OPCODE Command; OPCODE Command;
if (!g_MMU->LW_VAddr(m_CompilePC + 4, (DWORD &)Command.Hex)) { if (!g_MMU->LW_VAddr(m_CompilePC + 4, Command.Hex)) {
g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD)); g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD));
ExitThread(0); ExitThread(0);
} }
@ -1694,7 +1694,7 @@ void CRecompilerOps::LUI() {
x86Reg Reg = Map_MemoryStack(x86_Any, true, false); x86Reg Reg = Map_MemoryStack(x86_Any, true, false);
DWORD Address; DWORD Address;
g_TransVaddr->TranslateVaddr(((short)m_Opcode.offset << 16), Address); g_TransVaddr->TranslateVaddr(((short)m_Opcode.offset << 16), (uint32_t &)Address);
if (Reg < 0) { if (Reg < 0) {
MoveConstToVariable((DWORD)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack"); MoveConstToVariable((DWORD)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack");
} else { } else {