1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 20:37:35 +00:00

Kernel: Use a FixedArray for VMObject::m_physical_pages

This makes VMObject 8 bytes smaller since we can use the array size as
the page count.

The size() is now also computed from the page count instead of being
a separate value. This makes sizes always be a multiple of PAGE_SIZE,
which is sane.
This commit is contained in:
Andreas Kling 2019-08-07 20:12:50 +02:00
parent 5096eaa845
commit b67200dfea
5 changed files with 19 additions and 39 deletions

View file

@ -4,18 +4,15 @@
#include <Kernel/VM/VMObject.h>
VMObject::VMObject(const VMObject& other)
: m_size(other.m_size)
, m_physical_pages(other.m_physical_pages)
: m_physical_pages(other.m_physical_pages)
{
MM.register_vmo(*this);
}
VMObject::VMObject(size_t size, ShouldFillPhysicalPages should_fill_physical_pages)
: m_size(size)
VMObject::VMObject(size_t size)
: m_physical_pages(ceil_div(size, PAGE_SIZE))
{
MM.register_vmo(*this);
if (should_fill_physical_pages == ShouldFillPhysicalPages::Yes)
m_physical_pages.resize(page_count());
}
VMObject::~VMObject()