From 0d42cbc923eef625bd35997860afb409c1a230e3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 28 Jan 2017 03:39:02 -0500 Subject: [PATCH] DSPCore: Move JIT cycle code to DSPEmitter Moves x86-specific emitter code out of DSPCore. --- Source/Core/Core/DSP/DSPCore.cpp | 16 +--------------- Source/Core/Core/DSP/Jit/DSPEmitter.cpp | 19 +++++++++++++++++++ Source/Core/Core/DSP/Jit/DSPEmitter.h | 2 ++ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 712417ed37..b080ffd9bb 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -245,21 +245,7 @@ int DSPCore_RunCycles(int cycles) { if (g_dsp_jit) { - if (g_dsp.external_interrupt_waiting) - { - DSPCore_CheckExternalInterrupt(); - DSPCore_CheckExceptions(); - DSPCore_SetExternalInterrupt(false); - } - - g_cycles_left = cycles; - auto exec_addr = (JIT::x86::DSPEmitter::DSPCompiledCode)g_dsp_jit->m_enter_dispatcher; - exec_addr(); - - if (g_dsp.reset_dspjit_codespace) - g_dsp_jit->ClearIRAMandDSPJITCodespaceReset(); - - return g_cycles_left; + return g_dsp_jit->RunCycles(static_cast(cycles)); } while (cycles > 0) diff --git a/Source/Core/Core/DSP/Jit/DSPEmitter.cpp b/Source/Core/Core/DSP/Jit/DSPEmitter.cpp index ef73adf24f..8a30c80cf3 100644 --- a/Source/Core/Core/DSP/Jit/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/Jit/DSPEmitter.cpp @@ -48,6 +48,25 @@ DSPEmitter::~DSPEmitter() FreeCodeSpace(); } +u16 DSPEmitter::RunCycles(u16 cycles) +{ + if (g_dsp.external_interrupt_waiting) + { + DSPCore_CheckExternalInterrupt(); + DSPCore_CheckExceptions(); + DSPCore_SetExternalInterrupt(false); + } + + g_cycles_left = cycles; + auto exec_addr = (DSPCompiledCode)m_enter_dispatcher; + exec_addr(); + + if (g_dsp.reset_dspjit_codespace) + ClearIRAMandDSPJITCodespaceReset(); + + return g_cycles_left; +} + void DSPEmitter::ClearIRAM() { for (int i = 0x0000; i < 0x1000; i++) diff --git a/Source/Core/Core/DSP/Jit/DSPEmitter.h b/Source/Core/Core/DSP/Jit/DSPEmitter.h index 6aa72c7dc1..a9f7694a5a 100644 --- a/Source/Core/Core/DSP/Jit/DSPEmitter.h +++ b/Source/Core/Core/DSP/Jit/DSPEmitter.h @@ -32,6 +32,8 @@ public: DSPEmitter(); ~DSPEmitter(); + u16 RunCycles(u16 cycles); + void EmitInstruction(UDSPInstruction inst); void ClearIRAM(); void ClearIRAMandDSPJITCodespaceReset();