Use WriteExceptionExit and implement the change for JitIL

This commit is contained in:
Pierre Bourdon 2012-06-16 14:38:48 +02:00
parent da4141aa9f
commit e1ddbdd214
6 changed files with 11 additions and 9 deletions

View File

@ -300,15 +300,13 @@ void Jit64::Cleanup()
ABI_CallFunctionCCC((void *)&PowerPC::UpdatePerformanceMonitor, js.downcountAmount, jit->js.numLoadStoreInst, jit->js.numFloatingPointInst);
}
void Jit64::WriteExit(u32 destination, int exit_num, bool force_ee_check)
void Jit64::WriteExit(u32 destination, int exit_num)
{
Cleanup();
// External exceptions are checked when the following instruction sets the <= 0 flag.
// If we need to force the check, execute a useless SUB EAX, EAX
SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount));
if (force_ee_check)
SUB(32, R(EAX), R(EAX));
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
@ -317,7 +315,7 @@ void Jit64::WriteExit(u32 destination, int exit_num, bool force_ee_check)
// Link opportunity!
int block = blocks.GetBlockNumberFromStartAddress(destination);
if (!force_ee_check && block >= 0 && jo.enableBlocklink)
if (block >= 0 && jo.enableBlocklink)
{
// It exists! Joy of joy!
JMP(blocks.GetBlock(block)->checkedEntry, true);

View File

@ -112,7 +112,7 @@ public:
// Utilities for use by opcodes
void WriteExit(u32 destination, int exit_num, bool force_ee_check = false);
void WriteExit(u32 destination, int exit_num);
void WriteExitDestInEAX();
void WriteExceptionExit();
void WriteExternalExceptionExit();

View File

@ -125,7 +125,8 @@ void Jit64::mtmsr(UGeckoInstruction inst)
// Force an external exception when going out of mtmsr in order to check
// immediately for interrupts that were delayed because of MSR.EE=0.
WriteExit(js.compilerPC + 4, 0, true);
MOV(32, M(&PC), Imm32(js.compilerPC + 4));
WriteExceptionExit();
js.firstFPInstructionFound = false;
}

View File

@ -276,8 +276,8 @@ public:
InstLoc EmitLoadMSR() {
return FoldZeroOp(LoadMSR, 0);
}
InstLoc EmitStoreMSR(InstLoc val) {
return FoldUOp(StoreMSR, val);
InstLoc EmitStoreMSR(InstLoc val, InstLoc pc) {
return FoldBiOp(StoreMSR, val, pc);
}
InstLoc EmitStoreFPRF(InstLoc value) {
return FoldUOp(StoreFPRF, value);

View File

@ -994,8 +994,11 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, bool UseProfile, bool Mak
break;
}
case StoreMSR: {
unsigned InstLoc = ibuild->GetImmValue(getOp2(I));
regStoreInstToConstLoc(RI, 32, getOp1(I), &MSR);
regNormalRegClear(RI, I);
Jit->MOV(32, M(&PC), Imm32(InstLoc + 4));
Jit->WriteExceptionExit();
break;
}
case StoreGQR: {

View File

@ -106,7 +106,7 @@ void JitIL::mfspr(UGeckoInstruction inst)
// --------------
void JitIL::mtmsr(UGeckoInstruction inst)
{
ibuild.EmitStoreMSR(ibuild.EmitLoadGReg(inst.RS));
ibuild.EmitStoreMSR(ibuild.EmitLoadGReg(inst.RS), ibuild.EmitIntConst(js.compilerPC));
ibuild.EmitBranchUncond(ibuild.EmitIntConst(js.compilerPC + 4));
}
// ==============