mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
b9738fa8ac
Also break MemoryManager.{cpp,h} into one file per class.
26 lines
811 B
C++
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;
|
|
};
|