[Core] Change TranslateVaddr to VAddrToPAddr
This commit is contained in:
parent
4895dcf9aa
commit
b74a2dc69f
|
@ -5,112 +5,11 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/Mips/TranslateVaddr.h>
|
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/N64Rom.h>
|
#include <Project64-core/N64System/N64Rom.h>
|
||||||
|
|
||||||
CFile * CLogging::m_hLogFile = nullptr;
|
CFile * CLogging::m_hLogFile = nullptr;
|
||||||
|
|
||||||
void CLogging::Log_LW(uint32_t PC, uint32_t VAddr)
|
|
||||||
{
|
|
||||||
if (!GenerateLog())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VAddr < 0xA0000000 || VAddr >= 0xC0000000)
|
|
||||||
{
|
|
||||||
uint32_t PAddr;
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
|
||||||
{
|
|
||||||
if (LogUnknown())
|
|
||||||
{
|
|
||||||
LogMessage("%08X: read from unknown ??? (%08X)", PC, VAddr);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VAddr = PAddr + 0xA0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize())) ||
|
|
||||||
(VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) ||
|
|
||||||
(VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC) ||
|
|
||||||
(VAddr == 0xA4080000) ||
|
|
||||||
(VAddr >= 0xA4100000 && VAddr <= 0xA410001C) ||
|
|
||||||
(VAddr >= 0xA4300000 && VAddr <= 0xA430000C) ||
|
|
||||||
(VAddr >= 0xA4400000 && VAddr <= 0xA4400034) ||
|
|
||||||
(VAddr >= 0xA4500000 && VAddr <= 0xA4500014) ||
|
|
||||||
(VAddr == 0xA4800000 && VAddr <= 0xA4800018) ||
|
|
||||||
(VAddr >= 0xB0000000 && ((VAddr - 0xB0000000) < g_Rom->GetRomSize())) ||
|
|
||||||
(VAddr >= 0xBFC00000 && VAddr <= 0xBFC007FC))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!LogUnknown())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: read from unknown ??? (%08X)", PC, VAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogging::Log_SW(uint32_t PC, uint32_t VAddr, uint32_t Value)
|
|
||||||
{
|
|
||||||
if (!GenerateLog())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VAddr < 0xA0000000 || VAddr >= 0xC0000000)
|
|
||||||
{
|
|
||||||
uint32_t PAddr;
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
|
||||||
{
|
|
||||||
if (LogUnknown())
|
|
||||||
{
|
|
||||||
LogMessage("%08X: Writing 0x%08X to %08X", PC, Value, VAddr);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VAddr = PAddr + 0xA0000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VAddr >= 0xA4200000 && VAddr <= 0xA420000C)
|
|
||||||
{
|
|
||||||
if (!LogDPSRegisters())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (VAddr)
|
|
||||||
{
|
|
||||||
case 0xA4200000: LogMessage("%08X: Writing 0x%08X to DPS_TBIST_REG", PC, Value); return;
|
|
||||||
case 0xA4200004: LogMessage("%08X: Writing 0x%08X to DPS_TEST_MODE_REG", PC, Value); return;
|
|
||||||
case 0xA4200008: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_ADDR_REG", PC, Value); return;
|
|
||||||
case 0xA420000C: LogMessage("%08X: Writing 0x%08X to DPS_BUFTEST_DATA_REG", PC, Value); return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize())) ||
|
|
||||||
(VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) ||
|
|
||||||
(VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC) ||
|
|
||||||
(VAddr >= 0xA4040000 && VAddr <= 0xA404001C) ||
|
|
||||||
(VAddr == 0xA4080000) ||
|
|
||||||
(VAddr >= 0xA4100000 && VAddr <= 0xA410001C) ||
|
|
||||||
(VAddr >= 0xA4300000 && VAddr <= 0xA430000C) ||
|
|
||||||
(VAddr >= 0xA4400000 && VAddr <= 0xA4400034) ||
|
|
||||||
(VAddr >= 0xA4500000 && VAddr <= 0xA4500014) ||
|
|
||||||
(VAddr >= 0xA4800000 && VAddr <= 0xA4800018) ||
|
|
||||||
(VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LogUnknown())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LogMessage("%08X: Writing 0x%08X to %08X ????", PC, Value, VAddr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLogging::LogMessage(const char * Message, ...)
|
void CLogging::LogMessage(const char * Message, ...)
|
||||||
{
|
{
|
||||||
char Msg[400];
|
char Msg[400];
|
||||||
|
|
|
@ -9,8 +9,6 @@ public:
|
||||||
static void StartLog(void);
|
static void StartLog(void);
|
||||||
static void StopLog(void);
|
static void StopLog(void);
|
||||||
|
|
||||||
static void Log_LW(uint32_t PC, uint32_t VAddr);
|
|
||||||
static void Log_SW(uint32_t PC, uint32_t VAddr, uint32_t Value);
|
|
||||||
static void LogMessage(const char * Message, ...);
|
static void LogMessage(const char * Message, ...);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1133,10 +1133,6 @@ void R4300iOp::LW()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GenerateLog())
|
|
||||||
{
|
|
||||||
Log_LW((*_PROGRAM_COUNTER), Address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
|
@ -1330,10 +1326,6 @@ void R4300iOp::SW()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GenerateLog())
|
|
||||||
{
|
|
||||||
Log_SW((*_PROGRAM_COUNTER), Address, _GPR[m_Opcode.rt].UW[0]);
|
|
||||||
}
|
|
||||||
if (!g_MMU->SW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->SW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
|
@ -1536,7 +1528,6 @@ void R4300iOp::SC()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log_SW((*_PROGRAM_COUNTER), Address, _GPR[m_Opcode.rt].UW[0]);
|
|
||||||
if ((*_LLBit) == 1)
|
if ((*_LLBit) == 1)
|
||||||
{
|
{
|
||||||
if (!g_MMU->SW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->SW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
|
|
|
@ -964,11 +964,6 @@ void R4300iOp32::LW()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GenerateLog())
|
|
||||||
{
|
|
||||||
Log_LW((*_PROGRAM_COUNTER), Address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
if (!g_MMU->LW_VAddr(Address, _GPR[m_Opcode.rt].UW[0]))
|
||||||
{
|
{
|
||||||
if (bShowTLBMisses())
|
if (bShowTLBMisses())
|
||||||
|
|
|
@ -11,7 +11,7 @@ bool CartridgeDomain1Address3Handler::Read32(uint32_t Address, uint32_t & Value)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CartridgeDomain1Address3Handler::Write32(uint32_t Address, uint32_t Value, uint32_t Mask)
|
bool CartridgeDomain1Address3Handler::Write32(uint32_t /*Address*/, uint32_t /*Value*/, uint32_t /*Mask*/)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ uint32_t CMipsMemoryVM::RegModValue;
|
||||||
CMipsMemoryVM::CMipsMemoryVM(CN64System & System, bool SavesReadOnly) :
|
CMipsMemoryVM::CMipsMemoryVM(CN64System & System, bool SavesReadOnly) :
|
||||||
CPifRam(SavesReadOnly),
|
CPifRam(SavesReadOnly),
|
||||||
CDMA(m_CartridgeDomain2Address2Handler),
|
CDMA(m_CartridgeDomain2Address2Handler),
|
||||||
|
m_System(System),
|
||||||
m_Reg(System.m_Reg),
|
m_Reg(System.m_Reg),
|
||||||
m_AudioInterfaceHandler(System, System.m_Reg),
|
m_AudioInterfaceHandler(System, System.m_Reg),
|
||||||
m_CartridgeDomain1Address1Handler(g_DDRom),
|
m_CartridgeDomain1Address1Handler(g_DDRom),
|
||||||
|
@ -109,7 +110,6 @@ void CMipsMemoryVM::Reset(bool /*EraseMemory*/)
|
||||||
}
|
}
|
||||||
m_TLB_ReadMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
|
m_TLB_ReadMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
|
||||||
m_TLB_WriteMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
|
m_TLB_WriteMap[Address >> 12] = ((size_t)m_RDRAM + TargetAddress) - Address;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,19 +441,8 @@ bool CMipsMemoryVM::ValidVaddr(uint32_t VAddr) const
|
||||||
return m_TLB_ReadMap[VAddr >> 12] != 0;
|
return m_TLB_ReadMap[VAddr >> 12] != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMipsMemoryVM::VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const
|
bool CMipsMemoryVM::VAddrToPAddr(uint32_t VAddr, uint32_t &PAddr) const
|
||||||
{
|
{
|
||||||
if (m_TLB_ReadMap[VAddr >> 12] == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
RealAddress = (uint8_t *)(m_TLB_ReadMap[VAddr >> 12] + VAddr);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CMipsMemoryVM::TranslateVaddr(uint32_t VAddr, uint32_t &PAddr) const
|
|
||||||
{
|
|
||||||
// Change the virtual address to a physical address
|
|
||||||
if (m_TLB_ReadMap[VAddr >> 12] == 0)
|
if (m_TLB_ReadMap[VAddr >> 12] == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -652,11 +641,11 @@ void CMipsMemoryVM::ProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
||||||
|
|
||||||
// Get physical addresses passed
|
// Get physical addresses passed
|
||||||
uint32_t StartPAddr, EndPAddr;
|
uint32_t StartPAddr, EndPAddr;
|
||||||
if (!TranslateVaddr(StartVaddr, StartPAddr))
|
if (!VAddrToPAddr(StartVaddr, StartPAddr))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (!TranslateVaddr(EndVaddr, EndPAddr))
|
if (!VAddrToPAddr(EndVaddr, EndPAddr))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -682,11 +671,11 @@ void CMipsMemoryVM::UnProtectMemory(uint32_t StartVaddr, uint32_t EndVaddr)
|
||||||
|
|
||||||
// Get physical addresses passed
|
// Get physical addresses passed
|
||||||
uint32_t StartPAddr, EndPAddr;
|
uint32_t StartPAddr, EndPAddr;
|
||||||
if (!TranslateVaddr(StartVaddr, StartPAddr))
|
if (!VAddrToPAddr(StartVaddr, StartPAddr))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
if (!TranslateVaddr(EndVaddr, EndPAddr))
|
if (!VAddrToPAddr(EndVaddr, EndPAddr))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core\N64System\Mips\MemoryVirtualMem.h>
|
#include <Project64-core\N64System\Mips\MemoryVirtualMem.h>
|
||||||
#include "TranslateVaddr.h"
|
|
||||||
#include <Project64-core\N64System\Recompiler\RecompilerOps.h>
|
#include <Project64-core\N64System\Recompiler\RecompilerOps.h>
|
||||||
#include <Project64-core\N64System\Interpreter\InterpreterOps.h>
|
#include <Project64-core\N64System\Interpreter\InterpreterOps.h>
|
||||||
#include <Project64-core\N64System\Mips\PifRam.h>
|
#include <Project64-core\N64System\Mips\PifRam.h>
|
||||||
|
@ -50,7 +49,6 @@ class CArmRecompilerOps;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CMipsMemoryVM :
|
class CMipsMemoryVM :
|
||||||
public CTransVaddr,
|
|
||||||
private R4300iOp,
|
private R4300iOp,
|
||||||
public CPifRam,
|
public CPifRam,
|
||||||
public CDMA,
|
public CDMA,
|
||||||
|
@ -100,10 +98,8 @@ public:
|
||||||
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
void TLB_Mapped(uint32_t VAddr, uint32_t Len, uint32_t PAddr, bool bReadOnly);
|
||||||
void TLB_Unmaped(uint32_t Vaddr, uint32_t Len);
|
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 ValidVaddr(uint32_t VAddr) const;
|
||||||
bool VAddrToRealAddr(uint32_t VAddr, void * &RealAddress) const;
|
bool VAddrToPAddr(uint32_t VAddr, uint32_t & PAddr) const;
|
||||||
|
|
||||||
// Labels
|
// Labels
|
||||||
const char * LabelName(uint32_t Address) const;
|
const char * LabelName(uint32_t Address) const;
|
||||||
|
@ -159,6 +155,7 @@ private:
|
||||||
void FreeMemory();
|
void FreeMemory();
|
||||||
|
|
||||||
static uint8_t * m_Reserve1, *m_Reserve2;
|
static uint8_t * m_Reserve1, *m_Reserve2;
|
||||||
|
CN64System & m_System;
|
||||||
CRegisters & m_Reg;
|
CRegisters & m_Reg;
|
||||||
AudioInterfaceHandler m_AudioInterfaceHandler;
|
AudioInterfaceHandler m_AudioInterfaceHandler;
|
||||||
CartridgeDomain1Address1Handler m_CartridgeDomain1Address1Handler;
|
CartridgeDomain1Address1Handler m_CartridgeDomain1Address1Handler;
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
__interface CTransVaddr
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
};
|
|
|
@ -989,7 +989,6 @@ bool CN64System::SetActiveSystem(bool bActive)
|
||||||
g_Reg = &m_Reg;
|
g_Reg = &m_Reg;
|
||||||
g_Mempak = &m_Mempak;
|
g_Mempak = &m_Mempak;
|
||||||
g_SystemTimer = &m_SystemTimer;
|
g_SystemTimer = &m_SystemTimer;
|
||||||
g_TransVaddr = &m_MMU_VM;
|
|
||||||
g_SystemEvents = this;
|
g_SystemEvents = this;
|
||||||
g_NextTimer = &m_NextTimer;
|
g_NextTimer = &m_NextTimer;
|
||||||
g_Plugins = m_Plugins;
|
g_Plugins = m_Plugins;
|
||||||
|
@ -1010,7 +1009,6 @@ bool CN64System::SetActiveSystem(bool bActive)
|
||||||
g_TLB = nullptr;
|
g_TLB = nullptr;
|
||||||
g_Reg = nullptr;
|
g_Reg = nullptr;
|
||||||
g_SystemTimer = nullptr;
|
g_SystemTimer = nullptr;
|
||||||
g_TransVaddr = nullptr;
|
|
||||||
g_SystemEvents = nullptr;
|
g_SystemEvents = nullptr;
|
||||||
g_NextTimer = nullptr;
|
g_NextTimer = nullptr;
|
||||||
g_Plugins = m_Plugins;
|
g_Plugins = m_Plugins;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/x86/x86RecompilerOps.h>
|
||||||
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.h>
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/N64System/Mips/TranslateVaddr.h>
|
|
||||||
#include <Project64-core/N64System/N64System.h>
|
#include <Project64-core/N64System/N64System.h>
|
||||||
#include <Project64-core/N64System/Mips/OpcodeName.h>
|
#include <Project64-core/N64System/Mips/OpcodeName.h>
|
||||||
|
|
||||||
|
@ -16,7 +15,8 @@ bool DelaySlotEffectsCompare(uint32_t PC, uint32_t Reg1, uint32_t Reg2);
|
||||||
extern "C" void __clear_cache_android(uint8_t* begin, uint8_t *end);
|
extern "C" void __clear_cache_android(uint8_t* begin, uint8_t *end);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCodeBlock::CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation) :
|
CCodeBlock::CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * CompiledLocation) :
|
||||||
|
m_MMU(MMU),
|
||||||
m_VAddrEnter(VAddrEnter),
|
m_VAddrEnter(VAddrEnter),
|
||||||
m_VAddrFirst(VAddrEnter),
|
m_VAddrFirst(VAddrEnter),
|
||||||
m_VAddrLast(VAddrEnter),
|
m_VAddrLast(VAddrEnter),
|
||||||
|
@ -33,7 +33,7 @@ CCodeBlock::CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation) :
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(__i386__) || defined(_M_IX86)
|
#if defined(__i386__) || defined(_M_IX86)
|
||||||
m_RecompilerOps = new CX86RecompilerOps;
|
m_RecompilerOps = new CX86RecompilerOps(MMU);
|
||||||
#elif defined(__arm__) || defined(_M_ARM)
|
#elif defined(__arm__) || defined(_M_ARM)
|
||||||
m_RecompilerOps = new CArmRecompilerOps;
|
m_RecompilerOps = new CArmRecompilerOps;
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,8 +65,16 @@ CCodeBlock::CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation) :
|
||||||
m_Sections.push_back(m_EnterSection);
|
m_Sections.push_back(m_EnterSection);
|
||||||
m_SectionMap.insert(SectionMap::value_type(VAddrEnter, m_EnterSection));
|
m_SectionMap.insert(SectionMap::value_type(VAddrEnter, m_EnterSection));
|
||||||
|
|
||||||
if (g_TransVaddr->VAddrToRealAddr(VAddrEnter, *(reinterpret_cast<void **>(&m_MemLocation[0]))))
|
uint32_t PAddr;
|
||||||
|
if (!MMU.VAddrToPAddr(VAddrEnter, PAddr))
|
||||||
{
|
{
|
||||||
|
memset(m_MemLocation, 0, sizeof(m_MemLocation));
|
||||||
|
memset(m_MemContents, 0, sizeof(m_MemContents));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (PAddr + 16 < MMU.RdramSize())
|
||||||
|
{
|
||||||
|
m_MemLocation[0] = (uint64_t *)(MMU.Rdram() + PAddr);
|
||||||
m_MemLocation[1] = m_MemLocation[0] + 1;
|
m_MemLocation[1] = m_MemLocation[0] + 1;
|
||||||
m_MemContents[0] = *m_MemLocation[0];
|
m_MemContents[0] = *m_MemLocation[0];
|
||||||
m_MemContents[1] = *m_MemLocation[1];
|
m_MemContents[1] = *m_MemLocation[1];
|
||||||
|
@ -75,8 +83,8 @@ CCodeBlock::CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation) :
|
||||||
{
|
{
|
||||||
memset(m_MemLocation, 0, sizeof(m_MemLocation));
|
memset(m_MemLocation, 0, sizeof(m_MemLocation));
|
||||||
memset(m_MemContents, 0, sizeof(m_MemContents));
|
memset(m_MemContents, 0, sizeof(m_MemContents));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyseBlock();
|
AnalyseBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,9 +775,8 @@ bool CCodeBlock::Compile()
|
||||||
m_CompiledLocationEnd = *g_RecompPos;
|
m_CompiledLocationEnd = *g_RecompPos;
|
||||||
|
|
||||||
uint32_t PAddr;
|
uint32_t PAddr;
|
||||||
g_TransVaddr->TranslateVaddr(VAddrFirst(), PAddr);
|
m_MMU.VAddrToPAddr(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);
|
||||||
|
|
||||||
#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
|
#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
|
||||||
__clear_cache((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocationEnd);
|
__clear_cache((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocationEnd);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
#include <Project64-core/N64System/Recompiler/RecompilerOps.h>
|
||||||
#include <Project64-core/N64System/Recompiler/CodeSection.h>
|
#include <Project64-core/N64System/Recompiler/CodeSection.h>
|
||||||
|
|
||||||
|
class CMipsMemoryVM;
|
||||||
|
|
||||||
class CCodeBlock
|
class CCodeBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCodeBlock(uint32_t VAddrEnter, uint8_t * CompiledLocation);
|
CCodeBlock(CMipsMemoryVM & MMU, uint32_t VAddrEnter, uint8_t * CompiledLocation);
|
||||||
~CCodeBlock();
|
~CCodeBlock();
|
||||||
|
|
||||||
bool Compile();
|
bool Compile();
|
||||||
|
@ -42,8 +44,7 @@ private:
|
||||||
void DetermineLoops();
|
void DetermineLoops();
|
||||||
void LogSectionInfo();
|
void LogSectionInfo();
|
||||||
bool SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC);
|
bool SetSection(CCodeSection * & Section, CCodeSection * CurrentSection, uint32_t TargetPC, bool LinkAllowed, uint32_t CurrentPC);
|
||||||
bool AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot,
|
bool AnalyzeInstruction(uint32_t PC, uint32_t & TargetPC, uint32_t & ContinuePC, bool & LikelyBranch, bool & IncludeDelaySlot, bool & EndBlock, bool & PermLoop);
|
||||||
bool & EndBlock, bool & PermLoop);
|
|
||||||
|
|
||||||
uint32_t m_VAddrEnter;
|
uint32_t m_VAddrEnter;
|
||||||
uint32_t m_VAddrFirst; // The address of the first opcode in the block
|
uint32_t m_VAddrFirst; // The address of the first opcode in the block
|
||||||
|
@ -54,6 +55,7 @@ private:
|
||||||
typedef std::map<uint32_t, CCodeSection *> SectionMap;
|
typedef std::map<uint32_t, CCodeSection *> SectionMap;
|
||||||
typedef std::list<CCodeSection *> SectionList;
|
typedef std::list<CCodeSection *> SectionList;
|
||||||
|
|
||||||
|
CMipsMemoryVM & m_MMU;
|
||||||
SectionMap m_SectionMap;
|
SectionMap m_SectionMap;
|
||||||
SectionList m_Sections;
|
SectionList m_Sections;
|
||||||
CCodeSection * m_EnterSection;
|
CCodeSection * m_EnterSection;
|
||||||
|
|
|
@ -147,10 +147,10 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
|
|
||||||
while (!m_EndEmulation)
|
while (!m_EndEmulation)
|
||||||
{
|
{
|
||||||
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
if (!m_MMU.VAddrToPAddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||||
{
|
{
|
||||||
m_Registers.DoTLBReadMiss(false, PROGRAM_COUNTER);
|
m_Registers.DoTLBReadMiss(false, PROGRAM_COUNTER);
|
||||||
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
if (!m_MMU.VAddrToPAddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PROGRAM_COUNTER).c_str());
|
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PROGRAM_COUNTER).c_str());
|
||||||
m_EndEmulation = true;
|
m_EndEmulation = true;
|
||||||
|
@ -180,7 +180,7 @@ void CRecompiler::RecompilerMain_Lookup()
|
||||||
{
|
{
|
||||||
uint32_t opsExecuted = 0;
|
uint32_t opsExecuted = 0;
|
||||||
|
|
||||||
while (m_MMU.TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
while (m_MMU.VAddrToPAddr(PROGRAM_COUNTER, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
||||||
{
|
{
|
||||||
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
||||||
opsExecuted += g_System->CountPerOp();
|
opsExecuted += g_System->CountPerOp();
|
||||||
|
@ -205,10 +205,10 @@ void CRecompiler::RecompilerMain_Lookup_validate()
|
||||||
|
|
||||||
while (!Done)
|
while (!Done)
|
||||||
{
|
{
|
||||||
if (!m_MMU.TranslateVaddr(PC, PhysicalAddr))
|
if (!m_MMU.VAddrToPAddr(PC, PhysicalAddr))
|
||||||
{
|
{
|
||||||
m_Registers.DoTLBReadMiss(false, PC);
|
m_Registers.DoTLBReadMiss(false, PC);
|
||||||
if (!m_MMU.TranslateVaddr(PC, PhysicalAddr))
|
if (!m_MMU.VAddrToPAddr(PC, PhysicalAddr))
|
||||||
{
|
{
|
||||||
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PC).c_str());
|
g_Notify->DisplayError(stdstr_f("Failed to translate PC to a PAddr: %X\n\nEmulation stopped", PC).c_str());
|
||||||
Done = true;
|
Done = true;
|
||||||
|
@ -292,7 +292,7 @@ void CRecompiler::RecompilerMain_Lookup_validate()
|
||||||
{
|
{
|
||||||
uint32_t opsExecuted = 0;
|
uint32_t opsExecuted = 0;
|
||||||
|
|
||||||
while (m_MMU.TranslateVaddr(PC, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
while (m_MMU.VAddrToPAddr(PC, PhysicalAddr) && PhysicalAddr >= g_System->RdramSize())
|
||||||
{
|
{
|
||||||
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
CInterpreterCPU::ExecuteOps(g_System->CountPerOp());
|
||||||
opsExecuted += g_System->CountPerOp();
|
opsExecuted += g_System->CountPerOp();
|
||||||
|
@ -347,7 +347,7 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Start (PC: %X)", PROGRAM_COUNTER);
|
WriteTrace(TraceRecompiler, TraceDebug, "Start (PC: %X)", PROGRAM_COUNTER);
|
||||||
|
|
||||||
uint32_t pAddr = 0;
|
uint32_t pAddr = 0;
|
||||||
if (!m_MMU.TranslateVaddr(PROGRAM_COUNTER, pAddr))
|
if (!m_MMU.VAddrToPAddr(PROGRAM_COUNTER, pAddr))
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
|
WriteTrace(TraceRecompiler, TraceError, "Failed to translate %X", PROGRAM_COUNTER);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -360,7 +360,7 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
for (CCompiledFunc * Func = iter->second; Func != nullptr; Func = Func->Next())
|
for (CCompiledFunc * Func = iter->second; Func != nullptr; Func = Func->Next())
|
||||||
{
|
{
|
||||||
uint32_t PAddr;
|
uint32_t PAddr;
|
||||||
if (m_MMU.TranslateVaddr(Func->MinPC(), PAddr))
|
if (m_MMU.VAddrToPAddr(Func->MinPC(), PAddr))
|
||||||
{
|
{
|
||||||
MD5Digest Hash;
|
MD5Digest Hash;
|
||||||
MD5(m_MMU.Rdram() + PAddr, (Func->MaxPC() - Func->MinPC()) + 4).get_digest(Hash);
|
MD5(m_MMU.Rdram() + PAddr, (Func->MaxPC() - Func->MinPC()) + 4).get_digest(Hash);
|
||||||
|
@ -376,7 +376,7 @@ CCompiledFunc * CRecompiler::CompileCode()
|
||||||
CheckRecompMem();
|
CheckRecompMem();
|
||||||
WriteTrace(TraceRecompiler, TraceDebug, "Compile Block-Start: Program Counter: %X pAddr: %X", PROGRAM_COUNTER, pAddr);
|
WriteTrace(TraceRecompiler, TraceDebug, "Compile Block-Start: Program Counter: %X pAddr: %X", PROGRAM_COUNTER, pAddr);
|
||||||
|
|
||||||
CCodeBlock CodeBlock(PROGRAM_COUNTER, *g_RecompPos);
|
CCodeBlock CodeBlock(m_MMU, PROGRAM_COUNTER, *g_RecompPos);
|
||||||
if (!CodeBlock.Compile())
|
if (!CodeBlock.Compile())
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -500,7 +500,7 @@ void CRecompiler::ClearRecompCode_Virt(uint32_t Address, int length, REMOVE_REAS
|
||||||
case FuncFind_PhysicalLookup:
|
case FuncFind_PhysicalLookup:
|
||||||
{
|
{
|
||||||
uint32_t pAddr = 0;
|
uint32_t pAddr = 0;
|
||||||
if (m_MMU.TranslateVaddr(Address, pAddr))
|
if (m_MMU.VAddrToPAddr(Address, pAddr))
|
||||||
{
|
{
|
||||||
ClearRecompCode_Phys(pAddr, length, Reason);
|
ClearRecompCode_Phys(pAddr, length, Reason);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ void CRecompiler::ResetMemoryStackPos()
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t pAddr = 0;
|
uint32_t pAddr = 0;
|
||||||
if (m_MMU.TranslateVaddr(m_Registers.m_GPR[29].UW[0], pAddr))
|
if (m_MMU.VAddrToPAddr(m_Registers.m_GPR[29].UW[0], pAddr))
|
||||||
{
|
{
|
||||||
m_MemoryStack = (uint32_t)(m_MMU.Rdram() + pAddr);
|
m_MemoryStack = (uint32_t)(m_MMU.Rdram() + pAddr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,15 @@ static void x86TestWriteBreakpoint64()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CX86RecompilerOps::CX86RecompilerOps(CMipsMemoryVM & MMU) :
|
||||||
|
m_MMU(MMU)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CX86RecompilerOps::~CX86RecompilerOps()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CX86RecompilerOps::PreCompileOpcode(void)
|
void CX86RecompilerOps::PreCompileOpcode(void)
|
||||||
{
|
{
|
||||||
if (m_PipelineStage != PIPELINE_STAGE_DELAY_SLOT_DONE)
|
if (m_PipelineStage != PIPELINE_STAGE_DELAY_SLOT_DONE)
|
||||||
|
@ -2606,7 +2615,7 @@ void CX86RecompilerOps::LUI()
|
||||||
x86Reg Reg = Map_MemoryStack(x86_Any, true, false);
|
x86Reg Reg = Map_MemoryStack(x86_Any, true, false);
|
||||||
uint32_t Address;
|
uint32_t Address;
|
||||||
|
|
||||||
g_TransVaddr->TranslateVaddr(((int16_t)m_Opcode.offset << 16), Address);
|
m_MMU.VAddrToPAddr(((int16_t)m_Opcode.offset << 16), Address);
|
||||||
if (Reg < 0)
|
if (Reg < 0)
|
||||||
{
|
{
|
||||||
MoveConstToVariable((uint32_t)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack");
|
MoveConstToVariable((uint32_t)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack");
|
||||||
|
@ -2766,7 +2775,7 @@ void CX86RecompilerOps::LB_KnownAddress(x86Reg Reg, uint32_t VAddr, bool SignExt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
MoveConstToX86reg(0, Reg);
|
MoveConstToX86reg(0, Reg);
|
||||||
CPU_Message("%s\nFailed to translate address %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address %08X", __FUNCTION__, VAddr);
|
||||||
|
@ -2839,7 +2848,7 @@ void CX86RecompilerOps::LH_KnownAddress(x86Reg Reg, uint32_t VAddr, bool SignExt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
MoveConstToX86reg(0, Reg);
|
MoveConstToX86reg(0, Reg);
|
||||||
CPU_Message("%s\nFailed to translate address %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address %08X", __FUNCTION__, VAddr);
|
||||||
|
@ -3205,7 +3214,7 @@ void CX86RecompilerOps::LW_KnownAddress(x86Reg Reg, uint32_t VAddr)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
@ -10387,7 +10396,7 @@ void CX86RecompilerOps::SB_Const(uint8_t Value, uint32_t VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("%s, \nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str()); }
|
if (ShowUnhandledMemory()) { g_Notify->DisplayError(stdstr_f("%s, \nFailed to translate address: %08X", __FUNCTION__, VAddr).c_str()); }
|
||||||
|
@ -10444,7 +10453,7 @@ void CX86RecompilerOps::SB_Register(x86Reg Reg, uint32_t VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory())
|
if (ShowUnhandledMemory())
|
||||||
|
@ -10502,7 +10511,7 @@ void CX86RecompilerOps::SH_Const(uint16_t Value, uint32_t VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory())
|
if (ShowUnhandledMemory())
|
||||||
|
@ -10562,7 +10571,7 @@ void CX86RecompilerOps::SH_Register(x86Reg Reg, uint32_t VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory())
|
if (ShowUnhandledMemory())
|
||||||
|
@ -10621,7 +10630,7 @@ void CX86RecompilerOps::SW_Const(uint32_t Value, uint32_t VAddr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory())
|
if (ShowUnhandledMemory())
|
||||||
|
@ -11201,7 +11210,7 @@ void CX86RecompilerOps::SW_Register(x86Reg Reg, uint32_t VAddr)
|
||||||
char VarName[100];
|
char VarName[100];
|
||||||
uint32_t PAddr;
|
uint32_t PAddr;
|
||||||
|
|
||||||
if (!g_TransVaddr->TranslateVaddr(VAddr, PAddr))
|
if (!m_MMU.VAddrToPAddr(VAddr, PAddr))
|
||||||
{
|
{
|
||||||
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
CPU_Message("%s\nFailed to translate address: %08X", __FUNCTION__, VAddr);
|
||||||
if (ShowUnhandledMemory())
|
if (ShowUnhandledMemory())
|
||||||
|
|
|
@ -25,6 +25,9 @@ class CX86RecompilerOps :
|
||||||
private CGameSettings
|
private CGameSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CX86RecompilerOps(CMipsMemoryVM & MMU);
|
||||||
|
~CX86RecompilerOps();
|
||||||
|
|
||||||
// Trap functions
|
// Trap functions
|
||||||
void Compile_TrapCompare(TRAP_COMPARE CompareType);
|
void Compile_TrapCompare(TRAP_COMPARE CompareType);
|
||||||
|
|
||||||
|
@ -351,6 +354,9 @@ public:
|
||||||
static uint32_t CompilePC() { return m_CompilePC; }
|
static uint32_t CompilePC() { return m_CompilePC; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CX86RecompilerOps(const CX86RecompilerOps&);
|
||||||
|
CX86RecompilerOps& operator=(const CX86RecompilerOps&);
|
||||||
|
|
||||||
void SB_Const(uint8_t Value, uint32_t Addr);
|
void SB_Const(uint8_t Value, uint32_t Addr);
|
||||||
void SB_Register(CX86Ops::x86Reg Reg, uint32_t Addr);
|
void SB_Register(CX86Ops::x86Reg Reg, uint32_t Addr);
|
||||||
void SH_Const(uint16_t Value, uint32_t Addr);
|
void SH_Const(uint16_t Value, uint32_t Addr);
|
||||||
|
@ -367,6 +373,7 @@ private:
|
||||||
void ResetMemoryStack();
|
void ResetMemoryStack();
|
||||||
|
|
||||||
EXIT_LIST m_ExitInfo;
|
EXIT_LIST m_ExitInfo;
|
||||||
|
CMipsMemoryVM & m_MMU;
|
||||||
static PIPELINE_STAGE m_PipelineStage;
|
static PIPELINE_STAGE m_PipelineStage;
|
||||||
static uint32_t m_CompilePC;
|
static uint32_t m_CompilePC;
|
||||||
static OPCODE m_Opcode;
|
static OPCODE m_Opcode;
|
||||||
|
|
|
@ -14,7 +14,6 @@ CN64Rom * g_Rom = nullptr; // The current ROM that this system is executing
|
||||||
CN64Rom * g_DDRom = nullptr; // 64DD IPL ROM
|
CN64Rom * g_DDRom = nullptr; // 64DD IPL ROM
|
||||||
CN64Disk * g_Disk = nullptr; // 64DD disk
|
CN64Disk * g_Disk = nullptr; // 64DD disk
|
||||||
CSystemTimer * g_SystemTimer = nullptr;
|
CSystemTimer * g_SystemTimer = nullptr;
|
||||||
CTransVaddr * g_TransVaddr = nullptr;
|
|
||||||
CSystemEvents * g_SystemEvents = nullptr;
|
CSystemEvents * g_SystemEvents = nullptr;
|
||||||
uint32_t * g_TLBLoadAddress = nullptr;
|
uint32_t * g_TLBLoadAddress = nullptr;
|
||||||
uint32_t * g_TLBStoreAddress = nullptr;
|
uint32_t * g_TLBStoreAddress = nullptr;
|
||||||
|
|
|
@ -33,9 +33,6 @@ extern CN64Disk * g_Disk; // 64DD disk
|
||||||
class CSystemTimer;
|
class CSystemTimer;
|
||||||
extern CSystemTimer * g_SystemTimer;
|
extern CSystemTimer * g_SystemTimer;
|
||||||
|
|
||||||
__interface CTransVaddr;
|
|
||||||
extern CTransVaddr * g_TransVaddr;
|
|
||||||
|
|
||||||
class CSystemEvents;
|
class CSystemEvents;
|
||||||
extern CSystemEvents * g_SystemEvents;
|
extern CSystemEvents * g_SystemEvents;
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ size_t CDebugMMU::ReadVirtual(uint32_t vaddr, size_t length, uint8_t* buffer)
|
||||||
for (nByte = 0; nByte < length; nByte++)
|
for (nByte = 0; nByte < length; nByte++)
|
||||||
{
|
{
|
||||||
uint32_t paddr;
|
uint32_t paddr;
|
||||||
if (!g_MMU || !g_MMU->TranslateVaddr(vaddr + nByte, paddr))
|
if (!g_MMU || !g_MMU->VAddrToPAddr(vaddr + nByte, paddr))
|
||||||
{
|
{
|
||||||
return nByte;
|
return nByte;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ size_t CDebugMMU::WriteVirtual(uint32_t vaddr, size_t length, uint8_t* buffer)
|
||||||
for (nByte = 0; nByte < length; nByte++)
|
for (nByte = 0; nByte < length; nByte++)
|
||||||
{
|
{
|
||||||
uint32_t paddr;
|
uint32_t paddr;
|
||||||
if (!g_MMU || !g_MMU->TranslateVaddr(vaddr + nByte, paddr))
|
if (!g_MMU || !g_MMU->VAddrToPAddr(vaddr + nByte, paddr))
|
||||||
{
|
{
|
||||||
return nByte;
|
return nByte;
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,7 +773,7 @@ LRESULT CDebugMemoryView::OnHxGetByteInfo(LPNMHDR lpNMHDR)
|
||||||
newByte->bkColor = BKCOLOR_DEFAULT;
|
newByte->bkColor = BKCOLOR_DEFAULT;
|
||||||
newByte->color = COLOR_DEFAULT;
|
newByte->color = COLOR_DEFAULT;
|
||||||
|
|
||||||
if (m_bVirtualMemory && (g_MMU == nullptr || !g_MMU->TranslateVaddr(address, paddress)))
|
if (m_bVirtualMemory && (g_MMU == nullptr || !g_MMU->VAddrToPAddr(address, paddress)))
|
||||||
{
|
{
|
||||||
newByte->bValid = false;
|
newByte->bValid = false;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -93,7 +93,7 @@ duk_ret_t ScriptAPI::js_mem_getblock(duk_context *ctx)
|
||||||
|
|
||||||
if (addr < 0x80000000 || addr >= 0xC0000000)
|
if (addr < 0x80000000 || addr >= 0xC0000000)
|
||||||
{
|
{
|
||||||
if (!g_MMU || !g_MMU->TranslateVaddr(addr, paddr))
|
if (!g_MMU || !g_MMU->VAddrToPAddr(addr, paddr))
|
||||||
{
|
{
|
||||||
return ThrowMemoryError(ctx, addr);
|
return ThrowMemoryError(ctx, addr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,7 @@ LRESULT CEnhancementUI::OnPopupDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RefreshList();
|
RefreshList();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CEnhancementUI::OnEnhancementListRClicked(NMHDR* pNMHDR)
|
LRESULT CEnhancementUI::OnEnhancementListRClicked(NMHDR* pNMHDR)
|
||||||
|
|
Loading…
Reference in New Issue