Fix bug in interpreter's lswx. Was overwriting extra register.

When n was a multiple of 4, the old implementation would overwrite
the following register with 0.

This was causing Not64 to crash.

Thanks to Extrems for spotting this.
This commit is contained in:
Scott Mansell 2016-08-27 10:07:14 +12:00
parent 0fbf72cbf1
commit 5b47635b3f
1 changed files with 5 additions and 3 deletions

View File

@ -509,7 +509,7 @@ void Interpreter::lswx(UGeckoInstruction _inst)
if (n > 0)
{
rGPR[r] = 0;
do
while (true)
{
u32 TempValue = PowerPC::Read_U8(EA) << (24 - i);
if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI)
@ -520,8 +520,10 @@ void Interpreter::lswx(UGeckoInstruction _inst)
}
rGPR[r] |= TempValue;
if (--n == 0)
return;
EA++;
n--;
i += 8;
if (i == 32)
{
@ -529,7 +531,7 @@ void Interpreter::lswx(UGeckoInstruction _inst)
r = (r + 1) & 31;
rGPR[r] = 0;
}
} while (n > 0);
}
}
}