1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:15:07 +00:00

Kernel: Let PageDirectory own the associated RangeAllocator.

Since we transition to a new PageDirectory on exec(), we need a matching
RangeAllocator to go with the new directory. Instead of juggling this in
Process and MemoryManager, simply attach the RangeAllocator to the
PageDirectory instead.

Fixes #61.
This commit is contained in:
Andreas Kling 2019-05-20 04:46:29 +02:00
parent d65114afd7
commit bcc6ddfb6b
6 changed files with 16 additions and 16 deletions

View file

@ -20,7 +20,6 @@ MemoryManager& MM
}
MemoryManager::MemoryManager()
: m_range_allocator(LinearAddress(0xc0000000), 0x3f000000)
{
// FIXME: This is not the best way to do memory map detection.
// Rewrite to use BIOS int 15,e820 once we have VM86 support.
@ -402,7 +401,7 @@ RetainPtr<Region> MemoryManager::allocate_kernel_region(size_t size, String&& na
InterruptDisabler disabler;
ASSERT(!(size % PAGE_SIZE));
auto range = m_range_allocator.allocate_anywhere(size);
auto range = kernel_page_directory().range_allocator().allocate_anywhere(size);
ASSERT(range.is_valid());
auto region = adopt(*new Region(range, move(name), true, true, false));
MM.map_region_at_address(*m_kernel_page_directory, *region, range.base(), false);