From a8292f6cd9f8b4088ee85b59a87e5bf0ce387cf0 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 8 Apr 2020 23:37:24 -0400 Subject: kernel: memory: page_table: Simplify GetPhysicalAddr impl. --- src/core/hle/kernel/memory/page_table.cpp | 4 ---- src/core/hle/kernel/memory/page_table.h | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/memory/page_table.cpp b/src/core/hle/kernel/memory/page_table.cpp index 93e7253e2..941ecda21 100644 --- a/src/core/hle/kernel/memory/page_table.cpp +++ b/src/core/hle/kernel/memory/page_table.cpp @@ -936,10 +936,6 @@ ResultVal PageTable::AllocateAndMapMemory(std::size_t needed_num_pages, s return MakeResult(addr); } -PAddr PageTable::GetPhysicalAddr(VAddr addr) { - return system.DeviceMemory().GetPhysicalAddr(addr); -} - ResultCode PageTable::InitializeMemoryLayout(VAddr start, VAddr end) { block_manager = std::make_unique(start, end); diff --git a/src/core/hle/kernel/memory/page_table.h b/src/core/hle/kernel/memory/page_table.h index 6c3a3c275..80384ab0f 100644 --- a/src/core/hle/kernel/memory/page_table.h +++ b/src/core/hle/kernel/memory/page_table.h @@ -53,7 +53,6 @@ public: bool is_map_only, VAddr region_start, std::size_t region_num_pages, MemoryState state, MemoryPermission perm, PAddr map_addr = 0); - PAddr GetPhysicalAddr(VAddr addr); Common::PageTable& PageTableImpl() { return page_table_impl; @@ -211,6 +210,9 @@ public: constexpr bool IsInsideASLRRegion(VAddr address, std::size_t size) const { return !IsOutsideASLRRegion(address, size); } + constexpr PAddr GetPhysicalAddr(VAddr addr) { + return page_table_impl.backing_addr[addr >> Memory::PageBits] + addr; + } private: constexpr bool Contains(VAddr addr) const { -- cgit v1.2.3