From 1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 2 Sep 2018 11:58:58 -0400 Subject: service: Migrate global named port map to the KernelCore class Now that we have a class representing the kernel in some capacity, we now have a place to put the named port map, so we move it over and get rid of another piece of global state within the core. --- src/core/hle/kernel/kernel.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core/hle/kernel/kernel.h') diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 089e959ac..ab2e9bffa 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -4,6 +4,8 @@ #pragma once +#include +#include #include "core/hle/kernel/object.h" template @@ -15,6 +17,7 @@ struct EventType; namespace Kernel { +class ClientPort; class HandleTable; class Process; class ResourceLimit; @@ -25,6 +28,9 @@ enum class ResourceLimitCategory : u8; /// Represents a single instance of the kernel. class KernelCore { +private: + using NamedPortTable = std::unordered_map>; + public: KernelCore(); ~KernelCore(); @@ -59,6 +65,18 @@ public: /// Adds the given shared pointer to an internal list of active processes. void AppendNewProcess(SharedPtr process); + /// Adds a port to the named port table + void AddNamedPort(std::string name, SharedPtr port); + + /// Finds a port within the named port table with the given name. + NamedPortTable::iterator FindNamedPort(const std::string& name); + + /// Finds a port within the named port table with the given name. + NamedPortTable::const_iterator FindNamedPort(const std::string& name) const; + + /// Determines whether or not the given port is a valid named port. + bool IsValidNamedPort(NamedPortTable::const_iterator port) const; + private: friend class Object; friend class Process; -- cgit v1.2.3