#pragma once #include #include #include #include #include #include class Inode; class PhysicalPage; class VMObject : public RefCounted , public Weakable , public InlineLinkedListNode { friend class MemoryManager; friend class Region; public: virtual ~VMObject(); virtual NonnullRefPtr 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>& physical_pages() const { return m_physical_pages; } FixedArray>& 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 void for_each_region(Callback); FixedArray> m_physical_pages; private: VMObject& operator=(const VMObject&) = delete; VMObject& operator=(VMObject&&) = delete; VMObject(VMObject&&) = delete; Lock m_paging_lock { "VMObject" }; };