diff options
Diffstat (limited to 'src/core/device_memory.h')
| -rw-r--r-- | src/core/device_memory.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/device_memory.h b/src/core/device_memory.h index 90510733c..13388b73e 100644 --- a/src/core/device_memory.h +++ b/src/core/device_memory.h | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | ||
| 7 | #include "common/host_memory.h" | 6 | #include "common/host_memory.h" |
| 7 | #include "common/typed_address.h" | ||
| 8 | 8 | ||
| 9 | namespace Core { | 9 | namespace Core { |
| 10 | 10 | ||
| @@ -25,20 +25,22 @@ public: | |||
| 25 | DeviceMemory(const DeviceMemory&) = delete; | 25 | DeviceMemory(const DeviceMemory&) = delete; |
| 26 | 26 | ||
| 27 | template <typename T> | 27 | template <typename T> |
| 28 | PAddr GetPhysicalAddr(const T* ptr) const { | 28 | Common::PhysicalAddress GetPhysicalAddr(const T* ptr) const { |
| 29 | return (reinterpret_cast<uintptr_t>(ptr) - | 29 | return (reinterpret_cast<uintptr_t>(ptr) - |
| 30 | reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())) + | 30 | reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())) + |
| 31 | DramMemoryMap::Base; | 31 | DramMemoryMap::Base; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | template <typename T> | 34 | template <typename T> |
| 35 | T* GetPointer(PAddr addr) { | 35 | T* GetPointer(Common::PhysicalAddress addr) { |
| 36 | return reinterpret_cast<T*>(buffer.BackingBasePointer() + (addr - DramMemoryMap::Base)); | 36 | return reinterpret_cast<T*>(buffer.BackingBasePointer() + |
| 37 | (GetInteger(addr) - DramMemoryMap::Base)); | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | template <typename T> | 40 | template <typename T> |
| 40 | const T* GetPointer(PAddr addr) const { | 41 | const T* GetPointer(Common::PhysicalAddress addr) const { |
| 41 | return reinterpret_cast<T*>(buffer.BackingBasePointer() + (addr - DramMemoryMap::Base)); | 42 | return reinterpret_cast<T*>(buffer.BackingBasePointer() + |
| 43 | (GetInteger(addr) - DramMemoryMap::Base)); | ||
| 42 | } | 44 | } |
| 43 | 45 | ||
| 44 | Common::HostMemory buffer; | 46 | Common::HostMemory buffer; |