Service, Kernel: move named port list to kernel

This commit is contained in:
Weiyi Wang 2018-10-26 10:27:13 -04:00
parent ece96807c4
commit fc84091d88
6 changed files with 18 additions and 30 deletions

View file

@ -61,8 +61,6 @@ using Kernel::SharedPtr;
namespace Service {
std::unordered_map<std::string, SharedPtr<ClientPort>> g_kernel_named_ports;
const std::array<ServiceModuleInfo, 40> service_module_map{
{{"FS", 0x00040130'00001102, FS::InstallInterfaces},
{"PM", 0x00040130'00001202, PM::InstallInterfaces},
@ -149,7 +147,7 @@ void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
SharedPtr<ClientPort> client_port;
std::tie(server_port, client_port) = kernel.CreatePortPair(max_sessions, service_name);
server_port->SetHleHandler(shared_from_this());
AddNamedPort(service_name, std::move(client_port));
kernel.AddNamedPort(service_name, std::move(client_port));
}
void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
@ -214,11 +212,6 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
////////////////////////////////////////////////////////////////////////////////////////////////////
// Module interface
// TODO(yuriks): Move to kernel
void AddNamedPort(std::string name, SharedPtr<ClientPort> port) {
g_kernel_named_ports.emplace(std::move(name), std::move(port));
}
static bool AttemptLLE(const ServiceModuleInfo& service_module) {
if (!Settings::values.lle_modules.at(service_module.name))
return false;
@ -247,10 +240,4 @@ void Init(Core::System& core) {
LOG_DEBUG(Service, "initialized OK");
}
/// Shutdown ServiceManager
void Shutdown() {
g_kernel_named_ports.clear();
LOG_DEBUG(Service, "shutdown OK");
}
} // namespace Service

View file

@ -8,7 +8,6 @@
#include <cstddef>
#include <functional>
#include <string>
#include <unordered_map>
#include <boost/container/flat_map.hpp>
#include "common/common_types.h"
#include "core/hle/kernel/hle_ipc.h"
@ -187,12 +186,6 @@ private:
/// Initialize ServiceManager
void Init(Core::System& system);
/// Shutdown ServiceManager
void Shutdown();
/// Map of named ports managed by the kernel, which can be retrieved using the ConnectToPort SVC.
extern std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_kernel_named_ports;
struct ServiceModuleInfo {
std::string name;
u64 title_id;
@ -201,7 +194,4 @@ struct ServiceModuleInfo {
extern const std::array<ServiceModuleInfo, 40> service_module_map;
/// Adds a port to the named port table
void AddNamedPort(std::string name, Kernel::SharedPtr<Kernel::ClientPort> port);
} // namespace Service