mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix timing issue wiith JIT on non-Windows platforms
This commit is contained in:
parent
d56bc40db4
commit
d8da92befa
5 changed files with 17 additions and 8 deletions
|
@ -33,9 +33,10 @@ void Core_Halt(const char *msg);
|
||||||
|
|
||||||
bool Core_IsStepping();
|
bool Core_IsStepping();
|
||||||
|
|
||||||
|
// RUNNING must be at 0.
|
||||||
enum CoreState
|
enum CoreState
|
||||||
{
|
{
|
||||||
CORE_RUNNING,
|
CORE_RUNNING = 0,
|
||||||
CORE_STEPPING,
|
CORE_STEPPING,
|
||||||
CORE_POWERDOWN,
|
CORE_POWERDOWN,
|
||||||
CORE_ERROR,
|
CORE_ERROR,
|
||||||
|
|
|
@ -79,6 +79,11 @@ void AsmRoutineManager::Generate(MIPSState *mips, MIPSComp::Jit *jit)
|
||||||
ABI_CallFunction(reinterpret_cast<void *>(&CoreTiming::Advance));
|
ABI_CallFunction(reinterpret_cast<void *>(&CoreTiming::Advance));
|
||||||
FixupBranch skipToRealDispatch = J(); //skip the sync and compare first time
|
FixupBranch skipToRealDispatch = J(); //skip the sync and compare first time
|
||||||
|
|
||||||
|
dispatcherCheckCoreState = GetCodePtr();
|
||||||
|
|
||||||
|
CMP(32, M((void*)&coreState), Imm32(0));
|
||||||
|
FixupBranch badCoreState = J_CC(CC_NZ, true);
|
||||||
|
|
||||||
dispatcher = GetCodePtr();
|
dispatcher = GetCodePtr();
|
||||||
// The result of slice decrementation should be in flags if somebody jumped here
|
// The result of slice decrementation should be in flags if somebody jumped here
|
||||||
// IMPORTANT - We jump on negative, not carry!!!
|
// IMPORTANT - We jump on negative, not carry!!!
|
||||||
|
@ -145,9 +150,10 @@ void AsmRoutineManager::Generate(MIPSState *mips, MIPSComp::Jit *jit)
|
||||||
|
|
||||||
SetJumpTarget(bail);
|
SetJumpTarget(bail);
|
||||||
|
|
||||||
CMP(32, M((void*)&coreState), Imm8(0));
|
CMP(32, M((void*)&coreState), Imm32(0));
|
||||||
J_CC(CC_Z, outerLoop, true);
|
J_CC(CC_Z, outerLoop, true);
|
||||||
|
|
||||||
|
SetJumpTarget(badCoreState);
|
||||||
//Landing pad for drec space
|
//Landing pad for drec space
|
||||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||||
RET();
|
RET();
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
|
|
||||||
const u8 *outerLoop;
|
const u8 *outerLoop;
|
||||||
const u8 *dispatcher;
|
const u8 *dispatcher;
|
||||||
|
const u8 *dispatcherCheckCoreState;
|
||||||
const u8 *dispatcherNoCheck;
|
const u8 *dispatcherNoCheck;
|
||||||
|
|
||||||
const u8 *fpException;
|
const u8 *fpException;
|
||||||
|
|
|
@ -76,6 +76,7 @@ void Jit::RunLoopUntil(u64 globalticks)
|
||||||
{
|
{
|
||||||
// TODO: copy globalticks somewhere
|
// TODO: copy globalticks somewhere
|
||||||
((void (*)())asm_.enterCode)();
|
((void (*)())asm_.enterCode)();
|
||||||
|
// NOTICE_LOG(HLE, "Exited jitted code at %i, corestate=%i, dc=%i", CoreTiming::GetTicks() / 1000, (int)coreState, CoreTiming::downcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *Jit::DoJit(u32 em_address, JitBlock *b)
|
const u8 *Jit::DoJit(u32 em_address, JitBlock *b)
|
||||||
|
@ -168,7 +169,7 @@ void Jit::WriteExitDestInEAX()
|
||||||
void Jit::WriteSyscallExit()
|
void Jit::WriteSyscallExit()
|
||||||
{
|
{
|
||||||
SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount));
|
SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount));
|
||||||
JMP(asm_.dispatcher, true);
|
JMP(asm_.dispatcherCheckCoreState, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue