diff options
author | bunnei <bunneidev@gmail.com> | 2022-02-18 23:42:27 -0800 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2022-02-18 23:42:27 -0800 |
commit | 1a16d055dfbeee20a402379d6d4f3e96f8715648 (patch) | |
tree | 7a3faf3f03e6dbdba77fe8206727fba6320b9819 /src/common/page_table.h | |
parent | 83a84f1c2dce5a9f90404f2486da569e236f96fa (diff) |
core: hle: kernel: KPageTable: Improve Un/MapPhysicalMemory.
- Improves the implementations of MapPhysicalMemory and UnmapPhysicalMemory to more closely reflect latest HOS.
Diffstat (limited to 'src/common/page_table.h')
-rw-r--r-- | src/common/page_table.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/common/page_table.h b/src/common/page_table.h index 8267e8b4d8..fe254d7ae4 100644 --- a/src/common/page_table.h +++ b/src/common/page_table.h @@ -27,6 +27,16 @@ enum class PageType : u8 { * mimics the way a real CPU page table works. */ struct PageTable { + struct TraversalEntry { + u64 phys_addr{}; + std::size_t block_size{}; + }; + + struct TraversalContext { + u64 next_page{}; + u64 next_offset{}; + }; + /// Number of bits reserved for attribute tagging. /// This can be at most the guaranteed alignment of the pointers in the page table. static constexpr int ATTRIBUTE_BITS = 2; @@ -89,6 +99,10 @@ 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; + /** * Resizes the page table to be able to accommodate enough pages within * a given address space. @@ -96,9 +110,9 @@ struct PageTable { * @param address_space_width_in_bits The address size width in bits. * @param page_size_in_bits The page size in bits. */ - void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits); + void Resize(std::size_t address_space_width_in_bits, std::size_t page_size_in_bits); - size_t GetAddressSpaceBits() const { + std::size_t GetAddressSpaceBits() const { return current_address_space_width_in_bits; } @@ -110,9 +124,11 @@ struct PageTable { VirtualBuffer<u64> backing_addr; - size_t current_address_space_width_in_bits; + std::size_t current_address_space_width_in_bits{}; + + u8* fastmem_arena{}; - u8* fastmem_arena; + std::size_t page_size{}; }; } // namespace Common |