diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-11 15:45:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-11 15:45:29 +0100 |
commit | 40d4e9543b5792dfa761b44d4c6017d5692f77a3 (patch) | |
tree | 019cb6ca42ee3b89b400bb624e933abf695e150c /src/common/page_table.h | |
parent | Merge pull request #11981 from lucasreis1/patch (diff) | |
parent | k_page_table: fix shutdown (diff) | |
download | yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.gz yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.bz2 yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.lz yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.xz yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.zst yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.zip |
Diffstat (limited to 'src/common/page_table.h')
-rw-r--r-- | src/common/page_table.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/common/page_table.h b/src/common/page_table.h index e653d52ad..5340f7d86 100644 --- a/src/common/page_table.h +++ b/src/common/page_table.h @@ -6,6 +6,7 @@ #include <atomic> #include "common/common_types.h" +#include "common/typed_address.h" #include "common/virtual_buffer.h" namespace Common { @@ -100,9 +101,9 @@ struct PageTable { PageTable(PageTable&&) noexcept = default; PageTable& operator=(PageTable&&) noexcept = default; - bool BeginTraversal(TraversalEntry& out_entry, TraversalContext& out_context, - u64 address) const; - bool ContinueTraversal(TraversalEntry& out_entry, TraversalContext& context) const; + bool BeginTraversal(TraversalEntry* out_entry, TraversalContext* out_context, + Common::ProcessAddress address) const; + bool ContinueTraversal(TraversalEntry* out_entry, TraversalContext* context) const; /** * Resizes the page table to be able to accommodate enough pages within @@ -117,6 +118,16 @@ struct PageTable { return current_address_space_width_in_bits; } + bool GetPhysicalAddress(Common::PhysicalAddress* out_phys_addr, + Common::ProcessAddress virt_addr) const { + if (virt_addr > (1ULL << this->GetAddressSpaceBits())) { + return false; + } + + *out_phys_addr = backing_addr[virt_addr / page_size] + GetInteger(virt_addr); + return true; + } + /** * Vector of memory pointers backing each page. An entry can only be non-null if the * corresponding attribute element is of type `Memory`. |