diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-08 08:30:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 08:30:17 +0200 |
commit | faa067f175cbf5e916ed75776817f0046e6731c4 (patch) | |
tree | 8ab02a72a6e4d6578848c8da2c02af02684aeec7 /src/core/hle/kernel/k_server_port.h | |
parent | Merge pull request #6287 from lioncash/ldr-copy (diff) | |
parent | hle: kernel: KPageTable: CanContain should not be constexpr. (diff) | |
download | yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.gz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.bz2 yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.lz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.xz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.zst yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_server_port.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_server_port.h b/src/core/hle/kernel/k_server_port.h new file mode 100644 index 000000000..558c8ed4d --- /dev/null +++ b/src/core/hle/kernel/k_server_port.h @@ -0,0 +1,80 @@ +// Copyright 2021 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include <boost/intrusive/list.hpp> + +#include "common/common_types.h" +#include "core/hle/kernel/k_server_session.h" +#include "core/hle/kernel/k_synchronization_object.h" +#include "core/hle/result.h" + +namespace Kernel { + +class KernelCore; +class KPort; +class SessionRequestHandler; + +class KServerPort final : public KSynchronizationObject { + KERNEL_AUTOOBJECT_TRAITS(KServerPort, KSynchronizationObject); + +private: + using SessionList = boost::intrusive::list<KServerSession>; + +public: + explicit KServerPort(KernelCore& kernel); + virtual ~KServerPort() override; + + using HLEHandler = std::shared_ptr<SessionRequestHandler>; + + void Initialize(KPort* parent_, std::string&& name_); + + /// Whether or not this server port has an HLE handler available. + bool HasHLEHandler() const { + return hle_handler != nullptr; + } + + /// Gets the HLE handler for this port. + HLEHandler GetHLEHandler() const { + return hle_handler; + } + + /** + * Sets the HLE handler template for the port. ServerSessions crated by connecting to this port + * will inherit a reference to this handler. + */ + void SetHleHandler(HLEHandler hle_handler_) { + hle_handler = std::move(hle_handler_); + } + + void EnqueueSession(KServerSession* pending_session); + + KServerSession* AcceptSession(); + + const KPort* GetParent() const { + return parent; + } + + bool IsLight() const; + + // Overridden virtual functions. + virtual void Destroy() override; + virtual bool IsSignaled() const override; + +private: + void CleanupSessions(); + +private: + SessionList session_list; + HLEHandler hle_handler; + KPort* parent{}; +}; + +} // namespace Kernel |