diff options
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/multiboot.hpp | 4 | ||||
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging.hpp | 43 |
2 files changed, 31 insertions, 16 deletions
diff --git a/arch/x86_64/include/arch/memory/multiboot.hpp b/arch/x86_64/include/arch/memory/multiboot.hpp index 9a753fa..9cca8bc 100644 --- a/arch/x86_64/include/arch/memory/multiboot.hpp +++ b/arch/x86_64/include/arch/memory/multiboot.hpp @@ -194,7 +194,9 @@ namespace teachos::arch::memory auto operator==(elf_section_flags const & other) const -> bool = default; private: - std::bitset<64U> flags; + std::bitset<64U> flags; ///< Underlying bitset used to read the flags from. Bits 21 - 28 are reserved for operating + ///< system specific semantics and bits 29 - 32 are reserved for processor specific + ///< semantics. Bits 33 - 64 are unused for compatability with ELF32. }; /** diff --git a/arch/x86_64/include/arch/memory/paging.hpp b/arch/x86_64/include/arch/memory/paging.hpp index 4092d18..d55835e 100644 --- a/arch/x86_64/include/arch/memory/paging.hpp +++ b/arch/x86_64/include/arch/memory/paging.hpp @@ -111,40 +111,53 @@ namespace teachos::arch::memory struct page_table { /** + * @brief Constructor. + */ + page_table(); + + /** * @brief Set every entry of the page to unused */ auto zero_entries() -> void; /** - * @brief Find and return the next table address + * @brief Convert the address of a page_table into a page_table * - * The next table address is only valid if the corresponding entry is present - * and does not create a huge page + * @param index Index of the entry we want to access + * @return An optional of the next page table or null + */ + auto next_table(std::size_t index) const -> std::optional<const page_table *>; + + /** + * @brief Index operator overload to access specific mutable entry directy * - * @param index - * @return An optional of the address of the next page table or null + * @param index Index of the entry we want to access and change + * @return Entry at the given table index */ - auto next_table_address(std::size_t index) const -> std::optional<std::size_t>; + auto operator[](std::size_t index) -> entry &; /** - * @brief Convert the address of a page_table into a page_table + * @brief Index operator overload to access specific immutable entry directy * - * @param index - * @return An optional of the next page table or null + * @param index Index of the entry we want to access and only read + * @return Entry at the given table index */ - auto next_table(std::size_t index) const -> std::optional<const page_table *>; + auto operator[](std::size_t index) const -> entry const &; + private: /** - * @brief Index operator overload to access specific entries directy + * @brief Find and return the next table address + * + * The next table address is only valid if the corresponding entry is present + * and does not create a huge page * * @param index - * @return The address of the accessed entry + * @return An optional of the address of the next page table or null */ - entry & operator[](std::size_t index); + auto next_table_address(std::size_t index) const -> std::optional<std::size_t>; - private: entry entries[PAGE_TABLE_ENTRY_COUNT]; - page_table const * p4 = reinterpret_cast<page_table *>(0xfffffffffffff000); + page_table const * p4; }; } // namespace teachos::arch::memory |
