From 1c78c7b864d4b7b1126fbe0febec5309314921f4 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 17 Aug 2015 13:31:57 +0200 Subject: [PATCH] Jit64: implement HID0 case of mtspr --- .../PowerPC/Jit64/Jit_SystemRegisters.cpp | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index d781a17a3a..7a7d01ad2c 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); + BTR(32, gpr.R(d), Imm8(31 - 20)); // ICFI + MOV(32, PPCSTATE(spr[iIndex]), gpr.R(d)); + 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); }