summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-07 06:20:52 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-08 09:11:37 +0200
commit84c497292a27d75b83305d053e734ab5659ffe41 (patch)
treee70832478490b0531bd2b85924fd57e18ab6157b /src/core/hle/kernel
parentKernel: Remove some unnecessary namespace qualifications (diff)
downloadyuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar.gz
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar.bz2
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar.lz
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar.xz
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.tar.zst
yuzu-84c497292a27d75b83305d053e734ab5659ffe41.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.h36
2 files changed, 36 insertions, 2 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 0922b3f47..a60b8ef00 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -21,4 +21,6 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr<ServerSession> server_s
boost::range::remove_erase(connected_sessions, server_session);
}
+HLERequestContext::~HLERequestContext() = default;
+
} // namespace Kernel
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 5de9d59d3..c30184eab 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -7,10 +7,13 @@
#include <memory>
#include <vector>
#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/server_session.h"
-namespace Kernel {
+namespace Service {
+class ServiceFrameworkBase;
+}
-class ServerSession;
+namespace Kernel {
/**
* Interface implemented by HLE Session handlers.
@@ -52,4 +55,33 @@ protected:
std::vector<SharedPtr<ServerSession>> connected_sessions;
};
+/**
+ * Class containing information about an in-flight IPC request being handled by an HLE service
+ * implementation. Services should avoid using old global APIs (e.g. Kernel::GetCommandBuffer()) and
+ * when possible use the APIs in this class to service the request.
+ */
+class HLERequestContext {
+public:
+ ~HLERequestContext();
+
+ /// Returns a pointer to the IPC command buffer for this request.
+ u32* CommandBuffer() const {
+ return cmd_buf;
+ }
+
+ /**
+ * Returns the session through which this request was made. This can be used as a map key to
+ * access per-client data on services.
+ */
+ SharedPtr<ServerSession> Session() const {
+ return session;
+ }
+
+private:
+ friend class Service::ServiceFrameworkBase;
+
+ u32* cmd_buf = nullptr;
+ SharedPtr<ServerSession> session;
+};
+
} // namespace Kernel