JIT: make memcheck macro support an inverted mode

This commit is contained in:
Fiora 2014-09-06 12:48:58 -07:00
parent 54e26f64c6
commit 9a19314969
5 changed files with 12 additions and 13 deletions

View File

@ -238,7 +238,7 @@ void Jit64::lXXx(UGeckoInstruction inst)
if (update && storeAddress)
{
gpr.BindToRegister(a, true, true);
MEMCHECK_START
MEMCHECK_START(false)
MOV(32, gpr.R(a), opAddress);
MEMCHECK_END
}
@ -413,7 +413,7 @@ void Jit64::stX(UGeckoInstruction inst)
if (update && offset)
{
MEMCHECK_START
MEMCHECK_START(false)
gpr.KillImmediate(a, true, true);
ADD(32, gpr.R(a), Imm32((u32)offset));

View File

@ -65,7 +65,7 @@ void Jit64::lfXXX(UGeckoInstruction inst)
fpr.Lock(d);
fpr.BindToRegister(d, js.memcheck || !single);
MEMCHECK_START
MEMCHECK_START(false)
if (single)
{
ConvertSingleToDouble(fpr.RX(d), RSCRATCH, true);

View File

@ -63,7 +63,7 @@ void Jit64::psq_st(UGeckoInstruction inst)
if (update && offset && js.memcheck)
{
MEMCHECK_START
MEMCHECK_START(false)
ADD(32, gpr.R(a), Imm32((u32)offset));
MEMCHECK_END
}
@ -100,7 +100,7 @@ void Jit64::psq_l(UGeckoInstruction inst)
CALLptr(MScaled(RSCRATCH, SCALE_8, (u32)(u64)asm_routines.pairedLoadQuantized));
MEMCHECK_START
MEMCHECK_START(false)
CVTPS2PD(fpr.RX(s), R(XMM0));
if (update && offset && js.memcheck)
{

View File

@ -318,8 +318,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
}
ABI_PopRegistersAndAdjustStack(registersInUse, 0);
MEMCHECK_START
MEMCHECK_START(false)
if (signExtend && accessSize < 32)
{
// Need to sign extend values coming from the Read_U* functions.
@ -329,7 +328,6 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
{
MOVZX(64, accessSize, reg_value, R(ABI_RETURN));
}
MEMCHECK_END
}
}
@ -379,8 +377,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
}
ABI_PopRegistersAndAdjustStack(registersInUse, rsp_alignment);
MEMCHECK_START
MEMCHECK_START(false)
if (signExtend && accessSize < 32)
{
// Need to sign extend values coming from the Read_U* functions.
@ -390,8 +387,8 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
{
MOVZX(64, accessSize, reg_value, R(ABI_RETURN));
}
MEMCHECK_END
if (farcode.Enabled())
{
exit = J(true);

View File

@ -11,11 +11,13 @@
namespace MMIO { class Mapping; }
#define MEMCHECK_START \
// If inv is true, invert the check (i.e. skip over the associated code if an exception hits,
// instead of skipping over the code if an exception isn't hit).
#define MEMCHECK_START(inv) \
Gen::FixupBranch memException; \
if (jit->js.memcheck) \
{ TEST(32, PPCSTATE(Exceptions), Gen::Imm32(EXCEPTION_DSI)); \
memException = J_CC(Gen::CC_NZ, true); }
memException = J_CC((inv) ? Gen::CC_Z : Gen::CC_NZ, true); }
#define MEMCHECK_END \
if (jit->js.memcheck) \