Skip to content

Commit

Permalink
Merge pull request #9999 from JosJuice/jit-dcbx-masking
Browse files Browse the repository at this point in the history
Jit: Re-add dcbx masking
  • Loading branch information
lioncash committed Aug 6, 2021
2 parents 37115f0 + 125af42 commit 857d1c3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
Expand Up @@ -443,7 +443,7 @@ void Interpreter::dcbf(UGeckoInstruction inst)
// the lack of precise L1 icache emulation in the JIT. (Portable software
// should use icbi consistently, but games aren't portable.)
const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst);
JitInterface::InvalidateICache(address & ~0x1f, 32, false);
JitInterface::InvalidateICacheLine(address);
}

void Interpreter::dcbi(UGeckoInstruction inst)
Expand All @@ -461,7 +461,7 @@ void Interpreter::dcbi(UGeckoInstruction inst)
// the lack of precise L1 icache emulation in the JIT. (Portable software
// should use icbi consistently, but games aren't portable.)
const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst);
JitInterface::InvalidateICache(address & ~0x1f, 32, false);
JitInterface::InvalidateICacheLine(address);
}

void Interpreter::dcbst(UGeckoInstruction inst)
Expand All @@ -473,7 +473,7 @@ void Interpreter::dcbst(UGeckoInstruction inst)
// the lack of precise L1 icache emulation in the JIT. (Portable software
// should use icbi consistently, but games aren't portable.)
const u32 address = Helper_Get_EA_X(PowerPC::ppcState, inst);
JitInterface::InvalidateICache(address & ~0x1f, 32, false);
JitInterface::InvalidateICacheLine(address);
}

void Interpreter::dcbt(UGeckoInstruction inst)
Expand Down
4 changes: 1 addition & 3 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
Expand Up @@ -274,9 +274,7 @@ void Jit64::dcbx(UGeckoInstruction inst)
registersInUse[X64Reg(effective_address)] = false;
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
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);
ABI_CallFunction(JitInterface::InvalidateICacheLine);
ABI_PopRegistersAndAdjustStack(registersInUse, 0);
asm_routines.ResetStack(*this);

Expand Down
6 changes: 2 additions & 4 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp
Expand Up @@ -602,10 +602,8 @@ void JitArm64::dcbx(UGeckoInstruction inst)
ABI_PushRegisters(gprs_to_push);
m_float_emit.ABI_PushRegisters(fprs_to_push, ARM64Reg::X30);

MOVP2R(ARM64Reg::X8, &JitInterface::InvalidateICache);
// W0 was already set earlier
MOVI2R(ARM64Reg::W1, 32);
MOVI2R(ARM64Reg::W2, 0);
// W0 (the function call argument) was already set earlier
MOVP2R(ARM64Reg::X8, &JitInterface::InvalidateICacheLine);
BLR(ARM64Reg::X8);

m_float_emit.ABI_PopRegisters(fprs_to_push, ARM64Reg::X30);
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/Core/PowerPC/JitInterface.cpp
Expand Up @@ -224,6 +224,11 @@ void InvalidateICache(u32 address, u32 size, bool forced)
g_jit->GetBlockCache()->InvalidateICache(address, size, forced);
}

void InvalidateICacheLine(u32 address)
{
InvalidateICache(address & ~0x1f, 32, false);
}

void CompileExceptionCheck(ExceptionType type)
{
if (!g_jit)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/PowerPC/JitInterface.h
Expand Up @@ -62,6 +62,7 @@ void ClearSafe();

// If "forced" is true, a recompile is being requested on code that hasn't been modified.
void InvalidateICache(u32 address, u32 size, bool forced);
void InvalidateICacheLine(u32 address);

void CompileExceptionCheck(ExceptionType type);

Expand Down

0 comments on commit 857d1c3

Please sign in to comment.