From c0b7e9cd94f273288e150bca69305aa86d6838b4 Mon Sep 17 00:00:00 2001 From: Lioncache Date: Mon, 18 Dec 2023 14:33:34 -0500 Subject: [PATCH] Core/HLE/HLE: Remove global system accessor from ExecuteFromJIT() We can just pass in our system instance via the ABI function helpers. --- Source/Core/Core/HLE/HLE.cpp | 4 ++-- Source/Core/Core/HLE/HLE.h | 2 +- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 2 +- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index 1707709f2d..5d7de6eccf 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -166,10 +166,10 @@ void Execute(const Core::CPUThreadGuard& guard, u32 current_pc, u32 hook_index) } } -void ExecuteFromJIT(u32 current_pc, u32 hook_index) +void ExecuteFromJIT(u32 current_pc, u32 hook_index, Core::System& system) { ASSERT(Core::IsCPUThread()); - Core::CPUThreadGuard guard(Core::System::GetInstance()); + Core::CPUThreadGuard guard(system); Execute(guard, current_pc, hook_index); } diff --git a/Source/Core/Core/HLE/HLE.h b/Source/Core/Core/HLE/HLE.h index a43ada5adf..3935ce4c5e 100644 --- a/Source/Core/Core/HLE/HLE.h +++ b/Source/Core/Core/HLE/HLE.h @@ -61,7 +61,7 @@ void Patch(Core::System& system, u32 pc, std::string_view func_name); u32 UnPatch(Core::System& system, std::string_view patch_name); u32 UnpatchRange(Core::System& system, u32 start_addr, u32 end_addr); void Execute(const Core::CPUThreadGuard& guard, u32 current_pc, u32 hook_index); -void ExecuteFromJIT(u32 current_pc, u32 hook_index); +void ExecuteFromJIT(u32 current_pc, u32 hook_index, Core::System& system); // Returns the HLE hook index of the address u32 GetHookByAddress(u32 address); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 83e99da156..4e8fa16889 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -396,7 +396,7 @@ void Jit64::HLEFunction(u32 hook_index) gpr.Flush(); fpr.Flush(); ABI_PushRegistersAndAdjustStack({}, 0); - ABI_CallFunctionCC(HLE::ExecuteFromJIT, js.compilerPC, hook_index); + ABI_CallFunctionCCP(HLE::ExecuteFromJIT, js.compilerPC, hook_index, &m_system); ABI_PopRegistersAndAdjustStack({}, 0); } diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 26e7ce2aeb..5d7e9b2831 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -248,7 +248,7 @@ void JitArm64::HLEFunction(u32 hook_index) gpr.Flush(FlushMode::All, ARM64Reg::INVALID_REG); fpr.Flush(FlushMode::All, ARM64Reg::INVALID_REG); - ABI_CallFunction(&HLE::ExecuteFromJIT, js.compilerPC, hook_index); + ABI_CallFunction(&HLE::ExecuteFromJIT, js.compilerPC, hook_index, &m_system); } void JitArm64::DoNothing(UGeckoInstruction inst)