Make sure to log / check bad immediate mem access.

Although, theoretically, this should never happen.
Also, definitely time to refactor.
This commit is contained in:
Unknown W. Brackets 2013-01-25 23:06:43 -08:00
parent 3418383917
commit b7ef3e7bef
2 changed files with 60 additions and 3 deletions

View File

@ -113,8 +113,20 @@ void Jit::Comp_FPULS(u32 op)
}
else
{
MOV(32, M((void *)ssLoadStoreTemp), Imm32(0));
MOVSS(fpr.RX(ft), M((void *)ssLoadStoreTemp));
MOV(32, R(EAX), Imm32(gpr.R(rs).GetImmValue() + offset));
ABI_CallFunctionA(thunks.ProtectFunction((void *) &Memory::Read_U32, 1), R(EAX));
MOV(32, M((void *)&ssLoadStoreTemp), R(EAX));
MOVSS(fpr.RX(ft), M((void *)&ssLoadStoreTemp));
// Should we check the core state?
if (!g_Config.bIgnoreBadMemAccess)
{
CMP(32, M((void*)&coreState), Imm32(0));
FixupBranch skip2 = J_CC(CC_E);
MOV(32, M(&currentMIPS->pc), Imm32(js.compilerPC + 4));
WriteSyscallExit();
SetJumpTarget(skip2);
}
}
}
else
@ -209,6 +221,22 @@ void Jit::Comp_FPULS(u32 op)
MOVSS(MDisp(RBX, gpr.R(rs).GetImmValue() + offset), fpr.RX(ft));
#endif
}
else
{
MOV(32, R(EAX), Imm32(gpr.R(rs).GetImmValue() + offset));
MOVSS(M((void *)&ssLoadStoreTemp), fpr.RX(ft));
ABI_CallFunctionAA(thunks.ProtectFunction((void *) &Memory::Write_U32, 2), M((void *)&ssLoadStoreTemp), R(EAX));
// Should we check the core state?
if (!g_Config.bIgnoreBadMemAccess)
{
CMP(32, M((void*)&coreState), Imm32(0));
FixupBranch skip2 = J_CC(CC_E);
MOV(32, M(&currentMIPS->pc), Imm32(js.compilerPC + 4));
WriteSyscallExit();
SetJumpTarget(skip2);
}
}
}
else
{

View File

@ -63,7 +63,21 @@ namespace MIPSComp
#endif
}
else
gpr.SetImmediate32(rt, 0);
{
MOV(32, R(EAX), Imm32(gpr.R(rs).GetImmValue() + offset));
ABI_CallFunctionA(thunks.ProtectFunction(safeFunc, 1), R(EAX));
(this->*mov)(32, bits, gpr.RX(rt), R(EAX));
// Should we check the core state?
if (!g_Config.bIgnoreBadMemAccess)
{
CMP(32, M((void*)&coreState), Imm32(0));
FixupBranch skip2 = J_CC(CC_E);
MOV(32, M(&currentMIPS->pc), Imm32(js.compilerPC + 4));
WriteSyscallExit();
SetJumpTarget(skip2);
}
}
}
else
{
@ -175,6 +189,21 @@ namespace MIPSComp
MOV(bits, MDisp(RBX, gpr.R(rs).GetImmValue() + offset), gpr.R(rt));
#endif
}
else
{
MOV(32, R(EAX), Imm32(gpr.R(rs).GetImmValue() + offset));
ABI_CallFunctionAA(thunks.ProtectFunction(safeFunc, 2), gpr.R(rt), R(EAX));
// Should we check the core state?
if (!g_Config.bIgnoreBadMemAccess)
{
CMP(32, M((void*)&coreState), Imm32(0));
FixupBranch skip2 = J_CC(CC_E);
MOV(32, M(&currentMIPS->pc), Imm32(js.compilerPC + 4));
WriteSyscallExit();
SetJumpTarget(skip2);
}
}
}
else
{