aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/paging.cpp58
1 files changed, 0 insertions, 58 deletions
diff --git a/arch/x86_64/src/memory/paging.cpp b/arch/x86_64/src/memory/paging.cpp
index a8f2c40..9774132 100644
--- a/arch/x86_64/src/memory/paging.cpp
+++ b/arch/x86_64/src/memory/paging.cpp
@@ -39,62 +39,4 @@ namespace teachos::arch::memory
"Start address is not aligned with Page");
flags = std::bitset<64U>(frame.start_address()) | flags;
}
-
- page_table::page_table()
- : entries()
- , p4(reinterpret_cast<page_table *>(0xfffffffffffff000))
- {
- // Nothing to do
- }
-
- auto page_table::zero_entries() -> void
- {
- constexpr size_t entry_amount = sizeof(entries) / sizeof(entries[0]);
- for (size_t i = 0; i < entry_amount; ++i)
- {
- auto entry = this->operator[](i);
- entry.set_unused();
- }
- }
-
- auto page_table::next_table(std::size_t index) const -> std::optional<page_table const *>
- {
- auto address = next_table_address(index);
-
- if (address.has_value())
- {
- return reinterpret_cast<page_table const *>(*address);
- }
-
- return std::nullopt;
- }
-
- auto page_table::operator[](std::size_t index) -> entry &
- {
- // C array is not bounds checked, therefore we have to check ourselves, to ensure no out of bounds reads, which
- // could be incredibly hard to debug later.
- arch::exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] index out of bounds");
- return entries[index];
- }
-
- auto page_table::operator[](std::size_t index) const -> entry const &
- {
- // C array is not bounds checked, therefore we have to check ourselves, to ensure no out of bounds reads, which
- // could be incredibly hard to debug later.
- arch::exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] index out of bounds");
- return entries[index];
- }
-
- auto page_table::next_table_address(std::size_t index) const -> std::optional<std::size_t>
- {
- auto entry = this->operator[](index);
-
- if (entry.contains_flags(entry::PRESENT) && !entry.contains_flags(entry::HUGE_PAGE))
- {
- std::size_t const table_address = reinterpret_cast<std::size_t>(this);
- return (table_address << 9) | (index << 12);
- }
- // TODO: Implement behaviour for huge pages currently not done
- return std::nullopt;
- }
} // namespace teachos::arch::memory