1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 15:45:08 +00:00

Kernel: Simplify PageDirectory allocation failure

This patch gets rid of the "valid" bit in PageDirectory since it was
only used to communicate an allocation failure during construction.

We now do all the work in the static factory functions instead of in the
constructor, which allows us to simply return nullptr instead of an
"invalid" PageDirectory.
This commit is contained in:
Andreas Kling 2021-08-05 18:58:33 +02:00
parent 27100126c0
commit f35108fc31
4 changed files with 61 additions and 58 deletions

View file

@ -392,7 +392,7 @@ UNMAP_AFTER_INIT void MemoryManager::initialize_physical_pages()
m_used_memory_ranges.append({ UsedMemoryRangeType::PhysicalPages, m_physical_pages_region->lower(), m_physical_pages_region->upper() });
// Create the bare page directory. This is not a fully constructed page directory and merely contains the allocators!
m_kernel_page_directory = PageDirectory::create_kernel_page_directory();
m_kernel_page_directory = PageDirectory::must_create_kernel_page_directory();
// Allocate a virtual address range for our array
auto range = m_kernel_page_directory->range_allocator().allocate_anywhere(physical_page_array_pages * PAGE_SIZE);