1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:28:13 +00:00

Kernel: Make identity mapping mechanism used during AP boot non-generic

When booting AP's, we identity map a region at 0x8000 while doing the
initial bringup sequence. This is the only thing in the kernel that
requires an identity mapping, yet we had a bunch of generic API's and a
dedicated VirtualRangeAllocator in every PageDirectory for this purpose.

This patch simplifies the situation by moving the identity mapping logic
to the AP boot code and removing the generic API's.
This commit is contained in:
Andreas Kling 2021-08-06 21:35:56 +02:00
parent 16ac3bbfd7
commit cdab5b2091
6 changed files with 20 additions and 23 deletions

View file

@ -733,19 +733,6 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size
return allocate_kernel_region_with_vmobject(range.value(), *vm_object, name, access, cacheable);
}
OwnPtr<Region> MemoryManager::allocate_kernel_region_identity(PhysicalAddress paddr, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable)
{
auto vm_object = AnonymousVMObject::try_create_for_physical_range(paddr, size);
if (!vm_object)
return {};
VERIFY(!(size % PAGE_SIZE));
ScopedSpinLock lock(s_mm_lock);
auto range = kernel_page_directory().identity_range_allocator().allocate_specific(VirtualAddress(paddr.get()), size);
if (!range.has_value())
return {};
return allocate_kernel_region_with_vmobject(range.value(), *vm_object, name, access, cacheable);
}
OwnPtr<Region> MemoryManager::allocate_kernel_region_with_vmobject(VirtualRange const& range, VMObject& vmobject, StringView name, Region::Access access, Region::Cacheable cacheable)
{
ScopedSpinLock lock(s_mm_lock);