From 487eb967eb3696a76f15aed3a53b0bdd4b0cfc03 Mon Sep 17 00:00:00 2001 From: comex Date: Wed, 3 Sep 2014 02:19:32 -0400 Subject: [PATCH] Fix a bug with update loads in memcheck mode. In two cases, my old code was using a temporary register but not saving it properly; it basically worked by accident (an otherwise useless FlushLock was causing CallerSavedRegistersInUse to think it was in use by the GPR cache, even though it was actually a temporary). I'm going to modify this in the next commit to use RDX, but I didn't want to leave a broken revision in the middle. --- Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index 5042018cc9..57af170b42 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -228,7 +228,13 @@ void Jit64::lXXx(UGeckoInstruction inst) gpr.Lock(a, b, d); gpr.BindToRegister(d, js.memcheck, true); - SafeLoadToReg(gpr.RX(d), opAddress, accessSize, loadOffset, CallerSavedRegistersInUse(), signExtend); + u32 registersInUse = CallerSavedRegistersInUse(); + if (update && storeAddress) + { + // We need to save the (usually scratch) address register for the update. + registersInUse |= (1 << ABI_PARAM1); + } + SafeLoadToReg(gpr.RX(d), opAddress, accessSize, loadOffset, registersInUse, signExtend); if (update && storeAddress) { @@ -482,7 +488,7 @@ void Jit64::lmw(UGeckoInstruction inst) ADD(32, R(ECX), gpr.R(inst.RA)); for (int i = inst.RD; i < 32; i++) { - SafeLoadToReg(EAX, R(ECX), 32, (i - inst.RD) * 4, CallerSavedRegistersInUse(), false); + SafeLoadToReg(EAX, R(ECX), 32, (i - inst.RD) * 4, CallerSavedRegistersInUse() | (1 << ECX), false); gpr.BindToRegister(i, false, true); MOV(32, gpr.R(i), R(EAX)); }