Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix updating the register even if an exception occurred in MMU mode.
  • Loading branch information
comex committed Oct 7, 2013
1 parent a9908fd commit d6f0ece
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp
Expand Up @@ -149,7 +149,9 @@ void Jit64::lXXx(UGeckoInstruction inst)
update = ((inst.SUBOP10 & 0x20) != 0);
else
update = ((inst.OPCD & 1) != 0);


bool zeroOffset = inst.OPCD != 31 && inst.SIMM_16 == 0;

// Prepare address operand
Gen::OpArg opAddress;
if (!update && !a)
Expand All @@ -170,23 +172,23 @@ void Jit64::lXXx(UGeckoInstruction inst)
}
else
{
if ((inst.OPCD != 31) && gpr.R(a).IsImm())
if ((inst.OPCD != 31) && gpr.R(a).IsImm() && !js.memcheck)
{
u32 val = (u32)gpr.R(a).offset + (s32)inst.SIMM_16;
opAddress = Imm32(val);
if (update)
if (update && !js.memcheck)
gpr.SetImmediate32(a, val);
}
else if ((inst.OPCD == 31) && gpr.R(a).IsImm() && gpr.R(b).IsImm())
else if ((inst.OPCD == 31) && gpr.R(a).IsImm() && gpr.R(b).IsImm() && !js.memcheck)
{
u32 val = (u32)gpr.R(a).offset + (u32)gpr.R(b).offset;
opAddress = Imm32(val);
if (update)
if (update && !js.memcheck)
gpr.SetImmediate32(a, val);
}
else
{
if (update || (inst.OPCD != 31 && inst.SIMM_16 == 0))
if ((update && !js.memcheck) || zeroOffset)
{
gpr.BindToRegister(a, true, update);
opAddress = gpr.R(a);
Expand All @@ -200,15 +202,23 @@ void Jit64::lXXx(UGeckoInstruction inst)

if (inst.OPCD == 31)
ADD(32, opAddress, gpr.R(b));
else
else if (inst.SIMM_16 != 0)
ADD(32, opAddress, Imm32((u32)(s32)inst.SIMM_16));
}
}

gpr.Lock(a, b, d);
gpr.BindToRegister(d, false, true);
SafeLoadToReg(gpr.RX(d), opAddress, accessSize, 0, RegistersInUse(), signExtend);


if (update && js.memcheck && !zeroOffset)
{
gpr.BindToRegister(a, false, true);
MEMCHECK_START
MOV(32, gpr.R(a), opAddress);
MEMCHECK_END
}

gpr.UnlockAll();
gpr.UnlockAllX();
}
Expand Down

0 comments on commit d6f0ece

Please sign in to comment.