diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 11 | ||||
| -rw-r--r-- | src/core/hle/kernel/server_session.cpp | 4 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 91d94025c..ba0eac4c2 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | #include "common/common_funcs.h" | 13 | #include "common/common_funcs.h" |
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 16 | #include "core/core.h" | ||
| 17 | #include "core/hle/ipc_helpers.h" | 16 | #include "core/hle/ipc_helpers.h" |
| 18 | #include "core/hle/kernel/handle_table.h" | 17 | #include "core/hle/kernel/handle_table.h" |
| 19 | #include "core/hle/kernel/hle_ipc.h" | 18 | #include "core/hle/kernel/hle_ipc.h" |
| @@ -57,7 +56,6 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 57 | return true; | 56 | return true; |
| 58 | }); | 57 | }); |
| 59 | 58 | ||
| 60 | auto& kernel = Core::System::GetInstance().Kernel(); | ||
| 61 | if (!writable_event) { | 59 | if (!writable_event) { |
| 62 | // Create event if not provided | 60 | // Create event if not provided |
| 63 | const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason); | 61 | const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason); |
| @@ -79,9 +77,11 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 79 | return writable_event; | 77 | return writable_event; |
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | HLERequestContext::HLERequestContext(std::shared_ptr<Kernel::ServerSession> server_session, | 80 | HLERequestContext::HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, |
| 81 | std::shared_ptr<ServerSession> server_session, | ||
| 83 | std::shared_ptr<Thread> thread) | 82 | std::shared_ptr<Thread> thread) |
| 84 | : server_session(std::move(server_session)), thread(std::move(thread)) { | 83 | : server_session(std::move(server_session)), |
| 84 | thread(std::move(thread)), kernel{kernel}, memory{memory} { | ||
| 85 | cmd_buf[0] = 0; | 85 | cmd_buf[0] = 0; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -216,7 +216,6 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const HandleTabl | |||
| 216 | ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { | 216 | ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { |
| 217 | auto& owner_process = *thread.GetOwnerProcess(); | 217 | auto& owner_process = *thread.GetOwnerProcess(); |
| 218 | auto& handle_table = owner_process.GetHandleTable(); | 218 | auto& handle_table = owner_process.GetHandleTable(); |
| 219 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 220 | 219 | ||
| 221 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf; | 220 | std::array<u32, IPC::COMMAND_BUFFER_LENGTH> dst_cmdbuf; |
| 222 | memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(), | 221 | memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(), |
| @@ -286,7 +285,6 @@ std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | |||
| 286 | std::vector<u8> buffer; | 285 | std::vector<u8> buffer; |
| 287 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | 286 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && |
| 288 | BufferDescriptorA()[buffer_index].Size()}; | 287 | BufferDescriptorA()[buffer_index].Size()}; |
| 289 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 290 | 288 | ||
| 291 | if (is_buffer_a) { | 289 | if (is_buffer_a) { |
| 292 | ASSERT_MSG(BufferDescriptorA().size() > buffer_index, | 290 | ASSERT_MSG(BufferDescriptorA().size() > buffer_index, |
| @@ -319,7 +317,6 @@ std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, | |||
| 319 | size = buffer_size; // TODO(bunnei): This needs to be HW tested | 317 | size = buffer_size; // TODO(bunnei): This needs to be HW tested |
| 320 | } | 318 | } |
| 321 | 319 | ||
| 322 | auto& memory = Core::System::GetInstance().Memory(); | ||
| 323 | if (is_buffer_b) { | 320 | if (is_buffer_b) { |
| 324 | ASSERT_MSG(BufferDescriptorB().size() > buffer_index, | 321 | ASSERT_MSG(BufferDescriptorB().size() > buffer_index, |
| 325 | "BufferDescriptorB invalid buffer_index {}", buffer_index); | 322 | "BufferDescriptorB invalid buffer_index {}", buffer_index); |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index af3330297..b31673928 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | 19 | ||
| 20 | union ResultCode; | 20 | union ResultCode; |
| 21 | 21 | ||
| 22 | namespace Core::Memory { | ||
| 23 | class Memory; | ||
| 24 | } | ||
| 25 | |||
| 22 | namespace Service { | 26 | namespace Service { |
| 23 | class ServiceFrameworkBase; | 27 | class ServiceFrameworkBase; |
| 24 | } | 28 | } |
| @@ -28,6 +32,7 @@ namespace Kernel { | |||
| 28 | class Domain; | 32 | class Domain; |
| 29 | class HandleTable; | 33 | class HandleTable; |
| 30 | class HLERequestContext; | 34 | class HLERequestContext; |
| 35 | class KernelCore; | ||
| 31 | class Process; | 36 | class Process; |
| 32 | class ServerSession; | 37 | class ServerSession; |
| 33 | class Thread; | 38 | class Thread; |
| @@ -98,7 +103,8 @@ protected: | |||
| 98 | */ | 103 | */ |
| 99 | class HLERequestContext { | 104 | class HLERequestContext { |
| 100 | public: | 105 | public: |
| 101 | explicit HLERequestContext(std::shared_ptr<ServerSession> session, | 106 | explicit HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, |
| 107 | std::shared_ptr<ServerSession> session, | ||
| 102 | std::shared_ptr<Thread> thread); | 108 | std::shared_ptr<Thread> thread); |
| 103 | ~HLERequestContext(); | 109 | ~HLERequestContext(); |
| 104 | 110 | ||
| @@ -305,6 +311,9 @@ private: | |||
| 305 | 311 | ||
| 306 | std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; | 312 | std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; |
| 307 | bool is_thread_waiting{}; | 313 | bool is_thread_waiting{}; |
| 314 | |||
| 315 | KernelCore& kernel; | ||
| 316 | Core::Memory::Memory& memory; | ||
| 308 | }; | 317 | }; |
| 309 | 318 | ||
| 310 | } // namespace Kernel | 319 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 0f102ca44..25438b86b 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -137,8 +137,8 @@ ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& con | |||
| 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, | 137 | ResultCode ServerSession::QueueSyncRequest(std::shared_ptr<Thread> thread, |
| 138 | Core::Memory::Memory& memory) { | 138 | Core::Memory::Memory& memory) { |
| 139 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; | 139 | u32* cmd_buf{reinterpret_cast<u32*>(memory.GetPointer(thread->GetTLSAddress()))}; |
| 140 | std::shared_ptr<Kernel::HLERequestContext> context{ | 140 | auto context = |
| 141 | std::make_shared<Kernel::HLERequestContext>(SharedFrom(this), std::move(thread))}; | 141 | std::make_shared<HLERequestContext>(kernel, memory, SharedFrom(this), std::move(thread)); |
| 142 | 142 | ||
| 143 | context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); | 143 | context->PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); |
| 144 | request_queue.Push(std::move(context)); | 144 | request_queue.Push(std::move(context)); |