mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-01 15:16:22 +00:00
Make address translation respect the CPU translation mode.
The PowerPC CPU has bits in MSR (DR and IR) which control whether addresses are translated. We should respect these instead of mixing physical addresses and translated addresses into the same address space. This is mostly mass-renaming calls to memory accesses APIs from places which expect address translation to use a different version from those which do not expect address translation. This does very little on its own, but it's the first step to a correct BAT implementation.
This commit is contained in:
parent
d9988ee9b5
commit
ac54c6a4e2
59 changed files with 816 additions and 617 deletions
|
@ -39,27 +39,27 @@ void AddAutoBreakpoints()
|
|||
// Returns true if the address is not a valid RAM address or NULL.
|
||||
static bool IsStackBottom(u32 addr)
|
||||
{
|
||||
return !addr || !Memory::IsRAMAddress(addr);
|
||||
return !addr || !PowerPC::HostIsRAMAddress(addr);
|
||||
}
|
||||
|
||||
static void WalkTheStack(const std::function<void(u32)>& stack_step)
|
||||
{
|
||||
if (!IsStackBottom(PowerPC::ppcState.gpr[1]))
|
||||
{
|
||||
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
|
||||
u32 addr = PowerPC::HostRead_U32(PowerPC::ppcState.gpr[1]); // SP
|
||||
|
||||
// Walk the stack chain
|
||||
for (int count = 0;
|
||||
!IsStackBottom(addr + 4) && (count++ < 20);
|
||||
++count)
|
||||
{
|
||||
u32 func_addr = Memory::ReadUnchecked_U32(addr + 4);
|
||||
u32 func_addr = PowerPC::HostRead_U32(addr + 4);
|
||||
stack_step(func_addr);
|
||||
|
||||
if (IsStackBottom(addr))
|
||||
break;
|
||||
|
||||
addr = Memory::ReadUnchecked_U32(addr);
|
||||
addr = PowerPC::HostRead_U32(addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static void WalkTheStack(const std::function<void(u32)>& stack_step)
|
|||
// instead of "pointing ahead"
|
||||
bool GetCallstack(std::vector<CallstackEntry> &output)
|
||||
{
|
||||
if (!Core::IsRunning() || !Memory::IsRAMAddress(PowerPC::ppcState.gpr[1]))
|
||||
if (!Core::IsRunning() || !PowerPC::HostIsRAMAddress(PowerPC::ppcState.gpr[1]))
|
||||
return false;
|
||||
|
||||
if (LR == 0)
|
||||
|
|
|
@ -19,26 +19,22 @@
|
|||
|
||||
std::string PPCDebugInterface::Disassemble(unsigned int address)
|
||||
{
|
||||
// Memory::ReadUnchecked_U32 seemed to crash on shutdown
|
||||
// PowerPC::HostRead_U32 seemed to crash on shutdown
|
||||
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
|
||||
return "";
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
if (Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
if (!Memory::IsRAMAddress(address, true, true))
|
||||
if (!PowerPC::HostIsRAMAddress(address))
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || !((address & JIT_ICACHE_VMEM_BIT) &&
|
||||
Memory::TranslateAddress<Memory::FLAG_NO_EXCEPTION>(address)))
|
||||
{
|
||||
return "(No RAM here)";
|
||||
}
|
||||
return "(No RAM here)";
|
||||
}
|
||||
|
||||
u32 op = Memory::Read_Instruction(address);
|
||||
u32 op = PowerPC::HostRead_Instruction(address);
|
||||
std::string disasm = GekkoDisassembler::Disassemble(op, address);
|
||||
|
||||
UGeckoInstruction inst;
|
||||
inst.hex = Memory::ReadUnchecked_U32(address);
|
||||
inst.hex = PowerPC::HostRead_U32(address);
|
||||
|
||||
if (inst.OPCD == 1)
|
||||
{
|
||||
|
@ -57,7 +53,7 @@ void PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address, cha
|
|||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
if (memory || Memory::IsRAMAddress(address, true, true))
|
||||
if (memory || PowerPC::HostIsRAMAddress(address))
|
||||
{
|
||||
snprintf(dest, max_size, "%08X%s", ReadExtraMemory(memory, address), memory ? " (ARAM)" : "");
|
||||
}
|
||||
|
@ -74,7 +70,7 @@ void PPCDebugInterface::GetRawMemoryString(int memory, unsigned int address, cha
|
|||
|
||||
unsigned int PPCDebugInterface::ReadMemory(unsigned int address)
|
||||
{
|
||||
return Memory::ReadUnchecked_U32(address);
|
||||
return PowerPC::HostRead_U32(address);
|
||||
}
|
||||
|
||||
unsigned int PPCDebugInterface::ReadExtraMemory(int memory, unsigned int address)
|
||||
|
@ -82,7 +78,7 @@ unsigned int PPCDebugInterface::ReadExtraMemory(int memory, unsigned int address
|
|||
switch (memory)
|
||||
{
|
||||
case 0:
|
||||
return Memory::ReadUnchecked_U32(address);
|
||||
return PowerPC::HostRead_U32(address);
|
||||
case 1:
|
||||
return (DSP::ReadARAM(address) << 24) |
|
||||
(DSP::ReadARAM(address + 1) << 16) |
|
||||
|
@ -95,7 +91,7 @@ unsigned int PPCDebugInterface::ReadExtraMemory(int memory, unsigned int address
|
|||
|
||||
unsigned int PPCDebugInterface::ReadInstruction(unsigned int address)
|
||||
{
|
||||
return Memory::Read_Instruction(address);
|
||||
return PowerPC::HostRead_Instruction(address);
|
||||
}
|
||||
|
||||
bool PPCDebugInterface::IsAlive()
|
||||
|
@ -170,7 +166,7 @@ void PPCDebugInterface::ToggleMemCheck(unsigned int address)
|
|||
|
||||
void PPCDebugInterface::InsertBLR(unsigned int address, unsigned int value)
|
||||
{
|
||||
Memory::Write_U32(value, address);
|
||||
PowerPC::HostWrite_U32(value, address);
|
||||
}
|
||||
|
||||
void PPCDebugInterface::BreakNow()
|
||||
|
@ -184,7 +180,9 @@ void PPCDebugInterface::BreakNow()
|
|||
// -------------
|
||||
int PPCDebugInterface::GetColor(unsigned int address)
|
||||
{
|
||||
if (!Memory::IsRAMAddress(address, true, true))
|
||||
if (!IsAlive())
|
||||
return 0xFFFFFF;
|
||||
if (!PowerPC::HostIsRAMAddress(address))
|
||||
return 0xeeeeee;
|
||||
static const int colors[6] =
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue