summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-18 20:17:06 -0400
committerGravatar bunnei2018-03-18 20:56:33 -0400
commit019f1a0cf0505436854ed631da56b97b1d490945 (patch)
tree5a61220815f313c2dab10e12c1c75956c12fd355 /src/core
parentthread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB. (diff)
downloadyuzu-019f1a0cf0505436854ed631da56b97b1d490945.tar.gz
yuzu-019f1a0cf0505436854ed631da56b97b1d490945.tar.xz
yuzu-019f1a0cf0505436854ed631da56b97b1d490945.zip
hle_ipc: Remove GetPointer(..) usage with WriteToOutgoingCommandBuffer.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp14
-rw-r--r--src/core/hle/kernel/hle_ipc.h4
-rw-r--r--src/core/hle/service/service.cpp3
3 files changed, 14 insertions, 7 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index d9faf4b53..f30f8739c 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -159,8 +159,11 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdb
159 return RESULT_SUCCESS; 159 return RESULT_SUCCESS;
160} 160}
161 161
162ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process, 162ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) {
163 HandleTable& dst_table) { 163 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf;
164 Memory::ReadBlock(*thread.owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(),
165 dst_cmdbuf.size() * sizeof(u32));
166
164 // The header was already built in the internal command buffer. Attempt to parse it to verify 167 // The header was already built in the internal command buffer. Attempt to parse it to verify
165 // the integrity and then copy it over to the target command buffer. 168 // the integrity and then copy it over to the target command buffer.
166 ParseCommandBuffer(cmd_buf.data(), false); 169 ParseCommandBuffer(cmd_buf.data(), false);
@@ -171,7 +174,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
171 if (domain_message_header) 174 if (domain_message_header)
172 size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32); 175 size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32);
173 176
174 std::copy_n(cmd_buf.begin(), size, dst_cmdbuf); 177 std::copy_n(cmd_buf.begin(), size, dst_cmdbuf.data());
175 178
176 if (command_header->enable_handle_descriptor) { 179 if (command_header->enable_handle_descriptor) {
177 ASSERT_MSG(!move_objects.empty() || !copy_objects.empty(), 180 ASSERT_MSG(!move_objects.empty() || !copy_objects.empty(),
@@ -213,6 +216,11 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, P
213 dst_cmdbuf[domain_offset++] = static_cast<u32_le>(request_handlers.size()); 216 dst_cmdbuf[domain_offset++] = static_cast<u32_le>(request_handlers.size());
214 } 217 }
215 } 218 }
219
220 // Copy the translated command buffer back into the thread's command buffer area.
221 Memory::WriteBlock(*thread.owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(),
222 dst_cmdbuf.size() * sizeof(u32));
223
216 return RESULT_SUCCESS; 224 return RESULT_SUCCESS;
217} 225}
218 226
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index b5631b773..743835f18 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -13,6 +13,7 @@
13#include "core/hle/ipc.h" 13#include "core/hle/ipc.h"
14#include "core/hle/kernel/kernel.h" 14#include "core/hle/kernel/kernel.h"
15#include "core/hle/kernel/server_session.h" 15#include "core/hle/kernel/server_session.h"
16#include "core/hle/kernel/thread.h"
16 17
17namespace Service { 18namespace Service {
18class ServiceFrameworkBase; 19class ServiceFrameworkBase;
@@ -108,8 +109,7 @@ public:
108 ResultCode PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf, Process& src_process, 109 ResultCode PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf, Process& src_process,
109 HandleTable& src_table); 110 HandleTable& src_table);
110 /// Writes data from this context back to the requesting process/thread. 111 /// Writes data from this context back to the requesting process/thread.
111 ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process, 112 ResultCode WriteToOutgoingCommandBuffer(Thread& thread);
112 HandleTable& dst_table);
113 113
114 u32_le GetCommand() const { 114 u32_le GetCommand() const {
115 return command; 115 return command;
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 8818b0f0f..a1ca8a033 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -152,8 +152,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co
152 UNIMPLEMENTED_MSG("command_type=%d", context.GetCommandType()); 152 UNIMPLEMENTED_MSG("command_type=%d", context.GetCommandType());
153 } 153 }
154 154
155 u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress()); 155 context.WriteToOutgoingCommandBuffer(*Kernel::GetCurrentThread());
156 context.WriteToOutgoingCommandBuffer(cmd_buf, *Core::CurrentProcess(), Kernel::g_handle_table);
157 156
158 return RESULT_SUCCESS; 157 return RESULT_SUCCESS;
159} 158}