mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
Kernel: Move create_identity_mapped_region() to MemoryManager
This had no business being in RegionTree, since RegionTree doesn't track identity-mapped regions anyway. (We allow *any* address to be identity mapped, not just the ones that are part of the RegionTree's range.)
This commit is contained in:
@@ -1232,4 +1232,14 @@ void MemoryManager::copy_physical_page(PhysicalPage& physical_page, u8 page_buff
|
||||
unquickmap_page();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<Memory::Region>> MemoryManager::create_identity_mapped_region(PhysicalAddress address, size_t size)
|
||||
{
|
||||
auto vmobject = TRY(Memory::AnonymousVMObject::try_create_for_physical_range(address, size));
|
||||
auto region = TRY(Memory::Region::create_unplaced(move(vmobject), 0, {}, Memory::Region::Access::ReadWriteExecute));
|
||||
Memory::VirtualRange range { VirtualAddress { (FlatPtr)address.get() }, size };
|
||||
region->m_range = range;
|
||||
TRY(region->map(MM.kernel_page_directory()));
|
||||
return region;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user