diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-20 08:13:31 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-20 08:13:31 +0000 |
| commit | 89ad7a0b60ce74c70fc3865e0967c601a6050674 (patch) | |
| tree | 814a375199ef42a61d6ab5829e6d802bf6fa1eda /arch/x86_64/src/memory | |
| parent | 882ccdcc0e3c19fbcc595c6a371ef79587f63648 (diff) | |
| download | teachos-89ad7a0b60ce74c70fc3865e0967c601a6050674.tar.xz teachos-89ad7a0b60ce74c70fc3865e0967c601a6050674.zip | |
Make next table return boolean
Diffstat (limited to 'arch/x86_64/src/memory')
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_table.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp index 3c4f6d8..ab7331a 100644 --- a/arch/x86_64/src/memory/paging/page_table.cpp +++ b/arch/x86_64/src/memory/paging/page_table.cpp @@ -26,8 +26,13 @@ namespace teachos::arch::memory::paging exception_handling::assert(current_level != LEVEL1, "[Page Table] Attempted to call next_table on level 1 page table"); auto address = next_table_address(table_index); - current_table = reinterpret_cast<table_content *>(address.value()); - current_level = static_cast<level>(current_level - 1U); + bool const success = address.has_value(); + if (success) + { + current_table = reinterpret_cast<table_content *>(address.value()); + current_level = static_cast<level>(current_level - 1U); + } + return success; } auto page_table::operator[](std::size_t index) -> entry & @@ -47,7 +52,6 @@ namespace teachos::arch::memory::paging std::size_t const table_address = reinterpret_cast<std::size_t>(current_table); return ((table_address << 9) | (table_index << 12)); } - // TODO: Implement behaviour for huge pages currently not done return std::nullopt; } } // namespace teachos::arch::memory::paging |
