Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9995 from AdmiralCurtiss/dcbx-virtual-address
Jit64: Always pass effective address to InvalidateICache() in dcbx.
  • Loading branch information
leoetlino committed Aug 4, 2021
2 parents 234859e + 0e76dab commit 28b7e2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
Expand Up @@ -239,15 +239,17 @@ void Jit64::dcbx(UGeckoInstruction inst)
RCOpArg Ra = inst.RA ? gpr.Use(inst.RA, RCMode::Read) : RCOpArg::Imm32(0);
RCOpArg Rb = gpr.Use(inst.RB, RCMode::Read);
RCX64Reg tmp = gpr.Scratch();
RegCache::Realize(Ra, Rb, tmp);
RCX64Reg effective_address = gpr.Scratch();
RegCache::Realize(Ra, Rb, tmp, effective_address);

// Translate effective address to physical address.
MOV_sum(32, value, Ra, Rb);
FixupBranch bat_lookup_failed;
MOV(32, R(effective_address), R(value));
if (MSR.IR)
{
MOV(32, R(addr), R(value));
bat_lookup_failed = BATAddressLookup(value, tmp, PowerPC::ibat_table.data());
MOV(32, R(addr), R(effective_address));
AND(32, R(addr), Imm32(0x0001ffff));
AND(32, R(value), Imm32(0xfffe0000));
OR(32, R(value), R(addr));
Expand All @@ -264,14 +266,14 @@ void Jit64::dcbx(UGeckoInstruction inst)

SwitchToFarCode();
SetJumpTarget(invalidate_needed);
SHL(32, R(addr), Imm8(5));
if (MSR.IR)
SetJumpTarget(bat_lookup_failed);

BitSet32 registersInUse = CallerSavedRegistersInUse();
registersInUse[X64Reg(tmp)] = false;
registersInUse[X64Reg(effective_address)] = false;
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
MOV(32, R(ABI_PARAM1), R(addr));
MOV(32, R(ABI_PARAM1), R(effective_address));
MOV(32, R(ABI_PARAM2), Imm32(32));
XOR(32, R(ABI_PARAM3), R(ABI_PARAM3));
ABI_CallFunction(JitInterface::InvalidateICache);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp
Expand Up @@ -98,7 +98,7 @@ FixupBranch EmuCodeBlock::BATAddressLookup(X64Reg addr, X64Reg tmp, const void*
MOV(32, R(addr), MComplex(tmp, addr, SCALE_4, 0));
BT(32, R(addr), Imm8(IntLog2(PowerPC::BAT_MAPPED_BIT)));

return J_CC(CC_Z, m_far_code.Enabled());
return J_CC(CC_NC, m_far_code.Enabled());
}

FixupBranch EmuCodeBlock::CheckIfSafeAddress(const OpArg& reg_value, X64Reg reg_addr,
Expand Down

0 comments on commit 28b7e2e

Please sign in to comment.