1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

Kernel: Add Memory::RegionTree to share code between AddressSpace and MM

RegionTree holds an IntrusiveRedBlackTree of Region objects and vends a
set of APIs for allocating memory ranges.

It's used by AddressSpace at the moment, and will be used by MM soon.
This commit is contained in:
Andreas Kling 2022-04-02 21:12:05 +02:00
parent 02a95a196f
commit ffe2e77eba
8 changed files with 219 additions and 154 deletions

View file

@ -17,7 +17,7 @@ ErrorOr<FlatPtr> Process::sys$map_time_page()
auto& vmobject = TimeManagement::the().time_page_vmobject();
auto range = TRY(address_space().try_allocate_randomized(PAGE_SIZE, PAGE_SIZE));
auto range = TRY(address_space().region_tree().try_allocate_randomized(PAGE_SIZE, PAGE_SIZE));
auto* region = TRY(address_space().allocate_region_with_vmobject(range, vmobject, 0, "Kernel time page"sv, PROT_READ, true));
return region->vaddr().get();
}