[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 )
{
uint32_t PAddr;
if (!g_TransVaddr->TranslateVaddr(VAddr,(DWORD &)PAddr))
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
{
if (g_LogOptions.LogUnknown)
{
@ -226,7 +226,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -253,7 +253,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -274,7 +274,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SP_PC (%08X)",PC, Value);
return;
}
@ -284,7 +284,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -304,7 +304,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -320,7 +320,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -346,7 +346,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -364,7 +364,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -389,7 +389,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
@ -409,7 +409,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
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);
return;
}
@ -419,7 +419,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
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);
return;
}
@ -429,7 +429,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
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);
return;
}
@ -439,7 +439,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value);
return;
}
@ -453,7 +453,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
{
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);
return;
}
@ -468,7 +468,7 @@ void Log_LW (uint32_t PC, uint32_t VAddr)
return;
}
g_MMU->LW_VAddr(VAddr,(DWORD &)Value);
g_MMU->LW_VAddr(VAddr,Value);
switch (VAddr)
{
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 )
{
uint32_t PAddr;
if (!g_TransVaddr->TranslateVaddr(VAddr,(DWORD &)PAddr))
if (!g_TransVaddr->TranslateVaddr(VAddr,PAddr))
{
if (g_LogOptions.LogUnknown)
{

View File

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

View File

@ -402,14 +402,14 @@ void CDebugMemoryView::RefreshMemory(bool ResetCompare)
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;
}
}
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;
}
@ -438,14 +438,14 @@ void CDebugMemoryView::RefreshMemory(bool ResetCompare)
if (m_DataVAddrr)
{
if (!g_MMU->LW_VAddr(Pos, word.UW))
if (!g_MMU->LW_VAddr(Pos, (uint32_t &)word.UW))
{
ValidData = false;
}
}
else
{
if (!g_MMU->LW_PAddr(Pos, word.UW))
if (!g_MMU->LW_PAddr(Pos, (uint32_t &)word.UW))
{
ValidData = false;
}

View File

@ -21,7 +21,7 @@ bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2)
{
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");
//ExitThread(0);
@ -276,7 +276,7 @@ void CInterpreterCPU::ExecuteCPU()
{
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)
{
@ -367,7 +367,7 @@ void CInterpreterCPU::ExecuteOps(int Cycles)
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)
{

View File

@ -929,7 +929,7 @@ void R4300iOp32::LWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value))
if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{
if (bShowTLBMisses())
{
@ -956,7 +956,7 @@ void R4300iOp32::LW()
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())
{
@ -1015,7 +1015,7 @@ void R4300iOp32::LWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
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__);
if (bShowTLBMisses())
@ -1037,7 +1037,7 @@ void R4300iOp32::LWU()
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())
{
@ -1060,7 +1060,7 @@ void R4300iOp32::LL()
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())
{

View File

@ -1093,7 +1093,7 @@ void R4300iOp::LWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
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__);
if (bShowTLBMisses())
@ -1120,7 +1120,7 @@ void R4300iOp::LW()
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())
{
@ -1179,7 +1179,7 @@ void R4300iOp::LWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
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__);
if (bShowTLBMisses())
@ -1201,7 +1201,7 @@ void R4300iOp::LWU()
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())
{
@ -1258,7 +1258,7 @@ void R4300iOp::SWL()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value))
if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{
if (bHaveDebugger())
{
@ -1414,7 +1414,7 @@ void R4300iOp::SWR()
Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset;
Offset = Address & 3;
if (!g_MMU->LW_VAddr((Address & ~3),Value))
if (!g_MMU->LW_VAddr((Address & ~3),(uint32_t &)Value))
{
if (bHaveDebugger())
{
@ -1461,7 +1461,7 @@ void R4300iOp::LL()
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())
{
@ -1484,7 +1484,7 @@ void R4300iOp::LWC1()
{
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())
{

View File

@ -10,51 +10,48 @@
****************************************************************************/
#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
virtual bool WriteToProtectedMemory (DWORD Address, int length) = 0;
virtual bool WriteToProtectedMemory (uint32_t Address, int32_t length) = 0;
};
class CMipsMemory
__interface CMipsMemory
{
public:
virtual BYTE * Rdram () = 0;
virtual DWORD RdramSize() = 0;
virtual BYTE * Dmem () = 0;
virtual BYTE * Imem () = 0;
virtual BYTE * PifRam () = 0;
virtual uint8_t * Rdram () = 0;
virtual uint32_t RdramSize() = 0;
virtual uint8_t * Dmem () = 0;
virtual uint8_t * Imem () = 0;
virtual uint8_t * 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_VAddr ( uint32_t VAddr, uint8_t & Value ) = 0;
virtual bool LH_VAddr ( uint32_t VAddr, uint16_t & Value ) = 0;
virtual bool LW_VAddr ( uint32_t VAddr, uint32_t & Value ) = 0;
virtual bool LD_VAddr ( uint32_t VAddr, uint64_t & Value ) = 0;
virtual bool LB_PAddr ( DWORD PAddr, BYTE & Value ) = 0;
virtual bool LH_PAddr ( DWORD PAddr, WORD & Value ) = 0;
virtual bool LW_PAddr ( DWORD PAddr, DWORD & Value ) = 0;
virtual bool LD_PAddr ( DWORD PAddr, QWORD & Value ) = 0;
virtual bool LB_PAddr ( uint32_t PAddr, uint8_t & Value ) = 0;
virtual bool LH_PAddr ( uint32_t PAddr, uint16_t & Value ) = 0;
virtual bool LW_PAddr ( uint32_t PAddr, uint32_t & Value ) = 0;
virtual bool LD_PAddr ( uint32_t PAddr, uint64_t & Value ) = 0;
virtual bool SB_VAddr ( DWORD VAddr, BYTE Value ) = 0;
virtual bool SH_VAddr ( DWORD VAddr, WORD Value ) = 0;
virtual bool SW_VAddr ( DWORD VAddr, DWORD Value ) = 0;
virtual bool SD_VAddr ( DWORD VAddr, QWORD Value ) = 0;
virtual bool SB_VAddr ( uint32_t VAddr, uint8_t Value ) = 0;
virtual bool SH_VAddr ( uint32_t VAddr, uint16_t Value ) = 0;
virtual bool SW_VAddr ( uint32_t VAddr, uint32_t Value ) = 0;
virtual bool SD_VAddr ( uint32_t VAddr, uint64_t Value ) = 0;
virtual bool SB_PAddr ( DWORD PAddr, BYTE Value ) = 0;
virtual bool SH_PAddr ( DWORD PAddr, WORD Value ) = 0;
virtual bool SW_PAddr ( DWORD PAddr, DWORD Value ) = 0;
virtual bool SD_PAddr ( DWORD PAddr, QWORD Value ) = 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 bool ValidVaddr ( DWORD VAddr ) const = 0;
virtual bool ValidVaddr ( uint32_t VAddr ) const = 0;
virtual int MemoryFilter ( DWORD dwExptCode, void * lpExceptionPointer ) = 0;
virtual void UpdateFieldSerration ( unsigned int interlaced ) = 0;
virtual int32_t MemoryFilter ( uint32_t dwExptCode, void * lpExceptionPointer ) = 0;
virtual void UpdateFieldSerration ( uint32_t interlaced ) = 0;
//Protect the Memory from being written to
virtual void ProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0;
virtual void UnProtectMemory ( DWORD StartVaddr, DWORD EndVaddr ) = 0;
virtual void ProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
virtual void UnProtectMemory ( uint32_t StartVaddr, uint32_t EndVaddr ) = 0;
//Compilation Functions
virtual void ResetMemoryStack () = 0;

File diff suppressed because it is too large Load Diff

View File

@ -11,12 +11,12 @@
#pragma once
/*
* 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).
*
* Attempting to read the 32-bit subsets seems to be erroneous and forbidden.
* Refer to "MemoryFilter" in `Memory Virtual Mem.cpp`.
*/
* 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).
*
* Attempting to read the 32-bit subsets seems to be erroneous and forbidden.
* Refer to "MemoryFilter" in `Memory Virtual Mem.cpp`.
*/
#ifdef _WIN64
#define Eax Rax
#define Ebx Rbx
@ -61,38 +61,38 @@ public:
bool Initialize ();
void Reset ( bool EraseMemory );
BYTE * Rdram ();
DWORD RdramSize ();
BYTE * Dmem ();
BYTE * Imem ();
BYTE * PifRam ();
uint8_t * Rdram ();
uint32_t RdramSize ();
uint8_t * Dmem ();
uint8_t * Imem ();
uint8_t * PifRam ();
bool LB_VAddr ( DWORD VAddr, BYTE & Value );
bool LH_VAddr ( DWORD VAddr, WORD & Value );
bool LW_VAddr ( DWORD VAddr, DWORD & Value );
bool LD_VAddr ( DWORD VAddr, QWORD & Value );
bool LB_VAddr ( uint32_t VAddr, uint8_t & Value );
bool LH_VAddr ( uint32_t VAddr, uint16_t & Value );
bool LW_VAddr ( uint32_t VAddr, uint32_t & Value );
bool LD_VAddr ( uint32_t VAddr, uint64_t & Value );
bool LB_PAddr ( DWORD PAddr, BYTE & Value );
bool LH_PAddr ( DWORD PAddr, WORD & Value );
bool LW_PAddr ( DWORD PAddr, DWORD & Value );
bool LD_PAddr ( DWORD PAddr, QWORD & Value );
bool LB_PAddr ( uint32_t PAddr, uint8_t & Value );
bool LH_PAddr ( uint32_t PAddr, uint16_t & Value );
bool LW_PAddr ( uint32_t PAddr, uint32_t & Value );
bool LD_PAddr ( uint32_t PAddr, uint64_t & Value );
bool SB_VAddr ( DWORD VAddr, BYTE Value );
bool SH_VAddr ( DWORD VAddr, WORD Value );
bool SW_VAddr ( DWORD VAddr, DWORD Value );
bool SD_VAddr ( DWORD VAddr, QWORD Value );
bool SB_VAddr ( uint32_t VAddr, uint8_t Value );
bool SH_VAddr ( uint32_t VAddr, uint16_t Value );
bool SW_VAddr ( uint32_t VAddr, uint32_t Value );
bool SD_VAddr ( uint32_t VAddr, uint64_t Value );
bool SB_PAddr ( DWORD PAddr, BYTE Value );
bool SH_PAddr ( DWORD PAddr, WORD Value );
bool SW_PAddr ( DWORD PAddr, DWORD Value );
bool SD_PAddr ( DWORD PAddr, QWORD Value );
bool SB_PAddr ( uint32_t PAddr, uint8_t Value );
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 );
int MemoryFilter(DWORD dwExptCode, void * lpExceptionPointer);
void UpdateFieldSerration(unsigned int interlaced);
int32_t MemoryFilter(uint32_t dwExptCode, void * lpExceptionPointer);
void UpdateFieldSerration(uint32_t interlaced);
//Protect the Memory from being written to
void ProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
void UnProtectMemory(DWORD StartVaddr, DWORD EndVaddr);
void ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
void UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr);
//Compilation Functions
void ResetMemoryStack();
@ -124,28 +124,28 @@ public:
void Compile_SDC1();
void ResetMemoryStack ( CRegInfo& RegInfo );
void Compile_LB ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend );
void Compile_LH ( CX86Ops::x86Reg Reg, DWORD Addr, bool SignExtend );
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_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, DWORD Addr );
void Compile_SW_Register ( CX86Ops::x86Reg Reg, uint32_t Addr );
//Functions for TLB notification
void TLB_Mapped(DWORD VAddr, DWORD Len, DWORD PAddr, bool bReadOnly);
void TLB_Unmaped(DWORD Vaddr, DWORD Len);
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(DWORD VAddr, DWORD &PAddr) const;
bool ValidVaddr(DWORD VAddr) const;
bool VAddrToRealAddr(DWORD VAddr, void * &RealAddress) const;
bool TranslateVaddr(uint32_t VAddr, uint32_t &PAddr) const;
bool ValidVaddr(uint32_t VAddr) const;
bool VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const;
// Labels
LPCTSTR LabelName(DWORD Address) const;
const char * LabelName(uint32_t Address) const;
private:
CMipsMemoryVM(); // Disable default constructor
@ -159,36 +159,36 @@ private:
static void ChangeSpStatus ();
static void ChangeMiIntrMask();
bool LB_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend );
bool LH_NonMemory ( DWORD PAddr, DWORD * Value, bool SignExtend );
bool LW_NonMemory ( DWORD PAddr, DWORD * Value );
bool LB_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
bool LH_NonMemory ( uint32_t PAddr, uint32_t * Value, bool SignExtend );
bool LW_NonMemory ( uint32_t PAddr, uint32_t * Value );
bool SB_NonMemory ( DWORD PAddr, BYTE Value );
bool SH_NonMemory ( DWORD PAddr, WORD Value );
bool SW_NonMemory ( DWORD PAddr, DWORD Value );
bool SB_NonMemory ( uint32_t PAddr, uint8_t Value );
bool SH_NonMemory ( uint32_t PAddr, uint16_t 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;
//Memory Locations
static BYTE * m_Reserve1, * m_Reserve2;
BYTE * m_RDRAM, * m_DMEM, * m_IMEM;
DWORD m_AllocatedRdramSize;
static uint8_t * m_Reserve1, * m_Reserve2;
uint8_t * m_RDRAM, * m_DMEM, * m_IMEM;
uint32_t m_AllocatedRdramSize;
//Rom Information
bool m_RomMapped;
BYTE * m_Rom;
DWORD m_RomSize;
uint8_t * m_Rom;
uint32_t m_RomSize;
bool m_RomWrittenTo;
DWORD m_RomWroteValue;
uint32_t m_RomWroteValue;
//Current Half line
void UpdateHalfLine();
DWORD m_HalfLine;
DWORD m_HalfLineCheck;
DWORD m_FieldSerration;
DWORD m_TempValue;
uint32_t m_HalfLine;
uint32_t m_HalfLineCheck;
uint32_t m_FieldSerration;
uint32_t m_TempValue;
//Initializing and resetting information about the memory system
void FreeMemory();

View File

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

View File

@ -1364,7 +1364,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU)
for (count = -10; count < 10; count++)
{
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));
}
@ -1375,7 +1375,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU)
for (count = 0; count < 50; count++)
{
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));
}
@ -1857,7 +1857,7 @@ void CN64System::RunRSP()
DWORD Task = 0;
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)
{
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); }
}
bool CN64System::WriteToProtectedMemory (DWORD Address, int length)
bool CN64System::WriteToProtectedMemory (uint32_t Address, int length)
{
WriteTraceF(TraceDebug,__FUNCTION__ ": Address: %X Len: %d",Address,length);
if (m_Recomp)

View File

@ -111,7 +111,7 @@ private:
void CpuStopped();
//Function in CMipsMemory_CallBack
virtual bool WriteToProtectedMemory(DWORD Address, int length);
virtual bool WriteToProtectedMemory(uint32_t Address, int length);
//Functions in CTLB_CB
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;
OPCODE Command;
if (!g_MMU->LW_VAddr(PC, (DWORD &)Command.Hex))
if (!g_MMU->LW_VAddr(PC, Command.Hex))
{
g_Notify->BreakPoint(__FILEW__,__LINE__);
return false;
@ -730,7 +730,7 @@ bool CCodeBlock::Compile()
}
CompileExitCode();
DWORD PAddr;
uint32_t PAddr;
g_TransVaddr->TranslateVaddr(VAddrFirst(),PAddr);
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) {
OPCODE Command;
if (!g_MMU->LW_VAddr(JumpPC, (DWORD &)Command.Hex))
if (!g_MMU->LW_VAddr(JumpPC, Command.Hex))
return true;
switch (Command.op) {
@ -58,7 +58,7 @@ static bool DelaySlotEffectsJump(DWORD JumpPC) {
bool EffectDelaySlot = false;
OPCODE NewCommand;
if (!g_MMU->LW_VAddr(JumpPC + 4, (DWORD &)NewCommand.Hex)) {
if (!g_MMU->LW_VAddr(JumpPC + 4, NewCommand.Hex)) {
return true;
}
@ -932,7 +932,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
do {
__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));
ExitThread(0);

View File

@ -167,7 +167,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section)
CPU_Message("ContinueSectionPC = %08X",ContinueSectionPC);
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__);
return false;

View File

@ -345,7 +345,7 @@ void CRecompiler::RecompilerMain_Lookup()
} else {
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());
opsExecuted += g_System->CountPerOp();
@ -516,10 +516,10 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
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);
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());
m_EndEmulation = true;
@ -549,7 +549,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB()
{
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());
opsExecuted += g_System->CountPerOp();
@ -597,7 +597,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
} else {
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());
opsExecuted += g_System->CountPerOp();
@ -618,10 +618,10 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
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);
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());
m_EndEmulation = true;
@ -667,7 +667,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB()
} else {
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());
opsExecuted += g_System->CountPerOp();
@ -847,7 +847,7 @@ void CRecompiler::RecompilerMain_ChangeMemory()
CCompiledFunc * CRecompiler::CompilerCode()
{
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);
return NULL;
@ -859,7 +859,7 @@ CCompiledFunc * CRecompiler::CompilerCode()
for (CCompiledFunc * Func = iter->second; Func != NULL; Func = Func->Next())
{
DWORD PAddr;
if (g_TransVaddr->TranslateVaddr(Func->MinPC(),PAddr))
if (g_TransVaddr->TranslateVaddr(Func->MinPC(),(uint32_t &)PAddr))
{
MD5Digest 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:
{
DWORD pAddr = 0;
if (g_TransVaddr->TranslateVaddr(Address,pAddr))
if (g_TransVaddr->TranslateVaddr(Address,(uint32_t &)pAddr))
{
ClearRecompCode_Phys(pAddr,length,Reason);
}
@ -995,7 +995,7 @@ void CRecompiler::ResetMemoryStackPos()
}
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);
} else {

View File

@ -61,7 +61,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc,
{
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));
ExitThread(0);
}
@ -1694,7 +1694,7 @@ void CRecompilerOps::LUI() {
x86Reg Reg = Map_MemoryStack(x86_Any, true, false);
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) {
MoveConstToVariable((DWORD)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack");
} else {