diff options
| author | 2017-06-18 16:05:12 -0700 | |
|---|---|---|
| committer | 2017-06-18 16:05:12 -0700 | |
| commit | 0dfafdbe593581e013e0515cc329a48e6aca0a42 (patch) | |
| tree | f64ee4d25e2c1fb285173cdebec379002a207201 /src | |
| parent | Merge pull request #2776 from wwylele/geo-factor (diff) | |
| download | yuzu-0dfafdbe593581e013e0515cc329a48e6aca0a42.tar.gz yuzu-0dfafdbe593581e013e0515cc329a48e6aca0a42.tar.xz yuzu-0dfafdbe593581e013e0515cc329a48e6aca0a42.zip | |
Kernel/IPC: Make HLERequestContext usable from outside kernel
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 3 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 6cf1886cf..1cac1d0c9 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -23,6 +23,11 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr<ServerSession> server_s | |||
| 23 | boost::range::remove_erase(connected_sessions, server_session); | 23 | boost::range::remove_erase(connected_sessions, server_session); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | HLERequestContext::HLERequestContext(SharedPtr<ServerSession> session) | ||
| 27 | : session(std::move(session)) { | ||
| 28 | cmd_buf[0] = 0; | ||
| 29 | } | ||
| 30 | |||
| 26 | HLERequestContext::~HLERequestContext() = default; | 31 | HLERequestContext::~HLERequestContext() = default; |
| 27 | 32 | ||
| 28 | SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const { | 33 | SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const { |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index cbb109d8f..35795fc1d 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -84,6 +84,7 @@ protected: | |||
| 84 | */ | 84 | */ |
| 85 | class HLERequestContext { | 85 | class HLERequestContext { |
| 86 | public: | 86 | public: |
| 87 | HLERequestContext(SharedPtr<ServerSession> session); | ||
| 87 | ~HLERequestContext(); | 88 | ~HLERequestContext(); |
| 88 | 89 | ||
| 89 | /// Returns a pointer to the IPC command buffer for this request. | 90 | /// Returns a pointer to the IPC command buffer for this request. |
| @@ -118,14 +119,14 @@ public: | |||
| 118 | */ | 119 | */ |
| 119 | void ClearIncomingObjects(); | 120 | void ClearIncomingObjects(); |
| 120 | 121 | ||
| 121 | private: | 122 | /// Populates this context with data from the requesting process/thread. |
| 122 | friend class Service::ServiceFrameworkBase; | ||
| 123 | |||
| 124 | ResultCode PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf, Process& src_process, | 123 | ResultCode PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf, Process& src_process, |
| 125 | HandleTable& src_table); | 124 | HandleTable& src_table); |
| 125 | /// Writes data from this context back to the requesting process/thread. | ||
| 126 | ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process, | 126 | ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process, |
| 127 | HandleTable& dst_table) const; | 127 | HandleTable& dst_table) const; |
| 128 | 128 | ||
| 129 | private: | ||
| 129 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; | 130 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; |
| 130 | SharedPtr<ServerSession> session; | 131 | SharedPtr<ServerSession> session; |
| 131 | // TODO(yuriks): Check common usage of this and optimize size accordingly | 132 | // TODO(yuriks): Check common usage of this and optimize size accordingly |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 791a65c19..6754cfeea 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -173,8 +173,7 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses | |||
| 173 | 173 | ||
| 174 | // TODO(yuriks): The kernel should be the one handling this as part of translation after | 174 | // TODO(yuriks): The kernel should be the one handling this as part of translation after |
| 175 | // everything else is migrated | 175 | // everything else is migrated |
| 176 | Kernel::HLERequestContext context; | 176 | Kernel::HLERequestContext context(std::move(server_session)); |
| 177 | context.session = std::move(server_session); | ||
| 178 | context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process, | 177 | context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process, |
| 179 | Kernel::g_handle_table); | 178 | Kernel::g_handle_table); |
| 180 | 179 | ||