aboutsummaryrefslogtreecommitdiff
path: root/src/core/device_memory.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-03-23 10:00:19 -0400
committerGitHub <noreply@github.com>2023-03-23 10:00:19 -0400
commitc41a4baf06efe935f08331bc6f8ff6d80dc088f5 (patch)
treea6580d41bd440b240b2f60db38fdeec60fca2eff /src/core/device_memory.h
parent6adaa0d5e27ee426a53a16a66d587d6929602bee (diff)
parentfb49ec19c1fb6030fcc960077e82c998290d0ab8 (diff)
Merge pull request #9964 from liamwhite/typed-address
kernel: use KTypedAddress for addresses
Diffstat (limited to 'src/core/device_memory.h')
-rw-r--r--src/core/device_memory.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/device_memory.h b/src/core/device_memory.h
index 90510733c8..13388b73e0 100644
--- a/src/core/device_memory.h
+++ b/src/core/device_memory.h
@@ -3,8 +3,8 @@
#pragma once
-#include "common/common_types.h"
#include "common/host_memory.h"
+#include "common/typed_address.h"
namespace Core {
@@ -25,20 +25,22 @@ public:
DeviceMemory(const DeviceMemory&) = delete;
template <typename T>
- PAddr GetPhysicalAddr(const T* ptr) const {
+ Common::PhysicalAddress GetPhysicalAddr(const T* ptr) const {
return (reinterpret_cast<uintptr_t>(ptr) -
reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())) +
DramMemoryMap::Base;
}
template <typename T>
- T* GetPointer(PAddr addr) {
- return reinterpret_cast<T*>(buffer.BackingBasePointer() + (addr - DramMemoryMap::Base));
+ T* GetPointer(Common::PhysicalAddress addr) {
+ return reinterpret_cast<T*>(buffer.BackingBasePointer() +
+ (GetInteger(addr) - DramMemoryMap::Base));
}
template <typename T>
- const T* GetPointer(PAddr addr) const {
- return reinterpret_cast<T*>(buffer.BackingBasePointer() + (addr - DramMemoryMap::Base));
+ const T* GetPointer(Common::PhysicalAddress addr) const {
+ return reinterpret_cast<T*>(buffer.BackingBasePointer() +
+ (GetInteger(addr) - DramMemoryMap::Base));
}
Common::HostMemory buffer;