diff options
| author | 2021-03-12 10:13:31 -0500 | |
|---|---|---|
| committer | 2021-04-15 01:53:16 -0400 | |
| commit | e3e6a11ab8fc14a99bce35eb6fd860d583f255d8 (patch) | |
| tree | 4e67f84f2cb516e2a8f00c8059bbbc4cd71928d7 | |
| parent | ILibraryAppletAccessor: Demote from ERROR to DEBUG for null storage logs (diff) | |
| download | yuzu-e3e6a11ab8fc14a99bce35eb6fd860d583f255d8.tar.gz yuzu-e3e6a11ab8fc14a99bce35eb6fd860d583f255d8.tar.xz yuzu-e3e6a11ab8fc14a99bce35eb6fd860d583f255d8.zip | |
hle_ipc: Add helper functions to get copy/move handles
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 161d9f782..2b363b1d9 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -75,10 +75,14 @@ void HLERequestContext::ParseCommandBuffer(const HandleTable& handle_table, u32_ | |||
| 75 | if (incoming) { | 75 | if (incoming) { |
| 76 | // Populate the object lists with the data in the IPC request. | 76 | // Populate the object lists with the data in the IPC request. |
| 77 | for (u32 handle = 0; handle < handle_descriptor_header->num_handles_to_copy; ++handle) { | 77 | for (u32 handle = 0; handle < handle_descriptor_header->num_handles_to_copy; ++handle) { |
| 78 | copy_objects.push_back(handle_table.GetGeneric(rp.Pop<Handle>())); | 78 | const u32 copy_handle{rp.Pop<Handle>()}; |
| 79 | copy_handles.push_back(copy_handle); | ||
| 80 | copy_objects.push_back(handle_table.GetGeneric(copy_handle)); | ||
| 79 | } | 81 | } |
| 80 | for (u32 handle = 0; handle < handle_descriptor_header->num_handles_to_move; ++handle) { | 82 | for (u32 handle = 0; handle < handle_descriptor_header->num_handles_to_move; ++handle) { |
| 81 | move_objects.push_back(handle_table.GetGeneric(rp.Pop<Handle>())); | 83 | const u32 move_handle{rp.Pop<Handle>()}; |
| 84 | move_handles.push_back(move_handle); | ||
| 85 | move_objects.push_back(handle_table.GetGeneric(move_handle)); | ||
| 82 | } | 86 | } |
| 83 | } else { | 87 | } else { |
| 84 | // For responses we just ignore the handles, they're empty and will be populated when | 88 | // For responses we just ignore the handles, they're empty and will be populated when |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 9a769781b..6fba42615 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -210,6 +210,14 @@ public: | |||
| 210 | /// Helper function to test whether the output buffer at buffer_index can be written | 210 | /// Helper function to test whether the output buffer at buffer_index can be written |
| 211 | bool CanWriteBuffer(std::size_t buffer_index = 0) const; | 211 | bool CanWriteBuffer(std::size_t buffer_index = 0) const; |
| 212 | 212 | ||
| 213 | Handle GetCopyHandle(std::size_t index) const { | ||
| 214 | return copy_handles.at(index); | ||
| 215 | } | ||
| 216 | |||
| 217 | Handle GetMoveHandle(std::size_t index) const { | ||
| 218 | return move_handles.at(index); | ||
| 219 | } | ||
| 220 | |||
| 213 | template <typename T> | 221 | template <typename T> |
| 214 | std::shared_ptr<T> GetCopyObject(std::size_t index) { | 222 | std::shared_ptr<T> GetCopyObject(std::size_t index) { |
| 215 | return DynamicObjectCast<T>(copy_objects.at(index)); | 223 | return DynamicObjectCast<T>(copy_objects.at(index)); |
| @@ -285,6 +293,8 @@ private: | |||
| 285 | std::shared_ptr<Kernel::ServerSession> server_session; | 293 | std::shared_ptr<Kernel::ServerSession> server_session; |
| 286 | std::shared_ptr<KThread> thread; | 294 | std::shared_ptr<KThread> thread; |
| 287 | // TODO(yuriks): Check common usage of this and optimize size accordingly | 295 | // TODO(yuriks): Check common usage of this and optimize size accordingly |
| 296 | boost::container::small_vector<Handle, 8> move_handles; | ||
| 297 | boost::container::small_vector<Handle, 8> copy_handles; | ||
| 288 | boost::container::small_vector<std::shared_ptr<Object>, 8> move_objects; | 298 | boost::container::small_vector<std::shared_ptr<Object>, 8> move_objects; |
| 289 | boost::container::small_vector<std::shared_ptr<Object>, 8> copy_objects; | 299 | boost::container::small_vector<std::shared_ptr<Object>, 8> copy_objects; |
| 290 | boost::container::small_vector<std::shared_ptr<SessionRequestHandler>, 8> domain_objects; | 300 | boost::container::small_vector<std::shared_ptr<SessionRequestHandler>, 8> domain_objects; |