1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:28:11 +00:00

Kernel: Simplify the way PhysicalRegions are constructed

Instead of creating a PhysicalRegion and then expanding it over and
over as we traverse the memory map on boot, we now compute the final
size of the contiguous physical range up front, and *then* create a
PhysicalRegion object.
This commit is contained in:
Andreas Kling 2021-07-13 18:22:49 +02:00
parent 479df315d2
commit 5171249540
3 changed files with 17 additions and 18 deletions

View file

@ -36,14 +36,6 @@ PhysicalRegion::PhysicalRegion(PhysicalAddress lower, PhysicalAddress upper)
{
}
void PhysicalRegion::expand(PhysicalAddress lower, PhysicalAddress upper)
{
VERIFY(!m_pages);
m_lower = lower;
m_upper = upper;
}
void PhysicalRegion::initialize_zones()
{
size_t remaining_pages = m_pages;
@ -65,9 +57,7 @@ void PhysicalRegion::initialize_zones()
unsigned PhysicalRegion::finalize_capacity()
{
VERIFY(!m_pages);
m_pages = (m_upper.get() - m_lower.get()) / PAGE_SIZE;
return size();
}