aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service/jit/jit.cpp
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-05-13 19:02:33 +0200
committercrueter <crueter@eden-emu.dev>2026-05-13 19:02:33 +0200
commitb89cd6903c8624107fd7544b568293fc062d677b (patch)
treebf6ae4123ac5900912e316b8d4880dbcd32df3cc /src/core/hle/service/jit/jit.cpp
parent7e84f9ef59314375ff9b626e83c1870173ee14b1 (diff)
[jit] fix Super Mario 64 in SM3D: All-Stars (#3950)
jit service had wrong check for module versions missing handlers for some funcs the page cache i added interfered with jit (gee who would've tought) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3950 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev>
Diffstat (limited to 'src/core/hle/service/jit/jit.cpp')
-rw-r--r--src/core/hle/service/jit/jit.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp
index 4941a71a01..1179e8b61d 100644
--- a/src/core/hle/service/jit/jit.cpp
+++ b/src/core/hle/service/jit/jit.cpp
@@ -1,6 +1,10 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include "common/logging.h"
#include "core/arm/debug.h"
#include "core/arm/symbols.h"
#include "core/core.h"
@@ -111,10 +115,7 @@ public:
const VAddr input_ptr{context.AddHeap(in_data.data(), in_data.size())};
const VAddr output_ptr{context.AddHeap(out_data.data(), out_data.size())};
- const u64 wrapper_value{context.CallFunction(callbacks.Control, ret_ptr, configuration_ptr,
- command, input_ptr, in_data.size(), output_ptr,
- out_data.size())};
-
+ const u64 wrapper_value = context.CallFunction(callbacks.Control, ret_ptr, configuration_ptr, command, input_ptr, in_data.size(), output_ptr, out_data.size());
*out_return_value = context.GetHeap<s32>(ret_ptr);
context.GetHeap(output_ptr, out_data.data(), out_data.size());
@@ -126,9 +127,7 @@ public:
R_THROW(ResultUnknown);
}
- Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory> tmem,
- InBuffer<BufferAttr_HipcMapAlias> nrr,
- InBuffer<BufferAttr_HipcMapAlias> nro) {
+ Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory> tmem, InBuffer<BufferAttr_HipcMapAlias> nrr, InBuffer<BufferAttr_HipcMapAlias> nro) {
if (!tmem) {
LOG_ERROR(Service_JIT, "Invalid transfer memory handle!");
R_THROW(ResultUnknown);
@@ -139,9 +138,10 @@ public:
configuration.transfer_memory.size = tmem_size;
// Gather up all the callbacks from the loaded plugin
- auto symbols{Core::Symbols::GetSymbols(nro, true)};
- const auto GetSymbol{[&](const std::string& name) { return symbols[name].first; }};
-
+ auto symbols = Core::Symbols::GetSymbols(nro, true);
+ const auto GetSymbol = [&](const std::string& name) {
+ return symbols[name].first;
+ };
callbacks.rtld_fini = GetSymbol("_fini");
callbacks.rtld_init = GetSymbol("_init");
callbacks.Control = GetSymbol("nnjitpluginControl");
@@ -153,8 +153,7 @@ public:
callbacks.OnPrepared = GetSymbol("nnjitpluginOnPrepared");
callbacks.Keeper = GetSymbol("nnjitpluginKeeper");
- if (callbacks.GetVersion == 0 || callbacks.Configure == 0 || callbacks.GenerateCode == 0 ||
- callbacks.OnPrepared == 0) {
+ if (callbacks.GetVersion == 0 || callbacks.Configure == 0 || callbacks.GenerateCode == 0 || callbacks.OnPrepared == 0 || callbacks.Control == 0) {
LOG_ERROR(Service_JIT, "plugin does not implement all necessary functionality");
R_THROW(ResultUnknown);
}
@@ -164,12 +163,9 @@ public:
R_THROW(ResultUnknown);
}
- context.MapProcessMemory(configuration.sys_ro_memory.offset,
- configuration.sys_ro_memory.size);
- context.MapProcessMemory(configuration.sys_rx_memory.offset,
- configuration.sys_rx_memory.size);
- context.MapProcessMemory(configuration.transfer_memory.offset,
- configuration.transfer_memory.size);
+ context.MapProcessMemory(configuration.sys_ro_memory.offset, configuration.sys_ro_memory.size);
+ context.MapProcessMemory(configuration.sys_rx_memory.offset, configuration.sys_rx_memory.size);
+ context.MapProcessMemory(configuration.transfer_memory.offset, configuration.transfer_memory.size);
// Run ELF constructors, if needed
if (callbacks.rtld_init != 0) {
@@ -179,7 +175,7 @@ public:
// Function prototype:
// u64 GetVersion();
const auto version{context.CallFunction(callbacks.GetVersion)};
- if (version != 1) {
+ if (version > 1) {
LOG_ERROR(Service_JIT, "unknown plugin version {}", version);
R_THROW(ResultUnknown);
}