From a040a152468bbd315781c3d50bea484c07e2e02a Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 8 Apr 2020 17:39:58 -0400 Subject: core: device_memory: Update to use VirtualBuffer class. --- src/core/device_memory.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/device_memory.h') diff --git a/src/core/device_memory.h b/src/core/device_memory.h index a60a7238a..44458c2b5 100644 --- a/src/core/device_memory.h +++ b/src/core/device_memory.h @@ -6,7 +6,7 @@ #include "common/assert.h" #include "common/common_funcs.h" -#include "core/hle/kernel/physical_memory.h" +#include "common/virtual_buffer.h" namespace Core { @@ -24,24 +24,25 @@ constexpr u64 SlabHeapEnd = SlabHeapBase + SlapHeapSize; class DeviceMemory : NonCopyable { public: - DeviceMemory(Core::System& system); + explicit DeviceMemory(Core::System& system); ~DeviceMemory(); template PAddr GetPhysicalAddr(T* ptr) { const auto ptr_addr{reinterpret_cast(ptr)}; - const auto base_addr{reinterpret_cast(base)}; + const auto base_addr{reinterpret_cast(buffer.data())}; ASSERT(ptr_addr >= base_addr); return ptr_addr - base_addr + DramMemoryMap::Base; } PAddr GetPhysicalAddr(VAddr addr); - u8* GetPointer(PAddr addr); + constexpr u8* GetPointer(PAddr addr) { + return buffer.data() + (addr - DramMemoryMap::Base); + } private: - u8* base{}; - Kernel::PhysicalMemory physical_memory; + Common::VirtualBuffer buffer; Core::System& system; }; -- cgit v1.2.3