From 31ada1ea07f5207348223aa01e9384231ea6105d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 22 Feb 2013 00:38:22 -0800 Subject: [PATCH] Don't process threadsafe events from HLE. Only from the runloop where blowing the jit cache is safe. --- Core/CoreTiming.cpp | 20 +++++++++++--------- Core/CoreTiming.h | 1 + Core/HLE/sceKernelThread.cpp | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index ce1180bd1b..52ca228a8a 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -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; diff --git a/Core/CoreTiming.h b/Core/CoreTiming.h index 0a05d722c3..e619281450 100644 --- a/Core/CoreTiming.h +++ b/Core/CoreTiming.h @@ -100,6 +100,7 @@ namespace CoreTiming void RemoveAllEvents(int event_type); bool IsScheduled(int event_type); void Advance(); + void AdvanceQuick(); void MoveEvents(); void ProcessFifoWaitEvents(); diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index dea4f8a6dd..b4ceae39f2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -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";