From 4c5f8f9c91944bca59db737ce7658a06f7673bd6 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 1 Mar 2016 22:43:19 +0100 Subject: [PATCH 1/2] CoreTiming: Drop ProcessFifoWaitEvents. globalTimer is only written in Advance, so this function has no function. --- Source/Core/Core/CoreTiming.cpp | 27 -------------------- Source/Core/Core/CoreTiming.h | 1 - Source/Core/VideoCommon/CommandProcessor.cpp | 8 ------ Source/Core/VideoCommon/CommandProcessor.h | 1 - 4 files changed, 37 deletions(-) diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 6852f46cee..2a9078f9c0 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -389,30 +389,6 @@ void ForceExceptionCheck(s64 cycles) } } -// This raise only the events required while the fifo is processing data -void ProcessFifoWaitEvents() -{ - MoveEvents(); - - if (!first) - return; - - while (first) - { - if (first->time <= g_globalTimer) - { - Event* evt = first; - first = first->next; - event_types[evt->type].callback(evt->userdata, (int)(g_globalTimer - evt->time)); - FreeEvent(evt); - } - else - { - break; - } - } -} - void MoveEvents() { BaseEvent sevt; @@ -480,14 +456,11 @@ void LogPendingEvents() void Idle() { - // DEBUG_LOG(POWERPC, "Idle"); - if (SConfig::GetInstance().bSyncGPUOnSkipIdleHack) { // When the FIFO is processing data we must not advance because in this way // the VI will be desynchronized. So, We are waiting until the FIFO finish and // while we process only the events required by the FIFO. - ProcessFifoWaitEvents(); Fifo::FlushGpu(); } diff --git a/Source/Core/Core/CoreTiming.h b/Source/Core/Core/CoreTiming.h index df07a4d345..69cb966bcb 100644 --- a/Source/Core/Core/CoreTiming.h +++ b/Source/Core/Core/CoreTiming.h @@ -60,7 +60,6 @@ void RemoveEvent(int event_type); void RemoveAllEvents(int event_type); void Advance(); void MoveEvents(); -void ProcessFifoWaitEvents(); // Pretend that the main CPU has executed enough cycles to reach the next event. void Idle(); diff --git a/Source/Core/VideoCommon/CommandProcessor.cpp b/Source/Core/VideoCommon/CommandProcessor.cpp index 878c3370c5..fe53ffe8fe 100644 --- a/Source/Core/VideoCommon/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/CommandProcessor.cpp @@ -276,7 +276,6 @@ void GatherPipeBursted() if (IsOnThread()) SetCPStatusFromCPU(); - ProcessFifoEvents(); // if we aren't linked, we don't care about gather pipe data if (!m_CPCtrlReg.GPLinkEnable) { @@ -454,13 +453,6 @@ void SetCPStatusFromCPU() } } -void ProcessFifoEvents() -{ - if (IsOnThread() && (s_interrupt_waiting.load() || s_interrupt_finish_waiting.load() || - s_interrupt_token_waiting.load())) - CoreTiming::ProcessFifoWaitEvents(); -} - void Shutdown() { } diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h index 2d9ce675e5..372ed55c3f 100644 --- a/Source/Core/VideoCommon/CommandProcessor.h +++ b/Source/Core/VideoCommon/CommandProcessor.h @@ -137,6 +137,5 @@ void SetInterruptFinishWaiting(bool waiting); void SetCpClearRegister(); void SetCpControlRegister(); void SetCpStatusRegister(); -void ProcessFifoEvents(); } // namespace CommandProcessor From ca96302a36665e3442a93517babc478b1e4f06b2 Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 4 Mar 2016 18:44:47 +0100 Subject: [PATCH 2/2] PowerPC: Dedoublify CheckExternalExceptions. --- Source/Core/Core/PowerPC/PowerPC.cpp | 39 ++-------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/Source/Core/Core/PowerPC/PowerPC.cpp b/Source/Core/Core/PowerPC/PowerPC.cpp index 71ea9a6ee2..172ce0c36c 100644 --- a/Source/Core/Core/PowerPC/PowerPC.cpp +++ b/Source/Core/Core/PowerPC/PowerPC.cpp @@ -418,44 +418,9 @@ void CheckExceptions() } // EXTERNAL INTERRUPT - else if (MSR & 0x0008000) // Handling is delayed until MSR.EE=1. + else { - if (exceptions & EXCEPTION_EXTERNAL_INT) - { - // Pokemon gets this "too early", it hasn't a handler yet - SRR0 = NPC; - SRR1 = MSR & 0x87C0FFFF; - MSR |= (MSR >> 16) & 1; - MSR &= ~0x04EF36; - PC = NPC = 0x00000500; - - INFO_LOG(POWERPC, "EXCEPTION_EXTERNAL_INT"); - ppcState.Exceptions &= ~EXCEPTION_EXTERNAL_INT; - - _dbg_assert_msg_(POWERPC, (SRR1 & 0x02) != 0, "EXTERNAL_INT unrecoverable???"); - } - else if (exceptions & EXCEPTION_PERFORMANCE_MONITOR) - { - SRR0 = NPC; - SRR1 = MSR & 0x87C0FFFF; - MSR |= (MSR >> 16) & 1; - MSR &= ~0x04EF36; - PC = NPC = 0x00000F00; - - INFO_LOG(POWERPC, "EXCEPTION_PERFORMANCE_MONITOR"); - ppcState.Exceptions &= ~EXCEPTION_PERFORMANCE_MONITOR; - } - else if (exceptions & EXCEPTION_DECREMENTER) - { - SRR0 = NPC; - SRR1 = MSR & 0x87C0FFFF; - MSR |= (MSR >> 16) & 1; - MSR &= ~0x04EF36; - PC = NPC = 0x00000900; - - INFO_LOG(POWERPC, "EXCEPTION_DECREMENTER"); - ppcState.Exceptions &= ~EXCEPTION_DECREMENTER; - } + CheckExternalExceptions(); } }