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();
|
||||
|
||||
// RUNNING must be at 0.
|
||||
enum CoreState
|
||||
{
|
||||
CORE_RUNNING,
|
||||
CORE_RUNNING = 0,
|
||||
CORE_STEPPING,
|
||||
CORE_POWERDOWN,
|
||||
CORE_ERROR,
|
||||
|
|
|
@ -421,7 +421,7 @@ void ProcessFifoWaitEvents()
|
|||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoveEvents()
|
||||
|
@ -438,7 +438,7 @@ void MoveEvents()
|
|||
|
||||
// Move free events to threadsafe pool
|
||||
while(allocatedTsEvents > 0 && eventPool)
|
||||
{
|
||||
{
|
||||
Event *ev = eventPool;
|
||||
eventPool = ev->next;
|
||||
ev->next = eventTsPool;
|
||||
|
@ -455,7 +455,7 @@ void Advance()
|
|||
|
||||
ProcessFifoWaitEvents();
|
||||
|
||||
if (!first)
|
||||
if (!first)
|
||||
{
|
||||
// WARN_LOG(CPU, "WARNING - no events in queue. Setting downcount to 10000");
|
||||
downcount += 10000;
|
||||
|
|
|
@ -78,7 +78,12 @@ void AsmRoutineManager::Generate(MIPSState *mips, MIPSComp::Jit *jit)
|
|||
outerLoop = GetCodePtr();
|
||||
ABI_CallFunction(reinterpret_cast<void *>(&CoreTiming::Advance));
|
||||
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();
|
||||
// The result of slice decrementation should be in flags if somebody jumped here
|
||||
// IMPORTANT - We jump on negative, not carry!!!
|
||||
|
@ -144,10 +149,11 @@ void AsmRoutineManager::Generate(MIPSState *mips, MIPSComp::Jit *jit)
|
|||
JMP(dispatcherNoCheck); // Let's just dispatch again, we'll enter the block since we know it's there.
|
||||
|
||||
SetJumpTarget(bail);
|
||||
|
||||
CMP(32, M((void*)&coreState), Imm8(0));
|
||||
|
||||
CMP(32, M((void*)&coreState), Imm32(0));
|
||||
J_CC(CC_Z, outerLoop, true);
|
||||
|
||||
SetJumpTarget(badCoreState);
|
||||
//Landing pad for drec space
|
||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||
RET();
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
|
||||
const u8 *outerLoop;
|
||||
const u8 *dispatcher;
|
||||
const u8 *dispatcherCheckCoreState;
|
||||
const u8 *dispatcherNoCheck;
|
||||
|
||||
const u8 *fpException;
|
||||
|
|
|
@ -76,6 +76,7 @@ void Jit::RunLoopUntil(u64 globalticks)
|
|||
{
|
||||
// TODO: copy globalticks somewhere
|
||||
((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)
|
||||
|
@ -168,7 +169,7 @@ void Jit::WriteExitDestInEAX()
|
|||
void Jit::WriteSyscallExit()
|
||||
{
|
||||
SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount));
|
||||
JMP(asm_.dispatcher, true);
|
||||
JMP(asm_.dispatcherCheckCoreState, true);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Add table
Reference in a new issue