summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-04-04 09:00:45 +0200
committerGitHub <noreply@github.com>2018-04-04 09:00:45 +0200
commitba42238b0b8489cfedefe21346fc554f240dee25 (patch)
tree4921671e164f71b96c7357b0e8f67860b1d19c89 /Source/Core
parentb82539e927cf916dd4d9c9ce8728191147aa9676 (diff)
parent3ea0a37d7216bd3a63a0ed5457737b8012de5924 (diff)
Merge pull request #6592 from lioncash/imagine-le-ppc
Interpreter_LoadStore: Generate alignment exceptions if lmw, lswi, lswx, stmw, stswi, or stswx is executed when the MSR[LE] bit is set
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index 85aac4f524..4ada0b3c3c 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -213,7 +213,7 @@ void Interpreter::lmw(UGeckoInstruction inst)
{
u32 address = Helper_Get_EA(inst);
- if ((address & 0b11) != 0)
+ if ((address & 0b11) != 0 || UReg_MSR{MSR}.LE)
{
GenerateAlignmentException(address);
return;
@@ -241,7 +241,7 @@ void Interpreter::stmw(UGeckoInstruction inst)
{
u32 address = Helper_Get_EA(inst);
- if ((address & 0b11) != 0)
+ if ((address & 0b11) != 0 || UReg_MSR{MSR}.LE)
{
GenerateAlignmentException(address);
return;
@@ -565,6 +565,12 @@ void Interpreter::lswx(UGeckoInstruction inst)
{
u32 EA = Helper_Get_EA_X(inst);
+ if (UReg_MSR{MSR}.LE)
+ {
+ GenerateAlignmentException(EA);
+ return;
+ }
+
// Confirmed by hardware test that the zero case doesn't zero rGPR[r]
for (u32 n = 0; n < static_cast<u8>(PowerPC::ppcState.xer_stringctrl); n++)
{
@@ -707,6 +713,12 @@ void Interpreter::lswi(UGeckoInstruction inst)
else
EA = rGPR[inst.RA];
+ if (UReg_MSR{MSR}.LE)
+ {
+ GenerateAlignmentException(EA);
+ return;
+ }
+
u32 n;
if (inst.NB == 0)
n = 32;
@@ -752,6 +764,12 @@ void Interpreter::stswi(UGeckoInstruction inst)
else
EA = rGPR[inst.RA];
+ if (UReg_MSR{MSR}.LE)
+ {
+ GenerateAlignmentException(EA);
+ return;
+ }
+
u32 n;
if (inst.NB == 0)
n = 32;
@@ -785,6 +803,13 @@ void Interpreter::stswi(UGeckoInstruction inst)
void Interpreter::stswx(UGeckoInstruction inst)
{
u32 EA = Helper_Get_EA_X(inst);
+
+ if (UReg_MSR{MSR}.LE)
+ {
+ GenerateAlignmentException(EA);
+ return;
+ }
+
u32 n = (u8)PowerPC::ppcState.xer_stringctrl;
int r = inst.RS;
int i = 0;