From f9f7629268f921a3414249162b5420ad26b14dbb Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 16 Jan 2011 10:47:29 +0000 Subject: [PATCH] Fixed the DSPLLE on thread option. Works with DSP JIT, DSP Interpreter, AX and Zelda ucodes. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6859 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/DSPCore.cpp | 16 +++++++++++++++- Source/Core/DSPCore/Src/DSPCore.h | 2 ++ Source/Core/DSPCore/Src/DSPInterpreter.cpp | 18 +++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Source/Core/DSPCore/Src/DSPCore.cpp b/Source/Core/DSPCore/Src/DSPCore.cpp index 46d9ee1f38..308df2038b 100644 --- a/Source/Core/DSPCore/Src/DSPCore.cpp +++ b/Source/Core/DSPCore/Src/DSPCore.cpp @@ -191,7 +191,13 @@ void DSPCore_SetException(u8 level) g_dsp.exceptions |= 1 << level; } -// Comming from the CPU +// Notify that an external interrupt is pending (used by thread mode) +void DSPCore_SetExternalInterrupt() +{ + g_dsp.external_interrupt_waiting = true; +} + +// Coming from the CPU void DSPCore_CheckExternalInterrupt() { if (! dsp_SR_is_flag_set(SR_EXT_INT_ENABLE)) @@ -244,6 +250,14 @@ int DSPCore_RunCycles(int cycles) cyclesLeft = cycles; CompiledCode pExecAddr = (CompiledCode)jit->enterDispatcher; pExecAddr(); + + if (g_dsp.external_interrupt_waiting) + { + DSPCore_CheckExternalInterrupt(); + DSPCore_CheckExceptions(); + g_dsp.external_interrupt_waiting = false; + } + return cyclesLeft; } diff --git a/Source/Core/DSPCore/Src/DSPCore.h b/Source/Core/DSPCore/Src/DSPCore.h index eb35616d4a..20fcbc0ee2 100644 --- a/Source/Core/DSPCore/Src/DSPCore.h +++ b/Source/Core/DSPCore/Src/DSPCore.h @@ -231,6 +231,7 @@ struct SDSP u8 reg_stack_ptr[4]; u8 exceptions; // pending exceptions + bool external_interrupt_waiting; // DSP hardware stacks. They're mapped to a bunch of registers, such that writes // to them push and reads pop. @@ -277,6 +278,7 @@ void DSPCore_Shutdown(); // Frees all allocated memory. void DSPCore_CheckExternalInterrupt(); void DSPCore_CheckExceptions(); +void DSPCore_SetExternalInterrupt(); // sets a flag in the pending exception register. void DSPCore_SetException(u8 level); diff --git a/Source/Core/DSPCore/Src/DSPInterpreter.cpp b/Source/Core/DSPCore/Src/DSPInterpreter.cpp index d8f96ec880..b64d54135f 100644 --- a/Source/Core/DSPCore/Src/DSPInterpreter.cpp +++ b/Source/Core/DSPCore/Src/DSPInterpreter.cpp @@ -150,8 +150,14 @@ int RunCyclesDebug(int cycles) if (cycles < 0) return 0; } - - //DSPCore_CheckExternalInterrupt(); + + // In thread mode, process external interrupts + if (g_dsp.external_interrupt_waiting) + { + DSPCore_CheckExternalInterrupt(); + DSPCore_CheckExceptions(); + g_dsp.external_interrupt_waiting = false; + } while (true) { @@ -209,7 +215,13 @@ int RunCycles(int cycles) return 0; } - //DSPCore_CheckExternalInterrupt(); + // In thread mode, process external interrupts + if (g_dsp.external_interrupt_waiting) + { + DSPCore_CheckExternalInterrupt(); + DSPCore_CheckExceptions(); + g_dsp.external_interrupt_waiting = false; + } while (true) {