diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-20 12:57:21 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-20 12:57:21 +0000 |
| commit | 1b03bcecac1276b486e17daf0384de7fa203d974 (patch) | |
| tree | 53496ddf705f876ec06654acbd6b723310847c30 /arch/x86_64/src/memory/paging | |
| parent | bb8b3f9c0734220702e3e930e7acb4906aa13db6 (diff) | |
| download | teachos-1b03bcecac1276b486e17daf0384de7fa203d974.tar.xz teachos-1b03bcecac1276b486e17daf0384de7fa203d974.zip | |
create active_page_table
Diffstat (limited to 'arch/x86_64/src/memory/paging')
| -rw-r--r-- | arch/x86_64/src/memory/paging/active_page_table.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/paging/active_page_table.cpp b/arch/x86_64/src/memory/paging/active_page_table.cpp new file mode 100644 index 0000000..eb85c34 --- /dev/null +++ b/arch/x86_64/src/memory/paging/active_page_table.cpp @@ -0,0 +1,31 @@ +#include "arch/memory/paging/active_page_table.hpp" + +namespace teachos::arch::memory::paging +{ + struct active_page_table + { + auto create(page_table * level4_page_table) -> active_page_table * + { + if (instantiated) + { + return this; + } + + instantiated = true; + return &active_page_table(level4_page_table); + } + + active_page_table(const active_page_table &) = delete; + active_page_table & operator=(const active_page_table &) = delete; + + private: + active_page_table(page_table * level4_page_table) + : level4_page_table(level4_page_table) + { + // Nothing to do + } + + bool instantiated = false; + page_table * level4_page_table; + }; +} // namespace teachos::arch::memory::paging
\ No newline at end of file |
