diff options
| author | 2023-10-22 21:16:38 -0400 | |
|---|---|---|
| committer | 2023-11-10 12:01:35 -0500 | |
| commit | 2a255b2d61a445fb2b83cc8af7632e3d720e1292 (patch) | |
| tree | 37f5c16ba52339d91e57c5b975639dc1eb60b9f7 /src/common/page_table.cpp | |
| parent | Merge pull request #11981 from lucasreis1/patch (diff) | |
| download | yuzu-2a255b2d61a445fb2b83cc8af7632e3d720e1292.tar.gz yuzu-2a255b2d61a445fb2b83cc8af7632e3d720e1292.tar.xz yuzu-2a255b2d61a445fb2b83cc8af7632e3d720e1292.zip | |
kernel: add KPageTableBase
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
Diffstat (limited to 'src/common/page_table.cpp')
| -rw-r--r-- | src/common/page_table.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/common/page_table.cpp b/src/common/page_table.cpp index 4b1690269..166dc3dce 100644 --- a/src/common/page_table.cpp +++ b/src/common/page_table.cpp | |||
| @@ -9,12 +9,12 @@ PageTable::PageTable() = default; | |||
| 9 | 9 | ||
| 10 | PageTable::~PageTable() noexcept = default; | 10 | PageTable::~PageTable() noexcept = default; |
| 11 | 11 | ||
| 12 | bool PageTable::BeginTraversal(TraversalEntry& out_entry, TraversalContext& out_context, | 12 | bool PageTable::BeginTraversal(TraversalEntry* out_entry, TraversalContext* out_context, |
| 13 | u64 address) const { | 13 | Common::ProcessAddress address) const { |
| 14 | // Setup invalid defaults. | 14 | // Setup invalid defaults. |
| 15 | out_entry.phys_addr = 0; | 15 | out_entry->phys_addr = 0; |
| 16 | out_entry.block_size = page_size; | 16 | out_entry->block_size = page_size; |
| 17 | out_context.next_page = 0; | 17 | out_context->next_page = 0; |
| 18 | 18 | ||
| 19 | // Validate that we can read the actual entry. | 19 | // Validate that we can read the actual entry. |
| 20 | const auto page = address / page_size; | 20 | const auto page = address / page_size; |
| @@ -29,20 +29,20 @@ bool PageTable::BeginTraversal(TraversalEntry& out_entry, TraversalContext& out_ | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | // Populate the results. | 31 | // Populate the results. |
| 32 | out_entry.phys_addr = phys_addr + address; | 32 | out_entry->phys_addr = phys_addr + GetInteger(address); |
| 33 | out_context.next_page = page + 1; | 33 | out_context->next_page = page + 1; |
| 34 | out_context.next_offset = address + page_size; | 34 | out_context->next_offset = GetInteger(address) + page_size; |
| 35 | 35 | ||
| 36 | return true; | 36 | return true; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | bool PageTable::ContinueTraversal(TraversalEntry& out_entry, TraversalContext& context) const { | 39 | bool PageTable::ContinueTraversal(TraversalEntry* out_entry, TraversalContext* context) const { |
| 40 | // Setup invalid defaults. | 40 | // Setup invalid defaults. |
| 41 | out_entry.phys_addr = 0; | 41 | out_entry->phys_addr = 0; |
| 42 | out_entry.block_size = page_size; | 42 | out_entry->block_size = page_size; |
| 43 | 43 | ||
| 44 | // Validate that we can read the actual entry. | 44 | // Validate that we can read the actual entry. |
| 45 | const auto page = context.next_page; | 45 | const auto page = context->next_page; |
| 46 | if (page >= backing_addr.size()) { | 46 | if (page >= backing_addr.size()) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -54,9 +54,9 @@ bool PageTable::ContinueTraversal(TraversalEntry& out_entry, TraversalContext& c | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | // Populate the results. | 56 | // Populate the results. |
| 57 | out_entry.phys_addr = phys_addr + context.next_offset; | 57 | out_entry->phys_addr = phys_addr + context->next_offset; |
| 58 | context.next_page = page + 1; | 58 | context->next_page = page + 1; |
| 59 | context.next_offset += page_size; | 59 | context->next_offset += page_size; |
| 60 | 60 | ||
| 61 | return true; | 61 | return true; |
| 62 | } | 62 | } |