summaryrefslogtreecommitdiff
path: root/Kernel/VM/PageDirectory.cpp
blob: d5c10c189a31e40cfa3429e9211b3830b85be05d (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
#include <Kernel/VM/PageDirectory.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/Process.h>
#include <Kernel/Thread.h>

PageDirectory::PageDirectory(PhysicalAddress paddr)
{
    m_directory_page = PhysicalPage::create_eternal(paddr, true);
}

PageDirectory::PageDirectory()
{
    MM.populate_page_directory(*this);
}

PageDirectory::~PageDirectory()
{
#ifdef MM_DEBUG
    dbgprintf("MM: ~PageDirectory K%x\n", this);
#endif
}

void PageDirectory::flush(LinearAddress laddr)
{
#ifdef MM_DEBUG
    dbgprintf("MM: Flush page L%x\n", laddr.get());
#endif
    if (!current)
        return;
    if (&current->process().page_directory() == this)
        MM.flush_tlb(laddr);
}