mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 05:17:44 -07:00
Split 'IsRAMAddress' method into 'IsEffectiveRAMAddress' and 'IsPhysicalRAMAddress' methods
This commit is contained in:
parent
4ff5ff2772
commit
c1ff466e16
@ -938,16 +938,14 @@ bool MMU::IsOptimizableRAMAddress(const u32 address, const u32 access_size) cons
|
||||
}
|
||||
|
||||
template <XCheckTLBFlag flag>
|
||||
bool MMU::IsRAMAddress(u32 address, bool translate)
|
||||
{
|
||||
if (translate)
|
||||
bool MMU::IsEffectiveRAMAddress(u32 address)
|
||||
{
|
||||
auto translate_address = TranslateAddress<flag>(address);
|
||||
if (!translate_address.Success())
|
||||
return false;
|
||||
address = translate_address.address;
|
||||
return translate_address.Success() && IsPhysicalRAMAddress(translate_address.address);
|
||||
}
|
||||
|
||||
bool MMU::IsPhysicalRAMAddress(const u32 address) const
|
||||
{
|
||||
u32 segment = address >> 28;
|
||||
if (m_memory.GetRAM() && segment == 0x0 && (address & 0x0FFFFFFF) < m_memory.GetRamSizeReal())
|
||||
{
|
||||
@ -977,13 +975,14 @@ bool MMU::HostIsRAMAddress(const Core::CPUThreadGuard& guard, u32 address,
|
||||
switch (space)
|
||||
{
|
||||
case RequestedAddressSpace::Effective:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, mmu.m_ppc_state.msr.DR);
|
||||
return mmu.m_ppc_state.msr.DR ? mmu.IsEffectiveRAMAddress<XCheckTLBFlag::NoException>(address) :
|
||||
mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Physical:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, false);
|
||||
return mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Virtual:
|
||||
if (!mmu.m_ppc_state.msr.DR)
|
||||
return false;
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, true);
|
||||
return mmu.IsEffectiveRAMAddress<XCheckTLBFlag::NoException>(address);
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
@ -1001,13 +1000,15 @@ bool MMU::HostIsInstructionRAMAddress(const Core::CPUThreadGuard& guard, u32 add
|
||||
switch (space)
|
||||
{
|
||||
case RequestedAddressSpace::Effective:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, mmu.m_ppc_state.msr.IR);
|
||||
return mmu.m_ppc_state.msr.IR ?
|
||||
mmu.IsEffectiveRAMAddress<XCheckTLBFlag::OpcodeNoException>(address) :
|
||||
mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Physical:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, false);
|
||||
return mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Virtual:
|
||||
if (!mmu.m_ppc_state.msr.IR)
|
||||
return false;
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, true);
|
||||
return mmu.IsEffectiveRAMAddress<XCheckTLBFlag::OpcodeNoException>(address);
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
|
@ -310,7 +310,8 @@ private:
|
||||
template <XCheckTLBFlag flag, bool never_translate = false>
|
||||
void WriteToHardware(u32 em_address, const u32 data, const u32 size);
|
||||
template <XCheckTLBFlag flag>
|
||||
bool IsRAMAddress(u32 address, bool translate);
|
||||
bool IsEffectiveRAMAddress(u32 address);
|
||||
bool IsPhysicalRAMAddress(u32 address) const;
|
||||
|
||||
template <typename T>
|
||||
static std::optional<ReadResult<T>> HostTryReadUX(const Core::CPUThreadGuard& guard,
|
||||
|
Loading…
Reference in New Issue
Block a user