Luna/kernel/src/arch/MMU.h

35 lines
746 B
C
Raw Normal View History

2022-11-13 13:29:15 +00:00
#pragma once
#include <luna/Result.h>
2022-11-13 13:29:15 +00:00
#ifdef ARCH_X86_64
#include "arch/x86_64/MMU.h"
#else
#error "Unknown architecture."
#endif
2022-11-13 13:29:15 +00:00
namespace MMU
{
enum Flags
{
None = 0,
ReadWrite = 1,
User = 2,
NoExecute = 4,
WriteThrough = 8,
CacheDisable = 16,
};
Result<void> map(u64 virt, u64 phys, int flags);
2022-11-13 13:29:15 +00:00
Result<u64> unmap(u64 virt);
Result<u64> get_physical(u64 virt);
Result<int> get_flags(u64 virt);
Result<void> remap(u64 virt, int flags);
2022-11-13 13:29:15 +00:00
void switch_page_directory(PageDirectory* dir);
PageDirectory* get_page_directory();
void flush_all();
2022-11-13 15:51:21 +00:00
Result<PageDirectory*> create_page_directory_for_userspace();
2022-11-13 13:29:15 +00:00
void setup_initial_page_directory();
}