From 588fe1a3600475bdc312a4fe758d2f1125eb149c Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 2 Dec 2025 18:56:12 +0100 Subject: x86_64: basic code cleanup --- arch/x86_64/include/x86_64/memory/page_table.hpp | 6 +++--- arch/x86_64/include/x86_64/memory/paging_root.hpp | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'arch/x86_64/include') diff --git a/arch/x86_64/include/x86_64/memory/page_table.hpp b/arch/x86_64/include/x86_64/memory/page_table.hpp index 6b8eb8c..c5102a2 100644 --- a/arch/x86_64/include/x86_64/memory/page_table.hpp +++ b/arch/x86_64/include/x86_64/memory/page_table.hpp @@ -16,9 +16,6 @@ namespace teachos::memory::x86_64 //! A table containing paging entries. struct page_table { - //! The maximum number of entries in this table. - constexpr auto static entry_count{512}; - //! A single page table entry struct entry { @@ -67,6 +64,9 @@ namespace teachos::memory::x86_64 std::uint64_t m_raw{}; }; + //! The maximum number of entries in this table. + constexpr auto static entry_count{page::size / sizeof(entry)}; + //! Get the entry at the given index. [[nodiscard]] auto operator[](std::size_t index) -> entry &; [[nodiscard]] auto operator[](std::size_t index) const -> entry const &; diff --git a/arch/x86_64/include/x86_64/memory/paging_root.hpp b/arch/x86_64/include/x86_64/memory/paging_root.hpp index e9b8eef..a9ab6a6 100644 --- a/arch/x86_64/include/x86_64/memory/paging_root.hpp +++ b/arch/x86_64/include/x86_64/memory/paging_root.hpp @@ -20,6 +20,8 @@ namespace teachos::memory::x86_64 auto operator=(paging_root const &) -> paging_root & = delete; auto operator=(paging_root &&) -> paging_root & = delete; + ~paging_root() = delete; + [[nodiscard]] auto translate(linear_address address) const -> std::optional; [[nodiscard]] auto translate(page page) const -> std::optional; -- cgit v1.2.3