From 81a5ecdb18f04a508d57dd1fd8a182703d4734b5 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 16 May 2021 00:40:19 -0400 Subject: [PATCH 1/2] hle_ipc: Add a getter for PID --- src/core/hle/kernel/hle_ipc.cpp | 2 +- src/core/hle/kernel/hle_ipc.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index ce3466df8..f79b6b47e 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -64,7 +64,7 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32 if (command_header->enable_handle_descriptor) { handle_descriptor_header = rp.PopRaw(); if (handle_descriptor_header->send_current_pid) { - rp.Skip(2, false); + pid = rp.Pop(); } if (incoming) { // Populate the object lists with the data in the IPC request. diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 4fba300dc..e1b128281 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -150,6 +150,10 @@ public: return command_header->type; } + u64 GetPID() const { + return pid; + } + u32 GetDataPayloadOffset() const { return data_payload_offset; } @@ -305,11 +309,12 @@ private: std::vector buffer_w_desciptors; std::vector buffer_c_desciptors; + u32_le command{}; + u64 pid{}; u32 data_payload_offset{}; u32 handles_offset{}; u32 domain_offset{}; u32 data_size{}; - u32_le command{}; std::vector> domain_request_handlers; bool is_thread_waiting{}; From 049769a0c9a5334a4e39cd8b1a0303aff94b0bf7 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 16 May 2021 00:42:10 -0400 Subject: [PATCH 2/2] hle_ipc: unsigned -> u32 This is more concise and consistent with the rest of the codebase. --- src/core/hle/kernel/hle_ipc.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index f79b6b47e..24700f7a5 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -86,16 +86,16 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32 } } - for (unsigned i = 0; i < command_header->num_buf_x_descriptors; ++i) { + for (u32 i = 0; i < command_header->num_buf_x_descriptors; ++i) { buffer_x_desciptors.push_back(rp.PopRaw()); } - for (unsigned i = 0; i < command_header->num_buf_a_descriptors; ++i) { + for (u32 i = 0; i < command_header->num_buf_a_descriptors; ++i) { buffer_a_desciptors.push_back(rp.PopRaw()); } - for (unsigned i = 0; i < command_header->num_buf_b_descriptors; ++i) { + for (u32 i = 0; i < command_header->num_buf_b_descriptors; ++i) { buffer_b_desciptors.push_back(rp.PopRaw()); } - for (unsigned i = 0; i < command_header->num_buf_w_descriptors; ++i) { + for (u32 i = 0; i < command_header->num_buf_w_descriptors; ++i) { buffer_w_desciptors.push_back(rp.PopRaw()); } @@ -148,14 +148,14 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32 IPC::CommandHeader::BufferDescriptorCFlag::OneDescriptor) { buffer_c_desciptors.push_back(rp.PopRaw()); } else { - unsigned num_buf_c_descriptors = - static_cast(command_header->buf_c_descriptor_flags.Value()) - 2; + u32 num_buf_c_descriptors = + static_cast(command_header->buf_c_descriptor_flags.Value()) - 2; // This is used to detect possible underflows, in case something is broken // with the two ifs above and the flags value is == 0 || == 1. ASSERT(num_buf_c_descriptors < 14); - for (unsigned i = 0; i < num_buf_c_descriptors; ++i) { + for (u32 i = 0; i < num_buf_c_descriptors; ++i) { buffer_c_desciptors.push_back(rp.PopRaw()); } }