Luna/kernel/include/memory/VMM.h

27 lines
800 B
C
Raw Normal View History

2022-09-05 14:13:51 +00:00
#pragma once
#include "memory/Paging.h"
enum Flags
2022-09-05 14:13:51 +00:00
{
ReadWrite = 1 << 0,
User = 1 << 1,
Execute = 1 << 2
};
namespace VMM
{
void init(); // fetch page table from cr3
2022-09-05 14:13:51 +00:00
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);
2022-09-06 11:49:17 +00:00
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);
};