1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Kernel: Use a RangeAllocator for kernel-only virtual space allocation too.

This commit is contained in:
Andreas Kling 2019-05-17 04:02:29 +02:00
parent b1bb737704
commit 4a6fcfbacf
4 changed files with 15 additions and 9 deletions

View file

@ -2,9 +2,12 @@
#include <Kernel/kstdio.h>
#include <AK/QuickSort.h>
//#define VRA_DEBUG
RangeAllocator::RangeAllocator(LinearAddress base, size_t size)
{
m_available_ranges.append({ base, size });
dump();
}
RangeAllocator::~RangeAllocator()
@ -29,7 +32,9 @@ Vector<Range, 2> Range::carve(const Range& taken)
if (taken.end() < end())
parts.append({ taken.end(), end().get() - taken.end().get() });
#ifdef VRA_DEBUG
dbgprintf("VRA: carve: remaining parts:\n");
dbgprintf("VRA: carve: take %x-%x from %x-%x\n",
taken.base().get(), taken.end().get() - 1,
base().get(), end().get() - 1);
for (int i = 0; i < parts.size(); ++i)
dbgprintf(" %x-%x\n", parts[i].base().get(), parts[i].end().get() - 1);
#endif