summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2008-12-04 05:53:10 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2008-12-04 05:53:10 +0000
commite3fb58769cd84af66b05d67d65235cf53a7c93a8 (patch)
tree30bd06773fef2c05c941efe5c1c80fbe657a4248 /Source/Core
parent15e3fbc2993d945185e1646909ef7f3c1976222c (diff)
Some more work on stwcxd and lwarx
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1389 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp47
1 files changed, 30 insertions, 17 deletions
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index c83b796bca..6687b5a7b2 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -579,30 +579,43 @@ void stwbrx(UGeckoInstruction _inst)
}
-// The following two instructions are for inter-cpu communications. On a single CPU, they cannot
-// fail unless an interrupt happens in between, which usually won't happen with the JIT, so we just pretend
-// they are regular loads and stores for now. If this proves to be a problem, we could add a reservation flag.
+// The following two instructions are for inter-cpu communications. On a single
+// CPU, they cannot
+// fail unless an interrupt happens in between, which usually won't happen with
+// the JIT.
+bool g_bReserve = false;
+u32 g_reserveAddr;
+
void lwarx(UGeckoInstruction _inst)
{
- m_GPR[_inst.RD] = Memory::Read_U32(Helper_Get_EA_X(_inst));
- //static bool bFirst = true;
- //if (bFirst)
- // MessageBox(NULL, "lwarx", "Instruction unimplemented", MB_OK);
- //bFirst = false;
+ u32 uAddress = Helper_Get_EA_X(_inst);
+
+ m_GPR[_inst.RD] = Memory::Read_U32(uAddress);
+ g_bReserve = true;
+ g_reserveAddr = uAddress;
}
void stwcxd(UGeckoInstruction _inst)
{
// This instruction, too
- static bool bFirst = true;
- if (bFirst)
- PanicAlert("stwcxd - suspicious instruction");
-
- // TODO: Stores Word Conditional indeXed
-
- bFirst = false;
- u32 uAddress = Helper_Get_EA_X(_inst);
- Memory::Write_U32(m_GPR[_inst.RS], uAddress);
+ //PanicAlert("stwcxd - suspicious instruction");
+
+ // Stores Word Conditional indeXed
+
+ u32 uAddress;
+
+ if(g_bReserve) {
+ uAddress = Helper_Get_EA_X(_inst);
+ if(uAddress == g_reserveAddr) {
+ Memory::Write_U32(m_GPR[_inst.RS], uAddress);
+ g_bReserve = false;
+
+ return;
+ }
+
+ }
+
+ // TODO: Set CR0 to IS_XER_SO
}
void stwux(UGeckoInstruction _inst)