diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 6fba42615..21e384706 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -16,7 +16,8 @@ #include "common/concepts.h" #include "common/swap.h" #include "core/hle/ipc.h" -#include "core/hle/kernel/object.h" +#include "core/hle/kernel/k_auto_object.h" +#include "core/hle/kernel/svc_common.h" union ResultCode; @@ -35,13 +36,14 @@ class ServiceFrameworkBase; namespace Kernel { class Domain; -class HandleTable; class HLERequestContext; class KernelCore; -class Process; -class ServerSession; +class KHandleTable; +class KProcess; +class KServerSession; class KThread; class KReadableEvent; +class KSession; class KWritableEvent; enum class ThreadWakeupReason; @@ -71,20 +73,14 @@ public: * associated ServerSession alive for the duration of the connection. * @param server_session Owning pointer to the ServerSession associated with the connection. */ - void ClientConnected(std::shared_ptr<ServerSession> server_session); + void ClientConnected(KServerSession* session); /** * Signals that a client has just disconnected from this HLE handler and releases the * associated ServerSession. * @param server_session ServerSession associated with the connection. */ - void ClientDisconnected(const std::shared_ptr<ServerSession>& server_session); - -protected: - /// List of sessions that are connected to this handler. - /// A ServerSession whose server endpoint is an HLE implementation is kept alive by this list - /// for the duration of the connection. - std::vector<std::shared_ptr<ServerSession>> connected_sessions; + void ClientDisconnected(KServerSession* session); }; /** @@ -109,8 +105,7 @@ protected: class HLERequestContext { public: explicit HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, - std::shared_ptr<ServerSession> session, - std::shared_ptr<KThread> thread); + KServerSession* session, KThread* thread); ~HLERequestContext(); /// Returns a pointer to the IPC command buffer for this request. @@ -122,16 +117,16 @@ public: * Returns the session through which this request was made. This can be used as a map key to * access per-client data on services. */ - const std::shared_ptr<Kernel::ServerSession>& Session() const { + Kernel::KServerSession* Session() { return server_session; } /// Populates this context with data from the requesting process/thread. - ResultCode PopulateFromIncomingCommandBuffer(const HandleTable& handle_table, + ResultCode PopulateFromIncomingCommandBuffer(const KHandleTable& handle_table, u32_le* src_cmdbuf); /// Writes data from this context back to the requesting process/thread. - ResultCode WriteToOutgoingCommandBuffer(KThread& thread); + ResultCode WriteToOutgoingCommandBuffer(KThread& requesting_thread); u32_le GetCommand() const { return command; @@ -218,22 +213,12 @@ public: return move_handles.at(index); } - template <typename T> - std::shared_ptr<T> GetCopyObject(std::size_t index) { - return DynamicObjectCast<T>(copy_objects.at(index)); - } - - template <typename T> - std::shared_ptr<T> GetMoveObject(std::size_t index) { - return DynamicObjectCast<T>(move_objects.at(index)); + void AddMoveObject(KAutoObject* object) { + move_objects.emplace_back(object); } - void AddMoveObject(std::shared_ptr<Object> object) { - move_objects.emplace_back(std::move(object)); - } - - void AddCopyObject(std::shared_ptr<Object> object) { - copy_objects.emplace_back(std::move(object)); + void AddCopyObject(KAutoObject* object) { + copy_objects.emplace_back(object); } void AddDomainObject(std::shared_ptr<SessionRequestHandler> object) { @@ -276,10 +261,6 @@ public: return *thread; } - const KThread& GetThread() const { - return *thread; - } - bool IsThreadWaiting() const { return is_thread_waiting; } @@ -287,16 +268,17 @@ public: private: friend class IPC::ResponseBuilder; - void ParseCommandBuffer(const HandleTable& handle_table, u32_le* src_cmdbuf, bool incoming); + void ParseCommandBuffer(const KHandleTable& handle_table, u32_le* src_cmdbuf, bool incoming); std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; - std::shared_ptr<Kernel::ServerSession> server_session; - std::shared_ptr<KThread> thread; + Kernel::KServerSession* server_session{}; + KThread* thread; + // TODO(yuriks): Check common usage of this and optimize size accordingly boost::container::small_vector<Handle, 8> move_handles; boost::container::small_vector<Handle, 8> copy_handles; - boost::container::small_vector<std::shared_ptr<Object>, 8> move_objects; - boost::container::small_vector<std::shared_ptr<Object>, 8> copy_objects; + boost::container::small_vector<KAutoObject*, 8> move_objects; + boost::container::small_vector<KAutoObject*, 8> copy_objects; boost::container::small_vector<std::shared_ptr<SessionRequestHandler>, 8> domain_objects; std::optional<IPC::CommandHeader> command_header; |