Skip to content
Permalink
Browse files

Jit64: Refactor WriteIdleExit helper.

  • Loading branch information...
degasus committed Apr 16, 2019
1 parent b8b4b4a commit 55abe1a08573e063f4751257c13ee94aa998e505
@@ -646,6 +646,15 @@ void Jit64::WriteRfiExitDestInRSCRATCH()
JMP(asm_routines.dispatcher, true);
}

void Jit64::WriteIdleExit(u32 destination)
{
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(destination));
WriteExceptionExit();
}

void Jit64::WriteExceptionExit()
{
Cleanup();
@@ -84,6 +84,7 @@ class Jit64 : public JitBase, public QuantizedMemoryRoutines
void WriteExceptionExit();
void WriteExternalExceptionExit();
void WriteRfiExitDestInRSCRATCH();
void WriteIdleExit(u32 destination);
bool Cleanup();

void GenerateConstantOverflow(bool overflow);
@@ -93,11 +93,7 @@ void Jit64::bx(UGeckoInstruction inst)
#endif
if (js.op->branchIsIdleLoop)
{
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(js.op->branchTo));
WriteExceptionExit();
WriteIdleExit(js.op->branchTo);
}
else
{
@@ -159,11 +155,7 @@ void Jit64::bcx(UGeckoInstruction inst)

if (js.op->branchIsIdleLoop)
{
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(js.op->branchTo));
WriteExceptionExit();
WriteIdleExit(js.op->branchTo);
}
else
{
@@ -288,11 +280,7 @@ void Jit64::bclrx(UGeckoInstruction inst)

if (js.op->branchIsIdleLoop)
{
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(js.op->branchTo));
WriteExceptionExit();
WriteIdleExit(js.op->branchTo);
}
else
{
@@ -368,11 +368,7 @@ void Jit64::DoMergedBranch()
if (next.LK)
MOV(32, PPCSTATE(spr[SPR_LR]), Imm32(nextPC + 4));

ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(js.op[1].branchTo));
WriteExceptionExit();
WriteIdleExit(js.op[1].branchTo);
}
else if (next.OPCD == 16) // bcx
{

0 comments on commit 55abe1a

Please sign in to comment.
You can’t perform that action at this time.