Luna/kernel/include/memory/VMM.h

29 lines
686 B
C++

#pragma once
#include "memory/Paging.h"
namespace Paging
{
enum Flags
{
ReadWrite = 1 << 0,
User = 1 << 1,
Execute = 1 << 2
};
class VirtualMemoryManager
{
public:
void init(); // fetch page table from cr3
void init(PageTable* cr3);
void map(uint64_t virtualAddress, uint64_t physicalAddress, int flags);
void remap(uint64_t virtualAddress, int flags);
void unmap(uint64_t virtualAddress);
uint64_t getPhysical(uint64_t virtualAddress);
uint64_t getFlags(uint64_t virtualAddress);
private:
PageTable* PML4;
};
}
extern Paging::VirtualMemoryManager kernelVMM;