CPU/Recompiler: Don't try fastmem for RAM mirrors

This commit is contained in:
Connor McLaughlin 2020-10-26 22:07:52 +10:00
parent 875b0b91f1
commit 7f795d25aa
2 changed files with 20 additions and 11 deletions

View File

@ -314,28 +314,31 @@ void UpdateFastmemViews(bool enabled, bool isolate_cache)
{
// KUSEG - cached
MapRAM(0x00000000, !isolate_cache);
//MapRAM(0x00200000, !isolate_cache);
//MapRAM(0x00400000, !isolate_cache);
//MapRAM(0x00600000, !isolate_cache);
// MapRAM(0x00200000, !isolate_cache);
// MapRAM(0x00400000, !isolate_cache);
// MapRAM(0x00600000, !isolate_cache);
// KSEG0 - cached
MapRAM(0x80000000, !isolate_cache);
//MapRAM(0x80200000, !isolate_cache);
//MapRAM(0x80400000, !isolate_cache);
//MapRAM(0x80600000, !isolate_cache);
// MapRAM(0x80200000, !isolate_cache);
// MapRAM(0x80400000, !isolate_cache);
// MapRAM(0x80600000, !isolate_cache);
}
// KSEG1 - uncached
MapRAM(0xA0000000, true);
//MapRAM(0xA0200000, true);
//MapRAM(0xA0400000, true);
//MapRAM(0xA0600000, true);
// MapRAM(0xA0200000, true);
// MapRAM(0xA0400000, true);
// MapRAM(0xA0600000, true);
}
bool CanUseFastmemForAddress(VirtualMemoryAddress address)
{
const PhysicalMemoryAddress paddr = address & CPU::PHYSICAL_MEMORY_ADDRESS_MASK;
return IsRAMAddress(paddr);
// Currently since we don't map the mirrors, don't use fastmem for them.
// This is because the swapping of page code bits for SMC is too expensive.
return (paddr < RAM_SIZE);
}
bool IsRAMCodePage(u32 index)

View File

@ -42,9 +42,15 @@ Value CodeGenerator::EmitLoadGuestMemory(const CodeBlockInstruction& cbi, const
Value result = m_register_cache.AllocateScratch(size);
if (g_settings.IsUsingFastmem() && Bus::IsRAMAddress(static_cast<u32>(address.constant_value)))
EmitLoadGuestRAMFastmem(address, size, result);
{
// have to mask away the high bits for mirrors, since we don't map them in fastmem
EmitLoadGuestRAMFastmem(Value::FromConstantU32(static_cast<u32>(address.constant_value) & Bus::RAM_MASK), size,
result);
}
else
{
EmitLoadGlobal(result.GetHostRegister(), size, ptr);
}
m_delayed_cycles_add += read_ticks;
return result;