hle: kernel: Migrate KClientPort to KAutoObject.
This commit is contained in:
parent
aa2844bcf9
commit
0297448fbc
18 changed files with 92 additions and 63 deletions
|
@ -13,7 +13,7 @@
|
|||
#include "core/frontend/input.h"
|
||||
#include "core/hardware_properties.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_readable_event.h"
|
||||
#include "core/hle/kernel/k_shared_memory.h"
|
||||
#include "core/hle/kernel/k_transfer_memory.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/ipc.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_thread.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
|
@ -119,7 +119,7 @@ void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelCore& kernel) {
|
|||
auto [server_port, client_port] =
|
||||
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
|
||||
server_port->SetHleHandler(shared_from_this());
|
||||
kernel.AddNamedPort(service_name, std::move(client_port));
|
||||
kernel.AddNamedPort(service_name, client_port);
|
||||
port_installed = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "core/file_sys/errors.h"
|
||||
#include "core/file_sys/system_archive/system_version.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/set/set_sys.h"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "common/assert.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_client_session.h"
|
||||
#include "core/hle/kernel/k_server_session.h"
|
||||
#include "core/hle/kernel/k_session.h"
|
||||
|
@ -62,6 +62,8 @@ ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(s
|
|||
auto [server_port, client_port] =
|
||||
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, name);
|
||||
|
||||
client_port->Open();
|
||||
|
||||
registered_services.emplace(std::move(name), std::move(client_port));
|
||||
return MakeResult(std::move(server_port));
|
||||
}
|
||||
|
@ -74,12 +76,14 @@ ResultCode ServiceManager::UnregisterService(const std::string& name) {
|
|||
LOG_ERROR(Service_SM, "Server is not registered! service={}", name);
|
||||
return ERR_SERVICE_NOT_REGISTERED;
|
||||
}
|
||||
|
||||
iter->second->Close();
|
||||
|
||||
registered_services.erase(iter);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ResultVal<std::shared_ptr<Kernel::ClientPort>> ServiceManager::GetServicePort(
|
||||
const std::string& name) {
|
||||
ResultVal<Kernel::KClientPort*> ServiceManager::GetServicePort(const std::string& name) {
|
||||
|
||||
CASCADE_CODE(ValidateServiceName(name));
|
||||
auto it = registered_services.find(name);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <unordered_map>
|
||||
|
||||
#include "common/concepts.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/server_port.h"
|
||||
#include "core/hle/result.h"
|
||||
|
@ -21,7 +21,7 @@ class System;
|
|||
}
|
||||
|
||||
namespace Kernel {
|
||||
class ClientPort;
|
||||
class KClientPort;
|
||||
class KClientSession;
|
||||
class KernelCore;
|
||||
class ServerPort;
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
ResultVal<std::shared_ptr<Kernel::ServerPort>> RegisterService(std::string name,
|
||||
u32 max_sessions);
|
||||
ResultCode UnregisterService(const std::string& name);
|
||||
ResultVal<std::shared_ptr<Kernel::ClientPort>> GetServicePort(const std::string& name);
|
||||
ResultVal<Kernel::KClientPort*> GetServicePort(const std::string& name);
|
||||
|
||||
template <Common::DerivedFrom<Kernel::SessionRequestHandler> T>
|
||||
std::shared_ptr<T> GetService(const std::string& service_name) const {
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
std::unique_ptr<Controller> controller_interface;
|
||||
|
||||
/// Map of registered services, retrieved using GetServicePort.
|
||||
std::unordered_map<std::string, std::shared_ptr<Kernel::ClientPort>> registered_services;
|
||||
std::unordered_map<std::string, Kernel::KClientPort*> registered_services;
|
||||
|
||||
/// Kernel context
|
||||
Kernel::KernelCore& kernel;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "core/core_timing_util.h"
|
||||
#include "core/hardware_properties.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/kernel/client_port.h"
|
||||
#include "core/hle/kernel/k_client_port.h"
|
||||
#include "core/hle/kernel/k_scheduler.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/service/time/interface.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue