mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:15:07 +00:00
Kernel: Fix 64-bit address truncation in MemoryManager::ensure_pte()
This commit is contained in:
parent
ed25a6ad0d
commit
f0c4941beb
2 changed files with 3 additions and 2 deletions
|
@ -552,7 +552,8 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual
|
||||||
pde.set_global(&page_directory == m_kernel_page_directory.ptr());
|
pde.set_global(&page_directory == m_kernel_page_directory.ptr());
|
||||||
// Use page_directory_table_index and page_directory_index as key
|
// Use page_directory_table_index and page_directory_index as key
|
||||||
// This allows us to release the page table entry when no longer needed
|
// This allows us to release the page table entry when no longer needed
|
||||||
auto result = page_directory.m_page_tables.set(vaddr.get() & ~0x1fffff, move(page_table));
|
auto result = page_directory.m_page_tables.set(vaddr.get() & ~(FlatPtr)0x1fffff, move(page_table));
|
||||||
|
// If you're hitting this VERIFY on x86_64 chances are a 64-bit pointer was truncated somewhere
|
||||||
VERIFY(result == AK::HashSetResult::InsertedNewEntry);
|
VERIFY(result == AK::HashSetResult::InsertedNewEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ private:
|
||||||
#else
|
#else
|
||||||
RefPtr<PhysicalPage> m_directory_pages[4];
|
RefPtr<PhysicalPage> m_directory_pages[4];
|
||||||
#endif
|
#endif
|
||||||
HashMap<u32, RefPtr<PhysicalPage>> m_page_tables;
|
HashMap<FlatPtr, RefPtr<PhysicalPage>> m_page_tables;
|
||||||
RecursiveSpinLock m_lock;
|
RecursiveSpinLock m_lock;
|
||||||
bool m_valid { false };
|
bool m_valid { false };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue