VERY experimental Nintendo Switch 2 emulator
C++
service: jit: stub JIT service
Liamd414904aeff2
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cppindex 9120cc1783..4acbff6493 100644--- a/src/common/logging/filter.cpp+++ b/src/common/logging/filter.cpp@@ -101,6 +101,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {SUB(Service, GRC) \SUB(Service, HID) \SUB(Service, IRS) \+ SUB(Service, JIT) \SUB(Service, LBL) \SUB(Service, LDN) \SUB(Service, LDR) \diff --git a/src/common/logging/types.h b/src/common/logging/types.hindex f803ab796a..99c15fa96b 100644--- a/src/common/logging/types.h+++ b/src/common/logging/types.h@@ -69,6 +69,7 @@ enum class Class : u8 {Service_GRC, ///< The game recording serviceService_HID, ///< The HID (Human interface device) serviceService_IRS, ///< The IRS service+ Service_JIT, ///< The JIT serviceService_LBL, ///< The LBL (LCD backlight) serviceService_LDN, ///< The LDN (Local domain network) serviceService_LDR, ///< The loader servicediff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 6536d05440..81eaf0942f 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -458,6 +458,8 @@ add_library(core STATIChle/service/hid/controllers/touchscreen.hhle/service/hid/controllers/xpad.cpphle/service/hid/controllers/xpad.h+ hle/service/jit/jit.cpp+ hle/service/jit/jit.hhle/service/lbl/lbl.cpphle/service/lbl/lbl.hhle/service/ldn/errors.hdiff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cppindex 420de3c54d..4d7e5ecd3b 100644--- a/src/core/hle/service/am/am.cpp+++ b/src/core/hle/service/am/am.cpp@@ -1337,7 +1337,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_){200, nullptr, "GetLastApplicationExitReason"},{500, nullptr, "StartContinuousRecordingFlushForDebug"},{1000, nullptr, "CreateMovieMaker"},- {1001, nullptr, "PrepareForJit"},+ {1001, &IApplicationFunctions::PrepareForJit, "PrepareForJit"},};// clang-format on@@ -1787,6 +1787,13 @@ void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERerb.PushCopyObjects(health_warning_disappeared_system_event->GetReadableEvent());}+void IApplicationFunctions::PrepareForJit(Kernel::HLERequestContext& ctx) {+ LOG_WARNING(Service_AM, "(STUBBED) called");++ IPC::ResponseBuilder rb{ctx, 2};+ rb.Push(ResultSuccess);+}+void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger,Core::System& system) {auto message_queue = std::make_shared<AppletMessageQueue>(system);diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.hindex fdd937b822..11a3c04594 100644--- a/src/core/hle/service/am/am.h+++ b/src/core/hle/service/am/am.h@@ -336,6 +336,7 @@ private:void TryPopFromFriendInvitationStorageChannel(Kernel::HLERequestContext& ctx);void GetNotificationStorageChannelEvent(Kernel::HLERequestContext& ctx);void GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx);+ void PrepareForJit(Kernel::HLERequestContext& ctx);KernelHelpers::ServiceContext service_context;diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cppnew file mode 100644index 0000000000..c8ebd2e3f2--- /dev/null+++ b/src/core/hle/service/jit/jit.cpp@@ -0,0 +1,53 @@+// Copyright 2022 yuzu Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "core/hle/ipc_helpers.h"+#include "core/hle/result.h"+#include "core/hle/service/jit/jit.h"+#include "core/hle/service/service.h"++namespace Service::JIT {++class IJitEnvironment final : public ServiceFramework<IJitEnvironment> {+public:+ explicit IJitEnvironment(Core::System& system_) : ServiceFramework{system_, "IJitEnvironment"} {+ // clang-format off+ static const FunctionInfo functions[] = {+ {0, nullptr, "GenerateCode"},+ {1, nullptr, "Control"},+ {1000, nullptr, "LoadPlugin"},+ {1001, nullptr, "GetCodeAddress"},+ };+ // clang-format on++ RegisterHandlers(functions);+ }+};++class JITU final : public ServiceFramework<JITU> {+public:+ explicit JITU(Core::System& system_) : ServiceFramework{system_, "jit:u"} {+ // clang-format off+ static const FunctionInfo functions[] = {+ {0, &JITU::CreateJitEnvironment, "CreateJitEnvironment"},+ };+ // clang-format on++ RegisterHandlers(functions);+ }++ void CreateJitEnvironment(Kernel::HLERequestContext& ctx) {+ LOG_DEBUG(Service_JIT, "called");++ IPC::ResponseBuilder rb{ctx, 2, 0, 1};+ rb.Push(ResultSuccess);+ rb.PushIpcInterface<IJitEnvironment>(system);+ }+};++void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {+ std::make_shared<JITU>(system)->InstallAsService(sm);+}++} // namespace Service::JITdiff --git a/src/core/hle/service/jit/jit.h b/src/core/hle/service/jit/jit.hnew file mode 100644index 0000000000..8fbf504a1c--- /dev/null+++ b/src/core/hle/service/jit/jit.h@@ -0,0 +1,20 @@+// Copyright 2022 yuzu Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++namespace Core {+class System;+}++namespace Service::SM {+class ServiceManager;+}++namespace Service::JIT {++/// Registers all JIT services with the specified service manager.+void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);++} // namespace Service::JITdiff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex ab3286db9d..edf69e33fa 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -32,6 +32,7 @@#include "core/hle/service/glue/glue.h"#include "core/hle/service/grc/grc.h"#include "core/hle/service/hid/hid.h"+#include "core/hle/service/jit/jit.h"#include "core/hle/service/lbl/lbl.h"#include "core/hle/service/ldn/ldn.h"#include "core/hle/service/ldr/ldr.h"@@ -261,6 +262,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& systemGlue::InstallInterfaces(system);GRC::InstallInterfaces(*sm, system);HID::InstallInterfaces(*sm, system);+ JIT::InstallInterfaces(*sm, system);LBL::InstallInterfaces(*sm, system);LDN::InstallInterfaces(*sm, system);LDR::InstallInterfaces(*sm, system);