diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index d781a17a3a7f..7326c270b169 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -175,6 +175,11 @@ FixupBranch Jit64::JumpIfCRFieldBit(int field, int bit, bool jump_if_set) return FixupBranch(); } +static void DoICacheReset() +{ + PowerPC::ppcState.iCache.Reset(); +} + void Jit64::mtspr(UGeckoInstruction inst) { INSTRUCTION_START @@ -193,13 +198,9 @@ void Jit64::mtspr(UGeckoInstruction inst) case SPR_SRR0: case SPR_SRR1: - // These are safe to do the easy way, see the bottom of this function. - break; case SPR_LR: case SPR_CTR: - // These are safe to do the easy way, see the bottom of this function. - break; case SPR_GQR0: case SPR_GQR0 + 1: @@ -230,6 +231,20 @@ void Jit64::mtspr(UGeckoInstruction inst) gpr.UnlockAll(); return; + case SPR_HID0: + { + gpr.BindToRegister(d, true, false); + MOV(32, PPCSTATE(spr[iIndex]), gpr.R(d)); + BTR(32, gpr.R(d), Imm8(31 - 20)); // ICFI + FixupBranch dont_reset_icache = J_CC(CC_NC); + BitSet32 regs = CallerSavedRegistersInUse(); + ABI_PushRegistersAndAdjustStack(regs, 0); + ABI_CallFunction((void*)DoICacheReset); + ABI_PopRegistersAndAdjustStack(regs, 0); + SetJumpTarget(dont_reset_icache); + break; + } + default: FALLBACK_IF(true); }