summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-12-17 19:17:22 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-12-17 19:17:22 +0000
commitbb81ea26cadc18767884bac5b0969ac2409de0d2 (patch)
tree7ba10924377efbef934def365a6fd44c572893ba /Source/Core
parent734daf362b8518df5ca85707876e65800ccbab57 (diff)
implement ppc opcodes eciwx/ecowx in interpreter. I think it's safe to do nothing for eieio
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4705 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/PowerPC/Gekko.h1
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp46
2 files changed, 43 insertions, 4 deletions
diff --git a/Source/Core/Core/Src/PowerPC/Gekko.h b/Source/Core/Core/Src/PowerPC/Gekko.h
index f068199310..835a8f7d63 100644
--- a/Source/Core/Core/Src/PowerPC/Gekko.h
+++ b/Source/Core/Core/Src/PowerPC/Gekko.h
@@ -616,6 +616,7 @@ enum
SPR_SPRG1 = 273,
SPR_SPRG2 = 274,
SPR_SPRG3 = 275,
+ SPR_EAR = 282,
SPR_IBAT0U = 528,
SPR_IBAT0L = 529,
SPR_IBAT1U = 530,
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index b5d39dde94..ab3fd4be44 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -318,20 +318,58 @@ void dcbz(UGeckoInstruction _inst)
// HACK but works... we think
Memory::Memset(Helper_Get_EA_X(_inst) & (~31), 0, 32);
}
-
+
+// eciwx/ecowx technically should access the specified device
+// We just do it instantly from ppc...and hey, it works! :D
void eciwx(UGeckoInstruction _inst)
{
- _assert_msg_(POWERPC,0,"eciwx - Not implemented");
+ u32 EA, b;
+ if (_inst.RA == 0)
+ b = 0;
+ else
+ b = m_GPR[_inst.RA];
+ EA = b + m_GPR[_inst.RB];
+
+ if (!PowerPC::ppcState.spr[SPR_EAR] & 0x80000000)
+ PowerPC::ppcState.Exceptions |= EXCEPTION_DSI;
+ //else if?
+ if (EA & 3)
+ PowerPC::ppcState.Exceptions |= EXCEPTION_ALIGNMENT;
+
+// _assert_msg_(POWERPC,0,"eciwx - fill r%i with word @ %08x from device %02x",
+// _inst.RS, EA, PowerPC::ppcState.spr[SPR_EAR] & 0x1f);
+
+ m_GPR[_inst.RS] = Memory::Read_U32(EA);
}
void ecowx(UGeckoInstruction _inst)
{
- _assert_msg_(POWERPC,0,"ecowx - Not implemented");
+ u32 EA, b;
+ if (_inst.RA == 0)
+ b = 0;
+ else
+ b = m_GPR[_inst.RA];
+ EA = b + m_GPR[_inst.RB];
+
+ if (!PowerPC::ppcState.spr[SPR_EAR] & 0x80000000)
+ PowerPC::ppcState.Exceptions |= EXCEPTION_DSI;
+ //else if?
+ if (EA & 3)
+ PowerPC::ppcState.Exceptions |= EXCEPTION_ALIGNMENT;
+
+// _assert_msg_(POWERPC,0,"ecowx - send stw request (%08x@%08x) to device %02x",
+// m_GPR[_inst.RS], EA, PowerPC::ppcState.spr[SPR_EAR] & 0x1f);
+
+ Memory::Write_U32(m_GPR[_inst.RS], EA);
}
void eieio(UGeckoInstruction _inst)
{
- _assert_msg_(POWERPC,0,"eieio - Not implemented");
+ // Basically ensures that loads/stores before this instruction
+ // have completed (in order) before executing the next op.
+ // Prevents real ppc from "smartly" reordering loads/stores
+ // But (at least in interpreter) we do everything realtime anyways.
+ //_assert_msg_(POWERPC,0,"eieio - Not implemented");
}
void icbi(UGeckoInstruction _inst)