Skip to content

Commit

Permalink
Merge pull request #11561 from AdmiralCurtiss/hle-execute-fix
Browse files Browse the repository at this point in the history
JIT: Fix calls to HLE::Execute.
  • Loading branch information
JosJuice committed Feb 13, 2023
2 parents 1fc5d37 + e1dbea3 commit 9d139ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Source/Core/Core/HLE/HLE.cpp
Expand Up @@ -12,6 +12,7 @@

#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/GeckoCode.h"
#include "Core/HLE/HLE_Misc.h"
#include "Core/HLE/HLE_OS.h"
Expand Down Expand Up @@ -165,6 +166,13 @@ void Execute(const Core::CPUThreadGuard& guard, u32 current_pc, u32 hook_index)
}
}

void ExecuteFromJIT(u32 current_pc, u32 hook_index)
{
ASSERT(Core::IsCPUThread());
Core::CPUThreadGuard guard;
Execute(guard, current_pc, hook_index);
}

u32 GetHookByAddress(u32 address)
{
auto iter = s_hooked_addresses.find(address);
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/HLE/HLE.h
Expand Up @@ -48,6 +48,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);

// Returns the HLE hook index of the address
u32 GetHookByAddress(u32 address);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit.cpp
Expand Up @@ -483,7 +483,7 @@ void Jit64::HLEFunction(u32 hook_index)
gpr.Flush();
fpr.Flush();
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunctionCC(HLE::Execute, js.compilerPC, hook_index);
ABI_CallFunctionCC(HLE::ExecuteFromJIT, js.compilerPC, hook_index);
ABI_PopRegistersAndAdjustStack({}, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -254,7 +254,7 @@ void JitArm64::HLEFunction(u32 hook_index)
gpr.Flush(FlushMode::All, ARM64Reg::INVALID_REG);
fpr.Flush(FlushMode::All, ARM64Reg::INVALID_REG);

MOVP2R(ARM64Reg::X8, &HLE::Execute);
MOVP2R(ARM64Reg::X8, &HLE::ExecuteFromJIT);
MOVI2R(ARM64Reg::W0, js.compilerPC);
MOVI2R(ARM64Reg::W1, hook_index);
BLR(ARM64Reg::X8);
Expand Down

0 comments on commit 9d139ea

Please sign in to comment.