29 lines
687 B
C++
29 lines
687 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* PML4);
|
|
|
|
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; |