1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

Kernel: Unmap Prekernel pages after they are no longer needed

The Prekernel's memory is only accessed until MemoryManager has been
initialized. Keeping them around afterwards is both unnecessary and bad,
as it prevents the userland from using the 0x100000-0x155000 virtual
address range.

Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
This commit is contained in:
Daniel Bertalan 2021-12-19 01:15:12 +01:00 committed by Brian Gianforcaro
parent 2f1b4b8a81
commit 4fc28bfe02
4 changed files with 31 additions and 8 deletions

View file

@ -243,7 +243,7 @@ void Region::unmap(ShouldDeallocateVirtualRange deallocate_range)
size_t count = page_count();
for (size_t i = 0; i < count; ++i) {
auto vaddr = vaddr_from_page_index(i);
MM.release_pte(*m_page_directory, vaddr, i == count - 1);
MM.release_pte(*m_page_directory, vaddr, i == count - 1 ? MemoryManager::IsLastPTERelease::Yes : MemoryManager::IsLastPTERelease::No);
}
MemoryManager::flush_tlb(m_page_directory, vaddr(), page_count());
if (deallocate_range == ShouldDeallocateVirtualRange::Yes) {