diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/pm/pm.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index b10e86c8f..ea249c26f 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -2,10 +2,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/core.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/pm/pm.h" +#include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" namespace Service::PM { @@ -33,7 +34,7 @@ std::optional<Kernel::KProcess*> SearchProcessList( return *iter; } -void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, +void GetApplicationPidGeneric(HLERequestContext& ctx, const std::vector<Kernel::KProcess*>& process_list) { const auto process = SearchProcessList(process_list, [](const auto& proc) { return proc->GetProcessID() == Kernel::KProcess::ProcessIDMin; @@ -57,7 +58,7 @@ public: } private: - void GetBootMode(Kernel::HLERequestContext& ctx) { + void GetBootMode(HLERequestContext& ctx) { LOG_DEBUG(Service_PM, "called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -65,7 +66,7 @@ private: rb.PushEnum(boot_mode); } - void SetMaintenanceBoot(Kernel::HLERequestContext& ctx) { + void SetMaintenanceBoot(HLERequestContext& ctx) { LOG_DEBUG(Service_PM, "called"); boot_mode = SystemBootMode::Maintenance; @@ -99,7 +100,7 @@ public: } private: - void GetProcessId(Kernel::HLERequestContext& ctx) { + void GetProcessId(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto program_id = rp.PopRaw<u64>(); @@ -121,12 +122,12 @@ private: rb.Push((*process)->GetProcessID()); } - void GetApplicationProcessId(Kernel::HLERequestContext& ctx) { + void GetApplicationProcessId(HLERequestContext& ctx) { LOG_DEBUG(Service_PM, "called"); GetApplicationPidGeneric(ctx, kernel.GetProcessList()); } - void AtmosphereGetProcessInfo(Kernel::HLERequestContext& ctx) { + void AtmosphereGetProcessInfo(HLERequestContext& ctx) { // https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/pm/source/impl/pm_process_manager.cpp#L614 // This implementation is incomplete; only a handle to the process is returned. IPC::RequestParser rp{ctx}; @@ -186,7 +187,7 @@ public: } private: - void GetProgramId(Kernel::HLERequestContext& ctx) { + void GetProgramId(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto process_id = rp.PopRaw<u64>(); @@ -207,7 +208,7 @@ private: rb.Push((*process)->GetProgramID()); } - void AtmosphereGetProcessId(Kernel::HLERequestContext& ctx) { + void AtmosphereGetProcessId(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto program_id = rp.PopRaw<u64>(); @@ -254,7 +255,7 @@ public: } private: - void GetApplicationProcessIdForShell(Kernel::HLERequestContext& ctx) { + void GetApplicationProcessIdForShell(HLERequestContext& ctx) { LOG_DEBUG(Service_PM, "called"); GetApplicationPidGeneric(ctx, kernel.GetProcessList()); } @@ -262,12 +263,15 @@ private: const Kernel::KernelCore& kernel; }; -void InstallInterfaces(Core::System& system) { - std::make_shared<BootMode>(system)->InstallAsService(system.ServiceManager()); - std::make_shared<DebugMonitor>(system)->InstallAsService(system.ServiceManager()); - std::make_shared<Info>(system, system.Kernel().GetProcessList()) - ->InstallAsService(system.ServiceManager()); - std::make_shared<Shell>(system)->InstallAsService(system.ServiceManager()); +void LoopProcess(Core::System& system) { + auto server_manager = std::make_unique<ServerManager>(system); + + server_manager->RegisterNamedService("pm:bm", std::make_shared<BootMode>(system)); + server_manager->RegisterNamedService("pm:dmnt", std::make_shared<DebugMonitor>(system)); + server_manager->RegisterNamedService( + "pm:info", std::make_shared<Info>(system, system.Kernel().GetProcessList())); + server_manager->RegisterNamedService("pm:shell", std::make_shared<Shell>(system)); + ServerManager::RunServer(std::move(server_manager)); } } // namespace Service::PM |