aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/paging.cpp
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-16 13:33:23 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-10-16 13:33:23 +0000
commit934822e48a7c5a3e65ed74261ce5ab4315595f64 (patch)
treefa9e04075b5924d74ee25f0353ce2492099bdee6 /arch/x86_64/src/memory/paging.cpp
parentf56004a77314d4b4d68bfaf496fd7c6013ba7a27 (diff)
downloadteachos-934822e48a7c5a3e65ed74261ce5ab4315595f64.tar.xz
teachos-934822e48a7c5a3e65ed74261ce5ab4315595f64.zip
Fix compilation issues with assigning values to page_map_variable address
Diffstat (limited to 'arch/x86_64/src/memory/paging.cpp')
-rw-r--r--arch/x86_64/src/memory/paging.cpp13
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