diff options
| author | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-27 15:25:57 +0000 |
|---|---|---|
| committer | Fabian Imhof <fabian.imhof@ost.ch> | 2024-10-27 15:26:10 +0000 |
| commit | 58d01f6aae80a66faa5163602c399c28dcf30cb6 (patch) | |
| tree | fa07fa4585eb8efc8a757a8d83b37940256c2855 /arch/x86_64/src | |
| parent | acbd91c9898808a928af0b1bdd9d5058e8a91f62 (diff) | |
| download | teachos-58d01f6aae80a66faa5163602c399c28dcf30cb6.tar.xz teachos-58d01f6aae80a66faa5163602c399c28dcf30cb6.zip | |
revert p4 address update
Diffstat (limited to 'arch/x86_64/src')
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_entry.cpp | 10 | ||||
| -rw-r--r-- | arch/x86_64/src/memory/paging/page_mapper.cpp | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86_64/src/memory/paging/page_entry.cpp b/arch/x86_64/src/memory/paging/page_entry.cpp index f3b5be1..c3e9614 100644 --- a/arch/x86_64/src/memory/paging/page_entry.cpp +++ b/arch/x86_64/src/memory/paging/page_entry.cpp @@ -4,6 +4,11 @@ namespace teachos::arch::memory::paging { + namespace + { + constexpr std::size_t PHYSICAL_ADDRESS_MASK = 0x000fffff'fffff000; + } + entry::entry(uint64_t flags) : flags(flags) { @@ -18,8 +23,7 @@ namespace teachos::arch::memory::paging { if (contains_flags(PRESENT)) { - constexpr std::size_t mask = 0x000fffff'fffff000; - return allocator::physical_frame::containing_address(flags.to_ullong() & mask); + return allocator::physical_frame::containing_address(flags.to_ullong() & PHYSICAL_ADDRESS_MASK); } return std::nullopt; } @@ -28,7 +32,7 @@ namespace teachos::arch::memory::paging auto entry::set_entry(allocator::physical_frame frame, std::bitset<64U> additional_flags) -> void { - exception_handling::assert((frame.start_address() & ~0x000fffff'fffff000) == 0, + exception_handling::assert((frame.start_address() & ~PHYSICAL_ADDRESS_MASK) == 0, "[Paging Entry] Start address is not aligned with page"); flags = std::bitset<64U>{frame.start_address()} | additional_flags; } diff --git a/arch/x86_64/src/memory/paging/page_mapper.cpp b/arch/x86_64/src/memory/paging/page_mapper.cpp index 00c27b0..fb9ea39 100644 --- a/arch/x86_64/src/memory/paging/page_mapper.cpp +++ b/arch/x86_64/src/memory/paging/page_mapper.cpp @@ -8,7 +8,8 @@ namespace teachos::arch::memory::paging auto create_or_get() -> page_table_handle { static auto initialized = false; - static page_table_handle active_handle{boot::page_map_level_4, page_table_handle::LEVEL4}; + static page_table_handle active_handle{reinterpret_cast<page_table *>(0xffffffff'fffff000), + page_table_handle::LEVEL4}; if (!initialized) { |
