Merge pull request #9999 from JosJuice/jit-dcbx-masking

Jit: Re-add dcbx masking
This commit is contained in:
Mai M 2021-08-06 09:35:17 -04:00 committed by GitHub
commit 857d1c399d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 10 deletions

View File

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

View File

@ -274,9 +274,7 @@ void Jit64::dcbx(UGeckoInstruction inst)
registersInUse[X64Reg(effective_address)] = false; registersInUse[X64Reg(effective_address)] = false;
ABI_PushRegistersAndAdjustStack(registersInUse, 0); ABI_PushRegistersAndAdjustStack(registersInUse, 0);
MOV(32, R(ABI_PARAM1), R(effective_address)); MOV(32, R(ABI_PARAM1), R(effective_address));
MOV(32, R(ABI_PARAM2), Imm32(32)); ABI_CallFunction(JitInterface::InvalidateICacheLine);
XOR(32, R(ABI_PARAM3), R(ABI_PARAM3));
ABI_CallFunction(JitInterface::InvalidateICache);
ABI_PopRegistersAndAdjustStack(registersInUse, 0); ABI_PopRegistersAndAdjustStack(registersInUse, 0);
asm_routines.ResetStack(*this); asm_routines.ResetStack(*this);

View File

@ -602,10 +602,8 @@ void JitArm64::dcbx(UGeckoInstruction inst)
ABI_PushRegisters(gprs_to_push); ABI_PushRegisters(gprs_to_push);
m_float_emit.ABI_PushRegisters(fprs_to_push, ARM64Reg::X30); m_float_emit.ABI_PushRegisters(fprs_to_push, ARM64Reg::X30);
MOVP2R(ARM64Reg::X8, &JitInterface::InvalidateICache); // W0 (the function call argument) was already set earlier
// W0 was already set earlier MOVP2R(ARM64Reg::X8, &JitInterface::InvalidateICacheLine);
MOVI2R(ARM64Reg::W1, 32);
MOVI2R(ARM64Reg::W2, 0);
BLR(ARM64Reg::X8); BLR(ARM64Reg::X8);
m_float_emit.ABI_PopRegisters(fprs_to_push, ARM64Reg::X30); m_float_emit.ABI_PopRegisters(fprs_to_push, ARM64Reg::X30);

View File

@ -224,6 +224,11 @@ void InvalidateICache(u32 address, u32 size, bool forced)
g_jit->GetBlockCache()->InvalidateICache(address, size, forced); g_jit->GetBlockCache()->InvalidateICache(address, size, forced);
} }
void InvalidateICacheLine(u32 address)
{
InvalidateICache(address & ~0x1f, 32, false);
}
void CompileExceptionCheck(ExceptionType type) void CompileExceptionCheck(ExceptionType type)
{ {
if (!g_jit) if (!g_jit)

View File

@ -62,6 +62,7 @@ void ClearSafe();
// If "forced" is true, a recompile is being requested on code that hasn't been modified. // 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 InvalidateICache(u32 address, u32 size, bool forced);
void InvalidateICacheLine(u32 address);
void CompileExceptionCheck(ExceptionType type); void CompileExceptionCheck(ExceptionType type);