diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 795f720e3a..b065208d33 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -180,7 +180,8 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr server_ses Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel(); auto thread = kernel.GetThreadManager().GetCurrentThread(); // TODO(wwylele): avoid GetPointer - u32* cmd_buf = reinterpret_cast(Memory::GetPointer(thread->GetCommandBufferAddress())); + u32* cmd_buf = reinterpret_cast( + Core::System::GetInstance().Memory().GetPointer(thread->GetCommandBufferAddress())); u32 header_code = cmd_buf[0]; auto itr = handlers.find(header_code); diff --git a/src/core/hw/y2r.cpp b/src/core/hw/y2r.cpp index c1f99b571a..a613bbed59 100644 --- a/src/core/hw/y2r.cpp +++ b/src/core/hw/y2r.cpp @@ -10,6 +10,7 @@ #include "common/color.h" #include "common/common_types.h" #include "common/vector_math.h" +#include "core/core.h" #include "core/hle/service/y2r_u.h" #include "core/hw/y2r.h" #include "core/memory.h" @@ -80,7 +81,7 @@ static void ConvertYUVToRGB(InputFormat input_format, const u8* input_Y, const u /// formats to 8-bit. template static void ReceiveData(u8* output, ConversionBuffer& buf, std::size_t amount_of_data) { - const u8* input = Memory::GetPointer(buf.address); + const u8* input = Core::System::GetInstance().Memory().GetPointer(buf.address); std::size_t output_unit = buf.transfer_unit / N; ASSERT(amount_of_data % output_unit == 0); @@ -104,7 +105,7 @@ static void ReceiveData(u8* output, ConversionBuffer& buf, std::size_t amount_of static void SendData(const u32* input, ConversionBuffer& buf, int amount_of_data, OutputFormat output_format, u8 alpha) { - u8* output = Memory::GetPointer(buf.address); + u8* output = Core::System::GetInstance().Memory().GetPointer(buf.address); while (amount_of_data > 0) { u8* unit_end = output + buf.transfer_unit; diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 27d6109c48..8c260c1f76 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -210,7 +210,7 @@ bool MemorySystem::IsValidPhysicalAddress(const PAddr paddr) { return GetPhysicalPointer(paddr) != nullptr; } -u8* GetPointer(const VAddr vaddr) { +u8* MemorySystem::GetPointer(const VAddr vaddr) { u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; if (page_pointer) { return page_pointer + (vaddr & PAGE_MASK); diff --git a/src/core/memory.h b/src/core/memory.h index 97645c0b91..ffafc4c1c9 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -198,8 +198,6 @@ void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, void CopyBlock(const Kernel::Process& src_process, const Kernel::Process& dest_process, VAddr src_addr, VAddr dest_addr, std::size_t size); -u8* GetPointer(VAddr vaddr); - std::string ReadCString(VAddr vaddr, std::size_t max_length); /** @@ -251,6 +249,8 @@ public: */ u8* GetPhysicalPointer(PAddr address); + u8* GetPointer(VAddr vaddr); + bool IsValidPhysicalAddress(PAddr paddr); /// Gets offset in FCRAM from a pointer inside FCRAM range