If the out is RA, delay slot isn't nice for jal.

Fixes Phantasy Star Portable 2 in jit.
This commit is contained in:
Unknown W. Brackets committed 2013-03-11 02:14:38 -07:00
1 parent f5bb835dcb
commit b5fe67eb3d
2 files changed
+21 -3

No files matched your search

+10 -1
View File
@@ -323,18 +323,27 @@ void Jit::Comp_Jump(u32 op)
}
u32 off = ((op & 0x03FFFFFF) << 2);
u32 targetAddr = (js.compilerPC & 0xF0000000) | off;
CompileDelaySlot(DELAYSLOT_NICE);
u32 delaySlotOp = Memory::ReadUnchecked_U32(js.compilerPC + 4);
bool delaySlotIsNice = (op >> 26) == 2 || IsDelaySlotNiceReg(op, delaySlotOp, MIPS_REG_RA);
CONDITIONAL_NICE_DELAYSLOT;
if (!likely && delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_NICE);
FlushAll();
switch (op >> 26)
{
case 2: //j
if (!delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_SAFE_FLUSH);
WriteExit(targetAddr, 0);
break;
case 3: //jal
MOVI2R(R0, js.compilerPC + 8);
STR(R0, CTXREG, MIPS_REG_RA * 4);
if (!delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_SAFE_FLUSH);
WriteExit(targetAddr, 0);
break;
+11 -2
View File
@@ -409,18 +409,27 @@ void Jit::Comp_Jump(u32 op)
}
u32 off = ((op & 0x3FFFFFF) << 2);
u32 targetAddr = (js.compilerPC & 0xF0000000) | off;
CompileDelaySlot(DELAYSLOT_NICE);
u32 delaySlotOp = Memory::Read_Instruction(js.compilerPC + 4);
bool delaySlotIsNice = (op >> 26) == 2 || IsDelaySlotNiceReg(op, delaySlotOp, MIPS_REG_RA);
CONDITIONAL_NICE_DELAYSLOT;
if (delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_NICE);
FlushAll();
switch (op >> 26)
{
case 2: //j
if (!delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_SAFE_FLUSH);
CONDITIONAL_LOG_EXIT(targetAddr);
WriteExit(targetAddr, 0);
break;
break;
case 3: //jal
MOV(32, M(&mips_->r[MIPS_REG_RA]), Imm32(js.compilerPC + 8)); // Save return address
if (!delaySlotIsNice)
CompileDelaySlot(DELAYSLOT_SAFE_FLUSH);
CONDITIONAL_LOG_EXIT(targetAddr);
WriteExit(targetAddr, 0);
break;