mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
Kernel: Rename Kernel/VM/ to Kernel/Memory/
This directory isn't just about virtual memory, it's about all kinds of memory management.
This commit is contained in:
parent
4e8e1b7b3a
commit
a1d7ebf85a
117 changed files with 207 additions and 204 deletions
37
Kernel/Memory/VMObject.cpp
Normal file
37
Kernel/Memory/VMObject.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/Memory/VMObject.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
VMObject::VMObject(VMObject const& other)
|
||||
: m_physical_pages(other.m_physical_pages)
|
||||
{
|
||||
MM.register_vmobject(*this);
|
||||
}
|
||||
|
||||
VMObject::VMObject(size_t size)
|
||||
: m_physical_pages(ceil_div(size, static_cast<size_t>(PAGE_SIZE)))
|
||||
{
|
||||
MM.register_vmobject(*this);
|
||||
}
|
||||
|
||||
VMObject::~VMObject()
|
||||
{
|
||||
{
|
||||
ScopedSpinLock lock(m_on_deleted_lock);
|
||||
for (auto& it : m_on_deleted)
|
||||
it->vmobject_deleted(*this);
|
||||
m_on_deleted.clear();
|
||||
}
|
||||
|
||||
MM.unregister_vmobject(*this);
|
||||
VERIFY(m_regions.is_empty());
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue