blob: 3f224f0937b683b223c1dd5a62bb9b4387d1d75a (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include <AK/FixedArray.h>
#include <AK/InlineLinkedList.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/Weakable.h>
#include <Kernel/Lock.h>
class Inode;
class PhysicalPage;
class VMObject : public RefCounted<VMObject>
, public Weakable<VMObject>
, public InlineLinkedListNode<VMObject> {
friend class MemoryManager;
friend class Region;
public:
virtual ~VMObject();
virtual NonnullRefPtr<VMObject> clone() = 0;
virtual bool is_anonymous() const { return false; }
virtual bool is_inode() const { return false; }
size_t page_count() const { return m_physical_pages.size(); }
const FixedArray<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
FixedArray<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }
size_t size() const { return m_physical_pages.size() * PAGE_SIZE; }
// For InlineLinkedListNode
VMObject* m_next { nullptr };
VMObject* m_prev { nullptr };
protected:
explicit VMObject(size_t);
explicit VMObject(const VMObject&);
template<typename Callback>
void for_each_region(Callback);
FixedArray<RefPtr<PhysicalPage>> m_physical_pages;
private:
VMObject& operator=(const VMObject&) = delete;
VMObject& operator=(VMObject&&) = delete;
VMObject(VMObject&&) = delete;
Lock m_paging_lock { "VMObject" };
};
|