aboutsummaryrefslogtreecommitdiff
path: root/src/ARM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ARM.cpp')
-rw-r--r--src/ARM.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp
index 50ef8fd..7caef75 100644
--- a/src/ARM.cpp
+++ b/src/ARM.cpp
@@ -23,6 +23,7 @@
#include "ARMInterpreter.h"
#include "AREngine.h"
#include "ARMJIT.h"
+#include "Config.h"
// instruction timing notes
@@ -168,6 +169,13 @@ void ARM::DoSavestate(Savestate* file)
file->VarArray(R_IRQ, 3*sizeof(u32));
file->VarArray(R_UND, 3*sizeof(u32));
file->Var32(&CurInstr);
+ if (!file->Saving && Config::JIT_Enable)
+ {
+ // hack, the JIT doesn't really pipeline
+ // but we still want JIT save states to be
+ // loaded while running the interpreter
+ FillPipeline();
+ }
file->VarArray(NextInstr, 2*sizeof(u32));
file->Var32(&ExceptionBase);
@@ -767,4 +775,40 @@ void ARMv4::ExecuteJIT()
if (Halted == 2)
Halted = 0;
}
-#endif \ No newline at end of file
+#endif
+
+void ARMv5::FillPipeline()
+{
+ if (CPSR & 0x20)
+ {
+ if ((R[15] - 2) & 0x2)
+ {
+ NextInstr[0] = CodeRead32(R[15] - 4, false) >> 16;
+ NextInstr[1] = CodeRead32(R[15], false);
+ }
+ else
+ {
+ NextInstr[0] = CodeRead32(R[15] - 2, false);
+ NextInstr[1] = NextInstr[0] >> 16;
+ }
+ }
+ else
+ {
+ NextInstr[0] = CodeRead32(R[15] - 4, false);
+ NextInstr[1] = CodeRead32(R[15], false);
+ }
+}
+
+void ARMv4::FillPipeline()
+{
+ if (CPSR & 0x20)
+ {
+ NextInstr[0] = CodeRead16(R[15] - 2);
+ NextInstr[1] = CodeRead16(R[15]);
+ }
+ else
+ {
+ NextInstr[0] = CodeRead32(R[15] - 4);
+ NextInstr[1] = CodeRead32(R[15]);
+ }
+} \ No newline at end of file