JIT: fix memcheck with stXx

This commit is contained in:
Fiora 2014-09-06 12:50:16 -07:00
parent 9a19314969
commit b3c1cec197
1 changed files with 10 additions and 1 deletions

View File

@ -435,10 +435,11 @@ void Jit64::stXx(UGeckoInstruction inst)
int a = inst.RA, b = inst.RB, s = inst.RS;
FALLBACK_IF(!a || a == s || a == b);
bool update = !!(inst.SUBOP10 & 32);
gpr.Lock(a, b, s);
if (inst.SUBOP10 & 32)
if (update)
{
gpr.BindToRegister(a, true, true);
ADD(32, gpr.R(a), gpr.R(b));
@ -485,6 +486,14 @@ void Jit64::stXx(UGeckoInstruction inst)
}
SafeWriteRegToReg(reg_value, RSCRATCH2, accessSize, 0, CallerSavedRegistersInUse());
if (update && js.memcheck)
{
// revert the address change if an exception occurred
MEMCHECK_START(true)
SUB(32, gpr.R(a), gpr.R(b));
MEMCHECK_END;
}
gpr.UnlockAll();
gpr.UnlockAllX();
}