From 0ec07e8763336c753f934d0176f946da8963e1c8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 3 May 2020 12:41:30 -0400 Subject: hle_ipc: Eliminate core memory globals We can just pass the required instances into the constructor of the request, eliminating all usages of the global system accessor. --- src/core/hle/kernel/hle_ipc.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/core/hle/kernel/hle_ipc.cpp') 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 @@ #include "common/common_funcs.h" #include "common/common_types.h" #include "common/logging/log.h" -#include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/hle_ipc.h" @@ -57,7 +56,6 @@ std::shared_ptr HLERequestContext::SleepClientThread( return true; }); - auto& kernel = Core::System::GetInstance().Kernel(); if (!writable_event) { // Create event if not provided const auto pair = WritableEvent::CreateEventPair(kernel, "HLE Pause Event: " + reason); @@ -79,9 +77,11 @@ std::shared_ptr HLERequestContext::SleepClientThread( return writable_event; } -HLERequestContext::HLERequestContext(std::shared_ptr server_session, +HLERequestContext::HLERequestContext(KernelCore& kernel, Core::Memory::Memory& memory, + std::shared_ptr server_session, std::shared_ptr thread) - : server_session(std::move(server_session)), thread(std::move(thread)) { + : server_session(std::move(server_session)), + thread(std::move(thread)), kernel{kernel}, memory{memory} { cmd_buf[0] = 0; } @@ -216,7 +216,6 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const HandleTabl ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(Thread& thread) { auto& owner_process = *thread.GetOwnerProcess(); auto& handle_table = owner_process.GetHandleTable(); - auto& memory = Core::System::GetInstance().Memory(); std::array dst_cmdbuf; memory.ReadBlock(owner_process, thread.GetTLSAddress(), dst_cmdbuf.data(), @@ -286,7 +285,6 @@ std::vector HLERequestContext::ReadBuffer(std::size_t buffer_index) const { std::vector buffer; const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && BufferDescriptorA()[buffer_index].Size()}; - auto& memory = Core::System::GetInstance().Memory(); if (is_buffer_a) { ASSERT_MSG(BufferDescriptorA().size() > buffer_index, @@ -319,7 +317,6 @@ std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, size = buffer_size; // TODO(bunnei): This needs to be HW tested } - auto& memory = Core::System::GetInstance().Memory(); if (is_buffer_b) { ASSERT_MSG(BufferDescriptorB().size() > buffer_index, "BufferDescriptorB invalid buffer_index {}", buffer_index); -- cgit v1.2.3