mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 11:05:46 +00:00
kernel: memory: page_table: Simplify GetPhysicalAddr impl.
This commit is contained in:
parent
6b40850b9a
commit
27b5b6c36f
4 changed files with 6 additions and 19 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue