diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-15 08:40:56 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-15 08:40:56 +0000 |
| commit | 03d3dec4807d6adcfc5e21bd13992014900b4eac (patch) | |
| tree | a5c083c33ce4eea3e538ac1a62e58ed2d7cfee7c /arch/x86_64/include | |
| parent | 205934ca45d591924b4be6e7ae5a8849958e0cf6 (diff) | |
| download | teachos-03d3dec4807d6adcfc5e21bd13992014900b4eac.tar.xz teachos-03d3dec4807d6adcfc5e21bd13992014900b4eac.zip | |
implement page table members
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/frame_allocator.hpp | 4 | ||||
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging.hpp | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/arch/x86_64/include/arch/memory/frame_allocator.hpp b/arch/x86_64/include/arch/memory/frame_allocator.hpp index 69c108c..3d1f826 100644 --- a/arch/x86_64/include/arch/memory/frame_allocator.hpp +++ b/arch/x86_64/include/arch/memory/frame_allocator.hpp @@ -32,9 +32,9 @@ namespace teachos::arch::memory static auto containing_address(std::size_t address) -> physical_frame; /** - * @brief TODO + * @brief Evaluates the start address of the physical frame * - * @return uint64_t + * @return start address of the physical frame */ auto start_address() const -> uint64_t; diff --git a/arch/x86_64/include/arch/memory/paging.hpp b/arch/x86_64/include/arch/memory/paging.hpp index 1870c28..43f13e0 100644 --- a/arch/x86_64/include/arch/memory/paging.hpp +++ b/arch/x86_64/include/arch/memory/paging.hpp @@ -89,11 +89,28 @@ namespace teachos::arch::memory }; /** - * @brief TODO - * + * @brief A Page table containing 512 entries */ struct page_table { + /** + * @brief Set every entry of the page to unused + */ + auto zero_entries() -> void; + + /** + * @brief Index operator overload to access specific entries directy + * + * @param index + * @return The address of the accessed entry + */ + entry & operator[](size_t index) + { + arch::exception_handling::assert(index < PAGE_TABLE_ENTRY_COUNT, "[Page Table] index out of bounds"); + return entries[index]; + } + + private: entry entries[PAGE_TABLE_ENTRY_COUNT]; }; } // namespace teachos::arch::memory |
