diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-20 08:37:49 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-10-20 08:37:49 +0000 |
| commit | d934ea6875932a7139eba77bb5248fca8be7fd01 (patch) | |
| tree | 0521c077a882d4386c09fc77381d4062898bd90e /arch/x86_64/src | |
| parent | fba2fc4ce3d4bf4997eb42c9b5b2ac1de8692150 (diff) | |
| download | teachos-d934ea6875932a7139eba77bb5248fca8be7fd01.tar.xz teachos-d934ea6875932a7139eba77bb5248fca8be7fd01.zip | |
Implement translate page in a big brain way 🤯
Diffstat (limited to 'arch/x86_64/src')
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_table.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/paging/page_table.cpp b/arch/x86_64/src/memory/paging/page_table.cpp index ab7331a..02ababe 100644 --- a/arch/x86_64/src/memory/paging/page_table.cpp +++ b/arch/x86_64/src/memory/paging/page_table.cpp @@ -54,4 +54,12 @@ namespace teachos::arch::memory::paging } return std::nullopt; } + + auto operator--(page_table::level & level, int) -> page_table::level + { + exception_handling::assert(level != page_table::LEVEL1, + "[Page table] Attemptd to decrement enum to value outside of range"); + auto value = static_cast<std::underlying_type<page_table::level>::type>(level); + return static_cast<page_table::level>(--value); + } } // namespace teachos::arch::memory::paging |
