mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-22 05:40:15 -06:00
abandon pipelining on jit
fixes Golden Sun Dawn this makes the cpu state incompatible between interpreter and JIT. That's why switching cpu mode requires a restart(not requiring is stupid anyway) and the pipeline is manually filled when making a save state.
This commit is contained in:
46
src/ARM.cpp
46
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
|
||||
#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]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user