serenity/Kernel/VM/PageDirectory.h
Andreas Kling b9738fa8ac Kernel: Move VM-related files into Kernel/VM/.
Also break MemoryManager.{cpp,h} into one file per class.
2019-04-03 15:13:07 +02:00

26 lines
811 B
C++

#pragma once
#include <Kernel/VM/PhysicalPage.h>
#include <AK/HashMap.h>
#include <AK/Retainable.h>
#include <AK/RetainPtr.h>
class PageDirectory : public Retainable<PageDirectory> {
friend class MemoryManager;
public:
static Retained<PageDirectory> create() { return adopt(*new PageDirectory); }
static Retained<PageDirectory> 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<dword*>(cr3()); }
void flush(LinearAddress);
private:
PageDirectory();
explicit PageDirectory(PhysicalAddress);
RetainPtr<PhysicalPage> m_directory_page;
HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages;
};