2022-11-13 13:29:15 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Result.h>
|
|
|
|
|
|
|
|
struct PageDirectory;
|
|
|
|
|
2022-11-16 19:37:32 +00:00
|
|
|
extern const usize ARCH_PAGE_SIZE;
|
|
|
|
|
2022-11-13 13:29:15 +00:00
|
|
|
namespace MMU
|
|
|
|
{
|
|
|
|
enum Flags
|
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
ReadWrite = 1,
|
|
|
|
User = 2,
|
|
|
|
NoExecute = 4,
|
|
|
|
WriteThrough = 8,
|
|
|
|
CacheDisable = 16,
|
|
|
|
};
|
|
|
|
|
2022-11-13 14:33:53 +00:00
|
|
|
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);
|
2022-11-13 14:33:53 +00:00
|
|
|
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();
|
|
|
|
}
|