diff options
Diffstat (limited to 'arch/x86_64/src/memory/paging.cpp')
| -rw-r--r-- | arch/x86_64/src/memory/paging.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/x86_64/src/memory/paging.cpp b/arch/x86_64/src/memory/paging.cpp index 2f78da8..a07b2c0 100644 --- a/arch/x86_64/src/memory/paging.cpp +++ b/arch/x86_64/src/memory/paging.cpp @@ -42,12 +42,9 @@ namespace teachos::arch::memory auto page_table::zero_entries() -> void { - auto begin = &entries[0]; - auto end = &entries[PAGE_TABLE_ENTRY_COUNT]; - - for (auto entry = begin; entry < end; ++entry) + for (size_t i = 0; i < sizeof(entries) / sizeof(entries[0]); ++i) { - entry->set_unused(); + entries[i].set_unused(); } } @@ -75,4 +72,10 @@ namespace teachos::arch::memory return std::nullopt; } + + entry & page_table::operator[](std::size_t index) + { + arch::exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] index out of bounds"); + return entries[index]; + } } // namespace teachos::arch::memory |
