Merge pull request #762 from unknownbrackets/savestates

Don't process threadsafe events from HLE.
This commit is contained in:
Henrik Rydgård 2013-02-22 01:01:11 -08:00
commit 9ab790ca8f
3 changed files with 14 additions and 11 deletions

View File

@ -422,12 +422,6 @@ void RemoveAllEvents(int event_type)
//This raise only the events required while the fifo is processing data
void ProcessFifoWaitEvents()
{
if (Common::AtomicLoadAcquire(hasTsEvents))
MoveEvents();
if (!first)
return;
while (first)
{
if (first->time <= globalTimer)
@ -471,14 +465,12 @@ void MoveEvents()
}
}
void Advance()
void AdvanceQuick()
{
int cyclesExecuted = slicelength - currentMIPS->downcount;
globalTimer += cyclesExecuted;
currentMIPS->downcount = slicelength;
ProcessFifoWaitEvents();
if (!first)
{
// WARN_LOG(CPU, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");
@ -486,6 +478,8 @@ void Advance()
}
else
{
ProcessFifoWaitEvents();
slicelength = (int)(first->time - globalTimer);
if (slicelength > MAX_SLICE_LENGTH)
slicelength = MAX_SLICE_LENGTH;
@ -495,6 +489,14 @@ void Advance()
advanceCallback(cyclesExecuted);
}
void Advance()
{
if (Common::AtomicLoadAcquire(hasTsEvents))
MoveEvents();
AdvanceQuick();
}
void LogPendingEvents()
{
Event *ptr = first;

View File

@ -100,6 +100,7 @@ namespace CoreTiming
void RemoveAllEvents(int event_type);
bool IsScheduled(int event_type);
void Advance();
void AdvanceQuick();
void MoveEvents();
void ProcessFifoWaitEvents();

View File

@ -795,7 +795,7 @@ void __KernelIdle()
CoreTiming::Idle();
// Advance must happen between Idle and Reschedule, so that threads that were waiting for something
// that was triggered at the end of the Idle period must get a chance to be scheduled.
CoreTiming::Advance();
CoreTiming::AdvanceQuick();
// We must've exited a callback?
if (__KernelInCallback())
@ -1263,7 +1263,7 @@ void __KernelReSchedule(const char *reason)
}
// Execute any pending events while we're doing scheduling.
CoreTiming::Advance();
CoreTiming::AdvanceQuick();
if (__IsInInterrupt() || __KernelInCallback())
{
reason = "In Interrupt Or Callback";