mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #12489 from JosJuice/optimizable-access-size
PowerPC: Add access size parameter to MMU::IsOptimizableRAMAddress
This commit is contained in:
commit
bca5b10faf
@ -441,7 +441,7 @@ void EmuCodeBlock::SafeLoadToRegImmediate(X64Reg reg_value, u32 address, int acc
|
||||
BitSet32 registersInUse, bool signExtend)
|
||||
{
|
||||
// If the address is known to be RAM, just load it directly.
|
||||
if (m_jit.jo.fastmem_arena && m_jit.m_mmu.IsOptimizableRAMAddress(address))
|
||||
if (m_jit.jo.fastmem_arena && m_jit.m_mmu.IsOptimizableRAMAddress(address, accessSize))
|
||||
{
|
||||
UnsafeLoadToReg(reg_value, Imm32(address), accessSize, 0, signExtend);
|
||||
return;
|
||||
@ -656,7 +656,7 @@ bool EmuCodeBlock::WriteToConstAddress(int accessSize, OpArg arg, u32 address,
|
||||
m_jit.js.fifoBytesSinceCheck += accessSize >> 3;
|
||||
return false;
|
||||
}
|
||||
else if (m_jit.jo.fastmem_arena && m_jit.m_mmu.IsOptimizableRAMAddress(address))
|
||||
else if (m_jit.jo.fastmem_arena && m_jit.m_mmu.IsOptimizableRAMAddress(address, accessSize))
|
||||
{
|
||||
WriteToConstRamAddress(accessSize, arg, address);
|
||||
return false;
|
||||
|
@ -136,7 +136,7 @@ void JitArm64::SafeLoadToReg(u32 dest, s32 addr, s32 offsetReg, u32 flags, s32 o
|
||||
if (is_immediate)
|
||||
mmio_address = m_mmu.IsOptimizableMMIOAccess(imm_addr, access_size);
|
||||
|
||||
if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr))
|
||||
if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr, access_size))
|
||||
{
|
||||
set_addr_reg_if_needed();
|
||||
EmitBackpatchRoutine(flags, MemAccessMode::AlwaysFastAccess, dest_reg, XA, regs_in_use,
|
||||
@ -308,7 +308,7 @@ void JitArm64::SafeStoreFromReg(s32 dest, u32 value, s32 regOffset, u32 flags, s
|
||||
|
||||
js.fifoBytesSinceCheck += accessSize >> 3;
|
||||
}
|
||||
else if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr))
|
||||
else if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr, access_size))
|
||||
{
|
||||
set_addr_reg_if_needed();
|
||||
EmitBackpatchRoutine(flags, MemAccessMode::AlwaysFastAccess, RS, XA, regs_in_use, fprs_in_use);
|
||||
|
@ -174,7 +174,7 @@ void JitArm64::lfXX(UGeckoInstruction inst)
|
||||
if (!jo.memcheck)
|
||||
fprs_in_use[DecodeReg(VD)] = 0;
|
||||
|
||||
if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr))
|
||||
if (is_immediate && m_mmu.IsOptimizableRAMAddress(imm_addr, BackPatchInfo::GetFlagSize(flags)))
|
||||
{
|
||||
EmitBackpatchRoutine(flags, MemAccessMode::AlwaysFastAccess, VD, XA, regs_in_use, fprs_in_use);
|
||||
}
|
||||
@ -399,7 +399,7 @@ void JitArm64::stfXX(UGeckoInstruction inst)
|
||||
STR(IndexType::Unsigned, ARM64Reg::X2, PPC_REG, PPCSTATE_OFF(gather_pipe_ptr));
|
||||
js.fifoBytesSinceCheck += accessSize >> 3;
|
||||
}
|
||||
else if (m_mmu.IsOptimizableRAMAddress(imm_addr))
|
||||
else if (m_mmu.IsOptimizableRAMAddress(imm_addr, BackPatchInfo::GetFlagSize(flags)))
|
||||
{
|
||||
set_addr_reg_if_needed();
|
||||
EmitBackpatchRoutine(flags, MemAccessMode::AlwaysFastAccess, V0, XA, regs_in_use,
|
||||
|
@ -915,7 +915,7 @@ std::optional<ReadResult<std::string>> MMU::HostTryReadString(const Core::CPUThr
|
||||
return ReadResult<std::string>(c->translated, std::move(s));
|
||||
}
|
||||
|
||||
bool MMU::IsOptimizableRAMAddress(const u32 address) const
|
||||
bool MMU::IsOptimizableRAMAddress(const u32 address, const u32 access_size) const
|
||||
{
|
||||
if (m_power_pc.GetMemChecks().HasAny())
|
||||
return false;
|
||||
@ -926,12 +926,12 @@ bool MMU::IsOptimizableRAMAddress(const u32 address) const
|
||||
if (m_ppc_state.m_enable_dcache)
|
||||
return false;
|
||||
|
||||
// TODO: This API needs to take an access size
|
||||
//
|
||||
// We store whether an access can be optimized to an unchecked access
|
||||
// in dbat_table.
|
||||
u32 bat_result = m_dbat_table[address >> BAT_INDEX_SHIFT];
|
||||
return (bat_result & BAT_PHYSICAL_BIT) != 0;
|
||||
const u32 last_byte_address = address + (access_size >> 3) - 1;
|
||||
const u32 bat_result_1 = m_dbat_table[address >> BAT_INDEX_SHIFT];
|
||||
const u32 bat_result_2 = m_dbat_table[last_byte_address >> BAT_INDEX_SHIFT];
|
||||
return (bat_result_1 & bat_result_2 & BAT_PHYSICAL_BIT) != 0;
|
||||
}
|
||||
|
||||
template <XCheckTLBFlag flag>
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
// Result changes based on the BAT registers and MSR.DR. Returns whether
|
||||
// it's safe to optimize a read or write to this address to an unguarded
|
||||
// memory access. Does not consider page tables.
|
||||
bool IsOptimizableRAMAddress(u32 address) const;
|
||||
bool IsOptimizableRAMAddress(u32 address, u32 access_size) const;
|
||||
u32 IsOptimizableMMIOAccess(u32 address, u32 access_size) const;
|
||||
bool IsOptimizableGatherPipeWrite(u32 address) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user