diff options
Diffstat (limited to 'src/core/device_memory.h')
| -rw-r--r-- | src/core/device_memory.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/device_memory.h b/src/core/device_memory.h index 5b1ae28f3..c4d17705f 100644 --- a/src/core/device_memory.h +++ b/src/core/device_memory.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/virtual_buffer.h" | 8 | #include "common/host_memory.h" |
| 9 | 9 | ||
| 10 | namespace Core { | 10 | namespace Core { |
| 11 | 11 | ||
| @@ -21,27 +21,30 @@ enum : u64 { | |||
| 21 | }; | 21 | }; |
| 22 | }; // namespace DramMemoryMap | 22 | }; // namespace DramMemoryMap |
| 23 | 23 | ||
| 24 | class DeviceMemory : NonCopyable { | 24 | class DeviceMemory { |
| 25 | public: | 25 | public: |
| 26 | explicit DeviceMemory(); | 26 | explicit DeviceMemory(); |
| 27 | ~DeviceMemory(); | 27 | ~DeviceMemory(); |
| 28 | 28 | ||
| 29 | DeviceMemory& operator=(const DeviceMemory&) = delete; | ||
| 30 | DeviceMemory(const DeviceMemory&) = delete; | ||
| 31 | |||
| 29 | template <typename T> | 32 | template <typename T> |
| 30 | PAddr GetPhysicalAddr(const T* ptr) const { | 33 | PAddr GetPhysicalAddr(const T* ptr) const { |
| 31 | return (reinterpret_cast<uintptr_t>(ptr) - reinterpret_cast<uintptr_t>(buffer.data())) + | 34 | return (reinterpret_cast<uintptr_t>(ptr) - |
| 35 | reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())) + | ||
| 32 | DramMemoryMap::Base; | 36 | DramMemoryMap::Base; |
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | u8* GetPointer(PAddr addr) { | 39 | u8* GetPointer(PAddr addr) { |
| 36 | return buffer.data() + (addr - DramMemoryMap::Base); | 40 | return buffer.BackingBasePointer() + (addr - DramMemoryMap::Base); |
| 37 | } | 41 | } |
| 38 | 42 | ||
| 39 | const u8* GetPointer(PAddr addr) const { | 43 | const u8* GetPointer(PAddr addr) const { |
| 40 | return buffer.data() + (addr - DramMemoryMap::Base); | 44 | return buffer.BackingBasePointer() + (addr - DramMemoryMap::Base); |
| 41 | } | 45 | } |
| 42 | 46 | ||
| 43 | private: | 47 | Common::HostMemory buffer; |
| 44 | Common::VirtualBuffer<u8> buffer; | ||
| 45 | }; | 48 | }; |
| 46 | 49 | ||
| 47 | } // namespace Core | 50 | } // namespace Core |