summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-05-02 09:55:14 -0400
committerGravatar GitHub2018-05-02 09:55:14 -0400
commit902182f80cb808d221998ab904a0c8dab93fd440 (patch)
treed8add81daca8bc72d5344549528ce4f3953f250f /src
parentMerge pull request #429 from Subv/ioctl_corruption (diff)
parentipc: Add support for PopIpcInterface() method. (diff)
downloadyuzu-902182f80cb808d221998ab904a0c8dab93fd440.tar.gz
yuzu-902182f80cb808d221998ab904a0c8dab93fd440.tar.xz
yuzu-902182f80cb808d221998ab904a0c8dab93fd440.zip
Merge pull request #427 from bunnei/domain-inputs
ipc: Add support for PopIpcInterface() method.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/ipc.h1
-rw-r--r--src/core/hle/ipc_helpers.h7
-rw-r--r--src/core/hle/kernel/hle_ipc.h12
-rw-r--r--src/core/hle/kernel/server_session.cpp3
4 files changed, 23 insertions, 0 deletions
diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h
index a6602e12c..ef6595550 100644
--- a/src/core/hle/ipc.h
+++ b/src/core/hle/ipc.h
@@ -167,6 +167,7 @@ struct DomainMessageHeader {
167 struct { 167 struct {
168 union { 168 union {
169 BitField<0, 8, CommandType> command; 169 BitField<0, 8, CommandType> command;
170 BitField<8, 8, u32_le> input_object_count;
170 BitField<16, 16, u32_le> size; 171 BitField<16, 16, u32_le> size;
171 }; 172 };
172 u32_le object_id; 173 u32_le object_id;
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index 3f87c4297..24605a273 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -298,6 +298,13 @@ public:
298 298
299 template <typename T> 299 template <typename T>
300 Kernel::SharedPtr<T> GetCopyObject(size_t index); 300 Kernel::SharedPtr<T> GetCopyObject(size_t index);
301
302 template <class T>
303 std::shared_ptr<T> PopIpcInterface() {
304 ASSERT(context->Session()->IsDomain());
305 ASSERT(context->GetDomainMessageHeader()->input_object_count > 0);
306 return context->GetDomainRequestHandler<T>(Pop<u32>() - 1);
307 }
301}; 308};
302 309
303/// Pop /// 310/// Pop ///
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 6d4ed7648..376263eac 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -202,6 +202,16 @@ public:
202 domain_objects.emplace_back(std::move(object)); 202 domain_objects.emplace_back(std::move(object));
203 } 203 }
204 204
205 template <typename T>
206 std::shared_ptr<T> GetDomainRequestHandler(size_t index) const {
207 return std::static_pointer_cast<T>(domain_request_handlers[index]);
208 }
209
210 void SetDomainRequestHandlers(
211 const std::vector<std::shared_ptr<SessionRequestHandler>>& handlers) {
212 domain_request_handlers = handlers;
213 }
214
205 /// Clears the list of objects so that no lingering objects are written accidentally to the 215 /// Clears the list of objects so that no lingering objects are written accidentally to the
206 /// response buffer. 216 /// response buffer.
207 void ClearIncomingObjects() { 217 void ClearIncomingObjects() {
@@ -245,6 +255,8 @@ private:
245 unsigned data_payload_offset{}; 255 unsigned data_payload_offset{};
246 unsigned buffer_c_offset{}; 256 unsigned buffer_c_offset{};
247 u32_le command{}; 257 u32_le command{};
258
259 std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers;
248}; 260};
249 261
250} // namespace Kernel 262} // namespace Kernel
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index b1f8e771c..ed33c8600 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -61,6 +61,9 @@ void ServerSession::Acquire(Thread* thread) {
61ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) { 61ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
62 auto& domain_message_header = context.GetDomainMessageHeader(); 62 auto& domain_message_header = context.GetDomainMessageHeader();
63 if (domain_message_header) { 63 if (domain_message_header) {
64 // Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
65 context.SetDomainRequestHandlers(domain_request_handlers);
66
64 // If there is a DomainMessageHeader, then this is CommandType "Request" 67 // If there is a DomainMessageHeader, then this is CommandType "Request"
65 const u32 object_id{context.GetDomainMessageHeader()->object_id}; 68 const u32 object_id{context.GetDomainMessageHeader()->object_id};
66 switch (domain_message_header->command) { 69 switch (domain_message_header->command) {