diff options
| author | 2023-11-11 09:45:29 -0500 | |
|---|---|---|
| committer | 2023-11-11 09:45:29 -0500 | |
| 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.gz yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.tar.xz yuzu-40d4e9543b5792dfa761b44d4c6017d5692f77a3.zip | |
Merge pull request #11914 from liamwhite/newer-kpagetable
kernel: add KPageTableBase
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 @@ | |||
| 6 | #include <atomic> | 6 | #include <atomic> |
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/typed_address.h" | ||
| 9 | #include "common/virtual_buffer.h" | 10 | #include "common/virtual_buffer.h" |
| 10 | 11 | ||
| 11 | namespace Common { | 12 | namespace Common { |
| @@ -100,9 +101,9 @@ struct PageTable { | |||
| 100 | PageTable(PageTable&&) noexcept = default; | 101 | PageTable(PageTable&&) noexcept = default; |
| 101 | PageTable& operator=(PageTable&&) noexcept = default; | 102 | PageTable& operator=(PageTable&&) noexcept = default; |
| 102 | 103 | ||
| 103 | bool BeginTraversal(TraversalEntry& out_entry, TraversalContext& out_context, | 104 | bool BeginTraversal(TraversalEntry* out_entry, TraversalContext* out_context, |
| 104 | u64 address) const; | 105 | Common::ProcessAddress address) const; |
| 105 | bool ContinueTraversal(TraversalEntry& out_entry, TraversalContext& context) const; | 106 | bool ContinueTraversal(TraversalEntry* out_entry, TraversalContext* context) const; |
| 106 | 107 | ||
| 107 | /** | 108 | /** |
| 108 | * Resizes the page table to be able to accommodate enough pages within | 109 | * Resizes the page table to be able to accommodate enough pages within |
| @@ -117,6 +118,16 @@ struct PageTable { | |||
| 117 | return current_address_space_width_in_bits; | 118 | return current_address_space_width_in_bits; |
| 118 | } | 119 | } |
| 119 | 120 | ||
| 121 | bool GetPhysicalAddress(Common::PhysicalAddress* out_phys_addr, | ||
| 122 | Common::ProcessAddress virt_addr) const { | ||
| 123 | if (virt_addr > (1ULL << this->GetAddressSpaceBits())) { | ||
| 124 | return false; | ||
| 125 | } | ||
| 126 | |||
| 127 | *out_phys_addr = backing_addr[virt_addr / page_size] + GetInteger(virt_addr); | ||
| 128 | return true; | ||
| 129 | } | ||
| 130 | |||
| 120 | /** | 131 | /** |
| 121 | * Vector of memory pointers backing each page. An entry can only be non-null if the | 132 | * Vector of memory pointers backing each page. An entry can only be non-null if the |
| 122 | * corresponding attribute element is of type `Memory`. | 133 | * corresponding attribute element is of type `Memory`. |