Merge pull request #7147 from lioncash/emitter
DSP: Replace x64 JIT pointer with a pointer to an architecture-agnostic base
This commit is contained in:
commit
630c3f0805
|
@ -38,18 +38,18 @@ add_library(core
|
||||||
Debugger/Dump.cpp
|
Debugger/Dump.cpp
|
||||||
Debugger/PPCDebugInterface.cpp
|
Debugger/PPCDebugInterface.cpp
|
||||||
Debugger/RSO.cpp
|
Debugger/RSO.cpp
|
||||||
DSP/DSPAssembler.cpp
|
|
||||||
DSP/DSPDisassembler.cpp
|
|
||||||
DSP/DSPAccelerator.cpp
|
DSP/DSPAccelerator.cpp
|
||||||
|
DSP/DSPAnalyzer.cpp
|
||||||
|
DSP/DSPAssembler.cpp
|
||||||
DSP/DSPCaptureLogger.cpp
|
DSP/DSPCaptureLogger.cpp
|
||||||
|
DSP/DSPCodeUtil.cpp
|
||||||
|
DSP/DSPCore.cpp
|
||||||
|
DSP/DSPDisassembler.cpp
|
||||||
DSP/DSPHWInterface.cpp
|
DSP/DSPHWInterface.cpp
|
||||||
DSP/DSPMemoryMap.cpp
|
DSP/DSPMemoryMap.cpp
|
||||||
DSP/DSPStacks.cpp
|
DSP/DSPStacks.cpp
|
||||||
DSP/DSPAnalyzer.cpp
|
|
||||||
DSP/DSPCodeUtil.cpp
|
|
||||||
DSP/LabelMap.cpp
|
|
||||||
DSP/DSPCore.cpp
|
|
||||||
DSP/DSPTables.cpp
|
DSP/DSPTables.cpp
|
||||||
|
DSP/LabelMap.cpp
|
||||||
DSP/Interpreter/DSPIntArithmetic.cpp
|
DSP/Interpreter/DSPIntArithmetic.cpp
|
||||||
DSP/Interpreter/DSPIntBranch.cpp
|
DSP/Interpreter/DSPIntBranch.cpp
|
||||||
DSP/Interpreter/DSPIntCCUtil.cpp
|
DSP/Interpreter/DSPIntCCUtil.cpp
|
||||||
|
@ -59,6 +59,7 @@ add_library(core
|
||||||
DSP/Interpreter/DSPIntMisc.cpp
|
DSP/Interpreter/DSPIntMisc.cpp
|
||||||
DSP/Interpreter/DSPIntMultiplier.cpp
|
DSP/Interpreter/DSPIntMultiplier.cpp
|
||||||
DSP/Interpreter/DSPIntTables.cpp
|
DSP/Interpreter/DSPIntTables.cpp
|
||||||
|
DSP/Jit/DSPEmitterBase.cpp
|
||||||
DSP/Jit/x64/DSPEmitter.cpp
|
DSP/Jit/x64/DSPEmitter.cpp
|
||||||
DSP/Jit/x64/DSPJitRegCache.cpp
|
DSP/Jit/x64/DSPJitRegCache.cpp
|
||||||
DSP/Jit/x64/DSPJitExtOps.cpp
|
DSP/Jit/x64/DSPJitExtOps.cpp
|
||||||
|
|
|
@ -62,13 +62,13 @@
|
||||||
<ClCompile Include="Debugger\PPCDebugInterface.cpp" />
|
<ClCompile Include="Debugger\PPCDebugInterface.cpp" />
|
||||||
<ClCompile Include="Debugger\RSO.cpp" />
|
<ClCompile Include="Debugger\RSO.cpp" />
|
||||||
<ClCompile Include="DSPEmulator.cpp" />
|
<ClCompile Include="DSPEmulator.cpp" />
|
||||||
<ClCompile Include="DSP\DSPAssembler.cpp" />
|
|
||||||
<ClCompile Include="DSP\DSPDisassembler.cpp" />
|
|
||||||
<ClCompile Include="DSP\DSPAccelerator.cpp" />
|
<ClCompile Include="DSP\DSPAccelerator.cpp" />
|
||||||
<ClCompile Include="DSP\DSPAnalyzer.cpp" />
|
<ClCompile Include="DSP\DSPAnalyzer.cpp" />
|
||||||
|
<ClCompile Include="DSP\DSPAssembler.cpp" />
|
||||||
<ClCompile Include="DSP\DSPCaptureLogger.cpp" />
|
<ClCompile Include="DSP\DSPCaptureLogger.cpp" />
|
||||||
<ClCompile Include="DSP\DSPCodeUtil.cpp" />
|
<ClCompile Include="DSP\DSPCodeUtil.cpp" />
|
||||||
<ClCompile Include="DSP\DSPCore.cpp" />
|
<ClCompile Include="DSP\DSPCore.cpp" />
|
||||||
|
<ClCompile Include="DSP\DSPDisassembler.cpp" />
|
||||||
<ClCompile Include="DSP\DSPHWInterface.cpp" />
|
<ClCompile Include="DSP\DSPHWInterface.cpp" />
|
||||||
<ClCompile Include="DSP\DSPMemoryMap.cpp" />
|
<ClCompile Include="DSP\DSPMemoryMap.cpp" />
|
||||||
<ClCompile Include="DSP\DSPStacks.cpp" />
|
<ClCompile Include="DSP\DSPStacks.cpp" />
|
||||||
|
@ -82,6 +82,7 @@
|
||||||
<ClCompile Include="DSP\Interpreter\DSPIntMisc.cpp" />
|
<ClCompile Include="DSP\Interpreter\DSPIntMisc.cpp" />
|
||||||
<ClCompile Include="DSP\Interpreter\DSPIntMultiplier.cpp" />
|
<ClCompile Include="DSP\Interpreter\DSPIntMultiplier.cpp" />
|
||||||
<ClCompile Include="DSP\Interpreter\DSPIntTables.cpp" />
|
<ClCompile Include="DSP\Interpreter\DSPIntTables.cpp" />
|
||||||
|
<ClCompile Include="DSP\Jit\DSPEmitterBase.cpp" />
|
||||||
<ClCompile Include="DSP\Jit\x64\DSPEmitter.cpp" />
|
<ClCompile Include="DSP\Jit\x64\DSPEmitter.cpp" />
|
||||||
<ClCompile Include="DSP\Jit\x64\DSPJitArithmetic.cpp" />
|
<ClCompile Include="DSP\Jit\x64\DSPJitArithmetic.cpp" />
|
||||||
<ClCompile Include="DSP\Jit\x64\DSPJitBranch.cpp" />
|
<ClCompile Include="DSP\Jit\x64\DSPJitBranch.cpp" />
|
||||||
|
@ -326,15 +327,15 @@
|
||||||
<ClInclude Include="Debugger\PPCDebugInterface.h" />
|
<ClInclude Include="Debugger\PPCDebugInterface.h" />
|
||||||
<ClInclude Include="Debugger\RSO.h" />
|
<ClInclude Include="Debugger\RSO.h" />
|
||||||
<ClInclude Include="DSPEmulator.h" />
|
<ClInclude Include="DSPEmulator.h" />
|
||||||
<ClInclude Include="DSP\DSPAssembler.h" />
|
|
||||||
<ClInclude Include="DSP\DSPDisassembler.h" />
|
|
||||||
<ClInclude Include="DSP\DSPAccelerator.h" />
|
<ClInclude Include="DSP\DSPAccelerator.h" />
|
||||||
<ClInclude Include="DSP\DSPAnalyzer.h" />
|
<ClInclude Include="DSP\DSPAnalyzer.h" />
|
||||||
|
<ClInclude Include="DSP\DSPAssembler.h" />
|
||||||
<ClInclude Include="DSP\DSPBreakpoints.h" />
|
<ClInclude Include="DSP\DSPBreakpoints.h" />
|
||||||
<ClInclude Include="DSP\DSPCaptureLogger.h" />
|
<ClInclude Include="DSP\DSPCaptureLogger.h" />
|
||||||
<ClInclude Include="DSP\DSPCodeUtil.h" />
|
<ClInclude Include="DSP\DSPCodeUtil.h" />
|
||||||
<ClInclude Include="DSP\DSPCommon.h" />
|
<ClInclude Include="DSP\DSPCommon.h" />
|
||||||
<ClInclude Include="DSP\DSPCore.h" />
|
<ClInclude Include="DSP\DSPCore.h" />
|
||||||
|
<ClInclude Include="DSP\DSPDisassembler.h" />
|
||||||
<ClInclude Include="DSP\DSPHost.h" />
|
<ClInclude Include="DSP\DSPHost.h" />
|
||||||
<ClInclude Include="DSP\DSPHWInterface.h" />
|
<ClInclude Include="DSP\DSPHWInterface.h" />
|
||||||
<ClInclude Include="DSP\DSPMemoryMap.h" />
|
<ClInclude Include="DSP\DSPMemoryMap.h" />
|
||||||
|
@ -345,6 +346,7 @@
|
||||||
<ClInclude Include="DSP\Interpreter\DSPIntExtOps.h" />
|
<ClInclude Include="DSP\Interpreter\DSPIntExtOps.h" />
|
||||||
<ClInclude Include="DSP\Interpreter\DSPIntTables.h" />
|
<ClInclude Include="DSP\Interpreter\DSPIntTables.h" />
|
||||||
<ClInclude Include="DSP\Interpreter\DSPIntUtil.h" />
|
<ClInclude Include="DSP\Interpreter\DSPIntUtil.h" />
|
||||||
|
<ClInclude Include="DSP\Jit\DSPEmitterBase.h" />
|
||||||
<ClInclude Include="DSP\Jit\x64\DSPEmitter.h" />
|
<ClInclude Include="DSP\Jit\x64\DSPEmitter.h" />
|
||||||
<ClInclude Include="DSP\Jit\x64\DSPJitRegCache.h" />
|
<ClInclude Include="DSP\Jit\x64\DSPJitRegCache.h" />
|
||||||
<ClInclude Include="DSP\Jit\x64\DSPJitTables.h" />
|
<ClInclude Include="DSP\Jit\x64\DSPJitTables.h" />
|
||||||
|
|
|
@ -243,6 +243,9 @@
|
||||||
<ClCompile Include="DSP\Interpreter\DSPIntTables.cpp">
|
<ClCompile Include="DSP\Interpreter\DSPIntTables.cpp">
|
||||||
<Filter>DSPCore\Interpreter</Filter>
|
<Filter>DSPCore\Interpreter</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="DSP\Jit\DSPEmitterBase.cpp">
|
||||||
|
<Filter>DSPCore\Jit</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="DSP\Jit\x64\DSPJitRegCache.cpp">
|
<ClCompile Include="DSP\Jit\x64\DSPJitRegCache.cpp">
|
||||||
<Filter>DSPCore\Jit\x64</Filter>
|
<Filter>DSPCore\Jit\x64</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -972,6 +975,9 @@
|
||||||
<ClInclude Include="DSP\Interpreter\DSPIntUtil.h">
|
<ClInclude Include="DSP\Interpreter\DSPIntUtil.h">
|
||||||
<Filter>DSPCore\Interpreter</Filter>
|
<Filter>DSPCore\Interpreter</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="DSP\Jit\DSPEmitterBase.h">
|
||||||
|
<Filter>DSPCore\Jit</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="DSP\Jit\x64\DSPJitRegCache.h">
|
<ClInclude Include="DSP\Jit\x64\DSPJitRegCache.h">
|
||||||
<Filter>DSPCore\Jit\x64</Filter>
|
<Filter>DSPCore\Jit\x64</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#include "Core/DSP/DSPHost.h"
|
#include "Core/DSP/DSPHost.h"
|
||||||
#include "Core/DSP/Interpreter/DSPIntUtil.h"
|
#include "Core/DSP/Interpreter/DSPIntUtil.h"
|
||||||
#include "Core/DSP/Interpreter/DSPInterpreter.h"
|
#include "Core/DSP/Interpreter/DSPInterpreter.h"
|
||||||
#include "Core/DSP/Jit/x64/DSPEmitter.h"
|
#include "Core/DSP/Jit/DSPEmitterBase.h"
|
||||||
#include "Core/HW/DSP.h"
|
|
||||||
|
|
||||||
namespace DSP
|
namespace DSP
|
||||||
{
|
{
|
||||||
|
@ -31,7 +30,7 @@ SDSP g_dsp;
|
||||||
DSPBreakpoints g_dsp_breakpoints;
|
DSPBreakpoints g_dsp_breakpoints;
|
||||||
static State core_state = State::Stopped;
|
static State core_state = State::Stopped;
|
||||||
bool g_init_hax = false;
|
bool g_init_hax = false;
|
||||||
std::unique_ptr<JIT::x64::DSPEmitter> g_dsp_jit;
|
std::unique_ptr<JIT::DSPEmitter> g_dsp_jit;
|
||||||
std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
|
std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
|
||||||
static Common::Event step_event;
|
static Common::Event step_event;
|
||||||
|
|
||||||
|
@ -172,7 +171,7 @@ bool DSPCore_Init(const DSPInitOptions& opts)
|
||||||
|
|
||||||
// Initialize JIT, if necessary
|
// Initialize JIT, if necessary
|
||||||
if (opts.core_type == DSPInitOptions::CoreType::JIT64)
|
if (opts.core_type == DSPInitOptions::CoreType::JIT64)
|
||||||
g_dsp_jit = std::make_unique<JIT::x64::DSPEmitter>();
|
g_dsp_jit = JIT::CreateDSPEmitter();
|
||||||
|
|
||||||
g_dsp_cap.reset(opts.capture_logger);
|
g_dsp_cap.reset(opts.capture_logger);
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,8 @@ class Accelerator;
|
||||||
|
|
||||||
namespace JIT
|
namespace JIT
|
||||||
{
|
{
|
||||||
namespace x64
|
|
||||||
{
|
|
||||||
class DSPEmitter;
|
class DSPEmitter;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
|
@ -317,7 +314,7 @@ struct SDSP
|
||||||
extern SDSP g_dsp;
|
extern SDSP g_dsp;
|
||||||
extern DSPBreakpoints g_dsp_breakpoints;
|
extern DSPBreakpoints g_dsp_breakpoints;
|
||||||
extern bool g_init_hax;
|
extern bool g_init_hax;
|
||||||
extern std::unique_ptr<JIT::x64::DSPEmitter> g_dsp_jit;
|
extern std::unique_ptr<JIT::DSPEmitter> g_dsp_jit;
|
||||||
extern std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
|
extern std::unique_ptr<DSPCaptureLogger> g_dsp_cap;
|
||||||
|
|
||||||
struct DSPInitOptions
|
struct DSPInitOptions
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "Core/DSP/Jit/DSPEmitterBase.h"
|
||||||
|
|
||||||
|
#if defined(_M_X86) || defined(_M_X86_64)
|
||||||
|
#include "Core/DSP/Jit/x64/DSPEmitter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace DSP::JIT
|
||||||
|
{
|
||||||
|
DSPEmitter::~DSPEmitter() = default;
|
||||||
|
|
||||||
|
std::unique_ptr<DSPEmitter> CreateDSPEmitter()
|
||||||
|
{
|
||||||
|
#if defined(_M_X86) || defined(_M_X86_64)
|
||||||
|
return std::make_unique<x64::DSPEmitter>();
|
||||||
|
#else
|
||||||
|
return std::make_unique<DSPEmitterNull>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} // namespace DSP::JIT
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright 2018 Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2+
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
class PointerWrap;
|
||||||
|
|
||||||
|
namespace DSP::JIT
|
||||||
|
{
|
||||||
|
class DSPEmitter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DSPEmitter();
|
||||||
|
|
||||||
|
virtual u16 RunCycles(u16 cycles) = 0;
|
||||||
|
virtual void ClearIRAM() = 0;
|
||||||
|
|
||||||
|
virtual void DoState(PointerWrap& p) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class DSPEmitterNull final : public DSPEmitter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
u16 RunCycles(u16) override { return 0; }
|
||||||
|
void ClearIRAM() override {}
|
||||||
|
void DoState(PointerWrap&) override {}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<DSPEmitter> CreateDSPEmitter();
|
||||||
|
} // namespace DSP::JIT
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Common/x64Emitter.h"
|
#include "Common/x64Emitter.h"
|
||||||
|
|
||||||
#include "Core/DSP/DSPCommon.h"
|
#include "Core/DSP/DSPCommon.h"
|
||||||
|
#include "Core/DSP/Jit/DSPEmitterBase.h"
|
||||||
#include "Core/DSP/Jit/x64/DSPJitRegCache.h"
|
#include "Core/DSP/Jit/x64/DSPJitRegCache.h"
|
||||||
|
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
@ -24,7 +25,7 @@ enum class StackRegister;
|
||||||
|
|
||||||
namespace JIT::x64
|
namespace JIT::x64
|
||||||
{
|
{
|
||||||
class DSPEmitter : public Gen::X64CodeBlock
|
class DSPEmitter final : public JIT::DSPEmitter, public Gen::X64CodeBlock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using DSPCompiledCode = u32 (*)();
|
using DSPCompiledCode = u32 (*)();
|
||||||
|
@ -33,14 +34,13 @@ public:
|
||||||
static constexpr size_t MAX_BLOCKS = 0x10000;
|
static constexpr size_t MAX_BLOCKS = 0x10000;
|
||||||
|
|
||||||
DSPEmitter();
|
DSPEmitter();
|
||||||
~DSPEmitter();
|
~DSPEmitter() override;
|
||||||
|
|
||||||
u16 RunCycles(u16 cycles);
|
u16 RunCycles(u16 cycles) override;
|
||||||
|
void DoState(PointerWrap& p) override;
|
||||||
void DoState(PointerWrap& p);
|
void ClearIRAM() override;
|
||||||
|
|
||||||
void EmitInstruction(UDSPInstruction inst);
|
void EmitInstruction(UDSPInstruction inst);
|
||||||
void ClearIRAM();
|
|
||||||
void ClearIRAMandDSPJITCodespaceReset();
|
void ClearIRAMandDSPJITCodespaceReset();
|
||||||
|
|
||||||
void CompileDispatcher();
|
void CompileDispatcher();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "Core/DSP/DSPHost.h"
|
#include "Core/DSP/DSPHost.h"
|
||||||
#include "Core/DSP/DSPTables.h"
|
#include "Core/DSP/DSPTables.h"
|
||||||
#include "Core/DSP/Interpreter/DSPInterpreter.h"
|
#include "Core/DSP/Interpreter/DSPInterpreter.h"
|
||||||
#include "Core/DSP/Jit/x64/DSPEmitter.h"
|
#include "Core/DSP/Jit/DSPEmitterBase.h"
|
||||||
#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
|
#include "Core/HW/DSPLLE/DSPLLEGlobals.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
|
|
Loading…
Reference in New Issue