#pragma once #include #include #include #include class PageDirectory : public Retainable { friend class MemoryManager; public: static Retained create() { return adopt(*new PageDirectory); } static Retained create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); } ~PageDirectory(); dword cr3() const { return m_directory_page->paddr().get(); } dword* entries() { return reinterpret_cast(cr3()); } void flush(LinearAddress); private: PageDirectory(); explicit PageDirectory(PhysicalAddress); RetainPtr m_directory_page; HashMap> m_physical_pages; };