Seems like I broke something in r6127. I'll fix it asap but for now l'll just revert it. Sorry :-(

This closes issue 3180.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6215 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
anusko 2010-09-17 20:01:09 +00:00
parent bac3eac629
commit 7216699fc4
1 changed files with 45 additions and 124 deletions

View File

@ -195,65 +195,39 @@ void Interpreter::lhzu(UGeckoInstruction _inst)
} }
} }
// FIXME: lmw should do a total rollback if a DSI occurs
void Interpreter::lmw(UGeckoInstruction _inst) void Interpreter::lmw(UGeckoInstruction _inst)
{ {
u32 EA = Helper_Get_EA(_inst); u32 uAddress = Helper_Get_EA(_inst);
int r = _inst.RD; for (int iReg = _inst.RD; iReg <= 31; iReg++, uAddress += 4)
const int rb_r = r;
static u32 rb_GPR[32];
while (r <= 31)
{ {
u32 TempReg = Memory::Read_U32(EA); u32 TempReg = Memory::Read_U32(uAddress);
if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI)
{ {
PanicAlert("DSI exception in lmw"); PanicAlert("DSI exception in lmw");
NOTICE_LOG(POWERPC, "DSI exception in lmw"); NOTICE_LOG(POWERPC, "DSI exception in lmw");
while (r > rb_r)
{
m_GPR[r] = rb_GPR[r];
r--;
}
return; return;
} }
rb_GPR[r] = m_GPR[r]; else
m_GPR[r] = TempReg; {
m_GPR[iReg] = TempReg;
r++; }
EA += 4;
} }
} }
// FIXME: stmw should do a total rollback if a DSI occurs
void Interpreter::stmw(UGeckoInstruction _inst) void Interpreter::stmw(UGeckoInstruction _inst)
{ {
u32 EA = Helper_Get_EA(_inst); u32 uAddress = Helper_Get_EA(_inst);
int r = _inst.RS; for (int iReg = _inst.RS; iReg <= 31; iReg++, uAddress+=4)
const int rb_r = r;
static u32 rb_mem[32];
while (r <= 31)
{ {
rb_mem[r] = Memory::ReadUnchecked_U32(EA); Memory::Write_U32(m_GPR[iReg], uAddress);
Memory::Write_U32(m_GPR[r], EA);
if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI)
{ {
PanicAlert("DSI exception in stmw"); PanicAlert("DSI exception in stmw");
NOTICE_LOG(POWERPC, "DSI exception in stmw"); NOTICE_LOG(POWERPC, "DSI exception in stmw");
while (r > rb_r)
{
Memory::WriteUnchecked_U32(rb_mem[r], EA);
r--;
EA -= 4;
}
return; return;
} }
r++;
EA += 4;
} }
} }
@ -549,6 +523,7 @@ void Interpreter::lhzx(UGeckoInstruction _inst)
} }
// TODO: is this right? // TODO: is this right?
// FIXME: Should rollback if a DSI occurs
void Interpreter::lswx(UGeckoInstruction _inst) void Interpreter::lswx(UGeckoInstruction _inst)
{ {
u32 EA = Helper_Get_EA_X(_inst); u32 EA = Helper_Get_EA_X(_inst);
@ -556,13 +531,8 @@ void Interpreter::lswx(UGeckoInstruction _inst)
int r = _inst.RD; int r = _inst.RD;
int i = 0; int i = 0;
const u32 rb_EA = EA;
const int rb_r = r;
static u32 rb_GPR[32];
if (n > 0) if (n > 0)
{ {
rb_GPR[r] = m_GPR[r];
m_GPR[r] = 0; m_GPR[r] = 0;
do do
{ {
@ -571,17 +541,6 @@ void Interpreter::lswx(UGeckoInstruction _inst)
{ {
PanicAlert("DSI exception in lswx."); PanicAlert("DSI exception in lswx.");
NOTICE_LOG(POWERPC, "DSI exception in lswx"); NOTICE_LOG(POWERPC, "DSI exception in lswx");
n = ((EA - rb_EA) / 4) + 1;
EA = rb_EA;
r = rb_r;
while (n > 0)
{
m_GPR[r] = rb_GPR[r];
r = (r + 1) & 31;
EA += 4;
n--;
}
return; return;
} }
m_GPR[r] |= TempValue; m_GPR[r] |= TempValue;
@ -593,7 +552,6 @@ void Interpreter::lswx(UGeckoInstruction _inst)
{ {
i = 0; i = 0;
r = (r + 1) & 31; r = (r + 1) & 31;
rb_GPR[r] = m_GPR[r];
m_GPR[r] = 0; m_GPR[r] = 0;
} }
} while (n > 0); } while (n > 0);
@ -709,6 +667,7 @@ void Interpreter::sthx(UGeckoInstruction _inst)
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// lswi - bizarro string instruction // lswi - bizarro string instruction
// FIXME: Should rollback if a DSI occurs
void Interpreter::lswi(UGeckoInstruction _inst) void Interpreter::lswi(UGeckoInstruction _inst)
{ {
u32 EA; u32 EA;
@ -723,55 +682,38 @@ void Interpreter::lswi(UGeckoInstruction _inst)
else else
n = _inst.NB; n = _inst.NB;
int r = _inst.RD; int r = _inst.RD - 1;
int i = 0; int i = 0;
while (n>0)
const u32 rb_EA = EA;
const int rb_r = r;
static u32 rb_GPR[32];
if (n > 0)
{ {
rb_GPR[r] = m_GPR[r]; if (i==0)
m_GPR[r] = 0;
do
{ {
u32 TempValue = Memory::Read_U8(EA) << (24 - i); r++;
if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) r &= 31;
{ m_GPR[r] = 0;
PanicAlert("DSI exception in lswi."); }
n = ((EA - rb_EA) / 4) + 1; u32 TempValue = Memory::Read_U8(EA) << (24 - i);
EA = rb_EA; if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI)
r = rb_r; {
while (n > 0) PanicAlert("DSI exception in lsw.");
{ return;
m_GPR[r] = rb_GPR[r]; }
r = (r + 1) & 31;
EA += 4;
n--;
}
return;
}
m_GPR[r] |= TempValue;
EA++; m_GPR[r] |= TempValue;
n--;
i += 8; i += 8;
if (i == 32) if (i == 32)
{ i = 0;
i = 0; EA++;
r = (r + 1) & 31; n--;
rb_GPR[r] = m_GPR[r];
m_GPR[r] = 0;
}
} while (n > 0);
} }
} }
// todo : optimize ? // todo : optimize ?
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// stswi - bizarro string instruction // stswi - bizarro string instruction
// FIXME: Should rollback if a DSI occurs
void Interpreter::stswi(UGeckoInstruction _inst) void Interpreter::stswi(UGeckoInstruction _inst)
{ {
u32 EA; u32 EA;
@ -786,47 +728,26 @@ void Interpreter::stswi(UGeckoInstruction _inst)
else else
n = _inst.NB; n = _inst.NB;
int r = _inst.RS; int r = _inst.RS - 1;
int i = 0; int i = 0;
while (n > 0)
const u32 rb_EA = EA; {
const int rb_r = r; if (i == 0)
static u32 rb_mem[32]; {
r++;
while (n > 0) { r &= 31;
rb_mem[r] |= Memory::ReadUnchecked_U8(EA) << (24 - i); }
Memory::Write_U8((m_GPR[r] >> (24 - i)) & 0xFF, EA); Memory::Write_U8((m_GPR[r] >> (24 - i)) & 0xFF, EA);
if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI)
{ {
PanicAlert("DSI exception in stswi.");
n = EA - rb_EA;
EA = rb_EA;
r = rb_r;
i = 0;
while (n > 0)
{
Memory::WriteUnchecked_U8((rb_mem[r] >> (24 - i)) & 0xFF, EA);
EA++;
i += 8;
if (i == 32)
{
i = 0;
r = (r + 1) & 31;
}
n--;
}
return; return;
} }
EA++;
n--;
i += 8; i += 8;
if (i == 32) if (i == 32)
{
i = 0; i = 0;
r = (r + 1) & 31; EA++;
} n--;
} }
} }