Luna/kernel/include/memory/VMM.h
apio b360307f41 VMM: Make it so much gooder
There are still some fixes to be made, but I think this is already way cleaner than before.
2022-10-13 17:58:13 +02:00

27 lines
800 B
C++

#pragma once
#include "memory/Paging.h"
enum Flags
{
ReadWrite = 1 << 0,
User = 1 << 1,
Execute = 1 << 2
};
namespace VMM
{
void init(); // fetch page table from 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);
PageDirectoryEntry* find_pde(PageTable* root, uint64_t virtualAddress);
PageDirectoryEntry* create_pde_if_not_exists(PageTable* root, uint64_t virtualAddress);
void propagate_read_write(PageTable* root, uint64_t virtualAddress);
void propagate_user(PageTable* root, uint64_t virtualAddress);
void flush_tlb(uint64_t addr);
};