Skip to content

Commit

Permalink
Jit64: implement HID0 case of mtspr
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilka committed Aug 17, 2015
1 parent 1b2074e commit 2be7f62
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 2be7f62

Please sign in to comment.