Memory: move GetPointer into class

This commit is contained in:
Weiyi Wang 2018-11-21 13:51:12 -05:00
parent 405218c3a7
commit 76e0a4ece7
4 changed files with 8 additions and 6 deletions

View file

@ -180,7 +180,8 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
Kernel::KernelSystem& kernel = Core::System::GetInstance().Kernel();
auto thread = kernel.GetThreadManager().GetCurrentThread();
// 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];
auto itr = handlers.find(header_code);

View file

@ -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 <std::size_t N>
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;

View file

@ -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);

View file

@ -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