ladybird/Kernel/VM/VMObject.cpp
Andreas Kling b67200dfea 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.
2019-08-07 20:12:50 +02:00

22 lines
442 B
C++

#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/VMObject.h>
VMObject::VMObject(const VMObject& other)
: m_physical_pages(other.m_physical_pages)
{
MM.register_vmo(*this);
}
VMObject::VMObject(size_t size)
: m_physical_pages(ceil_div(size, PAGE_SIZE))
{
MM.register_vmo(*this);
}
VMObject::~VMObject()
{
MM.unregister_vmo(*this);
}