Memory: move GetPointer into class
This commit is contained in:
		| @@ -180,7 +180,8 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses | |||||||
|     Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel(); |     Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel(); | ||||||
|     auto thread = kernel.GetThreadManager().GetCurrentThread(); |     auto thread = kernel.GetThreadManager().GetCurrentThread(); | ||||||
|     // TODO(wwylele): avoid GetPointer |     // TODO(wwylele): avoid GetPointer | ||||||
|     u32* cmd_buf = reinterpret_cast<u32*>(Memory::GetPointer(thread->GetCommandBufferAddress())); |     u32* cmd_buf = reinterpret_cast<u32*>( | ||||||
|  |         Core::System::GetInstance().Memory().GetPointer(thread->GetCommandBufferAddress())); | ||||||
|  |  | ||||||
|     u32 header_code = cmd_buf[0]; |     u32 header_code = cmd_buf[0]; | ||||||
|     auto itr = handlers.find(header_code); |     auto itr = handlers.find(header_code); | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ | |||||||
| #include "common/color.h" | #include "common/color.h" | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/vector_math.h" | #include "common/vector_math.h" | ||||||
|  | #include "core/core.h" | ||||||
| #include "core/hle/service/y2r_u.h" | #include "core/hle/service/y2r_u.h" | ||||||
| #include "core/hw/y2r.h" | #include "core/hw/y2r.h" | ||||||
| #include "core/memory.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. | /// formats to 8-bit. | ||||||
| template <std::size_t N> | template <std::size_t N> | ||||||
| static void ReceiveData(u8* output, ConversionBuffer& buf, std::size_t amount_of_data) { | 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; |     std::size_t output_unit = buf.transfer_unit / N; | ||||||
|     ASSERT(amount_of_data % output_unit == 0); |     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, | static void SendData(const u32* input, ConversionBuffer& buf, int amount_of_data, | ||||||
|                      OutputFormat output_format, u8 alpha) { |                      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) { |     while (amount_of_data > 0) { | ||||||
|         u8* unit_end = output + buf.transfer_unit; |         u8* unit_end = output + buf.transfer_unit; | ||||||
|   | |||||||
| @@ -210,7 +210,7 @@ bool MemorySystem::IsValidPhysicalAddress(const PAddr paddr) { | |||||||
|     return GetPhysicalPointer(paddr) != nullptr; |     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]; |     u8* page_pointer = current_page_table->pointers[vaddr >> PAGE_BITS]; | ||||||
|     if (page_pointer) { |     if (page_pointer) { | ||||||
|         return page_pointer + (vaddr & PAGE_MASK); |         return page_pointer + (vaddr & PAGE_MASK); | ||||||
|   | |||||||
| @@ -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, | void CopyBlock(const Kernel::Process& src_process, const Kernel::Process& dest_process, | ||||||
|                VAddr src_addr, VAddr dest_addr, std::size_t size); |                VAddr src_addr, VAddr dest_addr, std::size_t size); | ||||||
|  |  | ||||||
| u8* GetPointer(VAddr vaddr); |  | ||||||
|  |  | ||||||
| std::string ReadCString(VAddr vaddr, std::size_t max_length); | std::string ReadCString(VAddr vaddr, std::size_t max_length); | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -251,6 +249,8 @@ public: | |||||||
|      */ |      */ | ||||||
|     u8* GetPhysicalPointer(PAddr address); |     u8* GetPhysicalPointer(PAddr address); | ||||||
|  |  | ||||||
|  |     u8* GetPointer(VAddr vaddr); | ||||||
|  |  | ||||||
|     bool IsValidPhysicalAddress(PAddr paddr); |     bool IsValidPhysicalAddress(PAddr paddr); | ||||||
|  |  | ||||||
|     /// Gets offset in FCRAM from a pointer inside FCRAM range |     /// Gets offset in FCRAM from a pointer inside FCRAM range | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Weiyi Wang
					Weiyi Wang