diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging/page_entry.hpp | 8 | ||||
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_entry.cpp | 6 | ||||
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_table.cpp | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86_64/include/arch/memory/paging/page_entry.hpp b/arch/x86_64/include/arch/memory/paging/page_entry.hpp index 9ca5469..ba972d6 100644 --- a/arch/x86_64/include/arch/memory/paging/page_entry.hpp +++ b/arch/x86_64/include/arch/memory/paging/page_entry.hpp @@ -35,6 +35,14 @@ namespace teachos::arch::memory::paging }; /** + * @brief Creates a new entry object from a 64bit address. Should follow the scheme where bit index 12 - 51 are the + * actual address and the other bits are flags. + * + * @param flags Flags that will be passed to underlying std::bitset. + */ + explicit entry(uint64_t flags); + + /** * @brief Whether the current page is unused, meaning the underlying std::bitset is 0. * * @return Current page is in memory. diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp index 5d597ab..09d048b 100644 --- a/arch/x86_64/src/memory/paging/page_entry.cpp +++ b/arch/x86_64/src/memory/paging/page_entry.cpp @@ -4,6 +4,12 @@ namespace teachos::arch::memory::paging { + entry::entry(uint64_t flags) + : flags(flags) + { + // Nothing to do. + } + auto entry::is_unused() const -> bool { return flags == 0U; } auto entry::set_unused() -> void { flags = 0U; } diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp index c0f199a..4747e0b 100644 --- a/arch/x86_64/src/memory/paging/page_table.cpp +++ b/arch/x86_64/src/memory/paging/page_table.cpp @@ -123,6 +123,8 @@ namespace teachos::arch::memory::paging std::construct_at(reinterpret_cast<page_table *>(&_end_of_image + offset)); } } + size_t const flags = reinterpret_cast<size_t>(level3_page_table); + this->operator[](0U) = entry{flags}; } auto page_table_handle::zero_entries() -> void { handle->zero_entries(); } |
