2023-01-12 13:20:38 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
class MMU
|
|
|
|
{
|
2023-03-01 20:15:58 +02:00
|
|
|
public:
|
|
|
|
enum Flags : uint8_t
|
|
|
|
{
|
|
|
|
Present = 1,
|
|
|
|
ReadWrite = 2,
|
|
|
|
UserSupervisor = 4,
|
|
|
|
};
|
|
|
|
|
2023-01-12 13:20:38 +02:00
|
|
|
public:
|
2023-02-01 21:05:44 +02:00
|
|
|
static void intialize();
|
|
|
|
static MMU& get();
|
2023-01-12 13:20:38 +02:00
|
|
|
|
2023-01-30 18:54:04 +02:00
|
|
|
MMU();
|
|
|
|
~MMU();
|
|
|
|
|
2023-03-01 20:15:58 +02:00
|
|
|
void allocate_page(uintptr_t, uint8_t);
|
|
|
|
void allocate_range(uintptr_t, ptrdiff_t, uint8_t);
|
2023-01-12 13:45:01 +02:00
|
|
|
|
2023-02-01 21:05:44 +02:00
|
|
|
void unallocate_page(uintptr_t);
|
|
|
|
void unallocate_range(uintptr_t, ptrdiff_t);
|
2023-01-12 13:45:01 +02:00
|
|
|
|
2023-01-12 13:20:38 +02:00
|
|
|
private:
|
2023-01-22 03:03:01 +02:00
|
|
|
uint64_t* m_highest_paging_struct;
|
2023-01-12 13:20:38 +02:00
|
|
|
};
|