summaryrefslogtreecommitdiff
path: root/Kernel/VM/AnonymousVMObject.cpp
blob: a7c3276227ef03c89c6eecce3312b31cb48553fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/PhysicalPage.h>

NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size)
{
    return adopt(*new AnonymousVMObject(size));
}

NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
{
    return adopt(*new AnonymousVMObject(paddr, size));
}

AnonymousVMObject::AnonymousVMObject(size_t size)
    : VMObject(size)
{
}

AnonymousVMObject::AnonymousVMObject(PhysicalAddress paddr, size_t size)
    : VMObject(size)
{
    ASSERT(paddr.page_base() == paddr.get());
    for (size_t i = 0; i < page_count(); ++i)
        physical_pages()[i] = PhysicalPage::create(paddr.offset(i * PAGE_SIZE), false, false);
}

AnonymousVMObject::AnonymousVMObject(const AnonymousVMObject& other)
    : VMObject(other)
{
}

AnonymousVMObject::~AnonymousVMObject()
{
}

NonnullRefPtr<VMObject> AnonymousVMObject::clone()
{
    return adopt(*new AnonymousVMObject(*this));
}