summaryrefslogtreecommitdiffstats
path: root/src/core/device_memory.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-04-09 05:37:24 +0200
committerbunnei <bunneidev@gmail.com>2020-04-17 06:59:35 +0200
commita8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0 (patch)
treeff88e12685101a4f451b5bb56894ff4e7128d0ce /src/core/device_memory.h
parentkernel: svc: Updates for new VMM. (diff)
downloadyuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar.gz
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar.bz2
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar.lz
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar.xz
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.tar.zst
yuzu-a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0.zip
Diffstat (limited to 'src/core/device_memory.h')
-rw-r--r--src/core/device_memory.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/device_memory.h b/src/core/device_memory.h
index 44458c2b5..cc7bda070 100644
--- a/src/core/device_memory.h
+++ b/src/core/device_memory.h
@@ -28,15 +28,11 @@ public:
~DeviceMemory();
template <typename T>
- PAddr GetPhysicalAddr(T* ptr) {
- const auto ptr_addr{reinterpret_cast<uintptr_t>(ptr)};
- const auto base_addr{reinterpret_cast<uintptr_t>(buffer.data())};
- ASSERT(ptr_addr >= base_addr);
- return ptr_addr - base_addr + DramMemoryMap::Base;
+ constexpr PAddr GetPhysicalAddr(T* ptr) {
+ return (reinterpret_cast<uintptr_t>(ptr) - reinterpret_cast<uintptr_t>(buffer.data())) +
+ DramMemoryMap::Base;
}
- PAddr GetPhysicalAddr(VAddr addr);
-
constexpr u8* GetPointer(PAddr addr) {
return buffer.data() + (addr - DramMemoryMap::Base);
}