2022-09-05 14:13:51 +00:00
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2022-10-08 12:52:28 +00:00
|
|
|
#ifndef PAGE_SIZE
|
|
|
|
#define PAGE_SIZE 4096
|
|
|
|
#endif
|
|
|
|
|
2022-10-12 18:02:25 +00:00
|
|
|
struct PageDirectoryEntry
|
2022-09-05 14:13:51 +00:00
|
|
|
{
|
2022-10-13 16:42:53 +00:00
|
|
|
bool present : 1;
|
|
|
|
bool read_write : 1;
|
|
|
|
bool user : 1;
|
|
|
|
bool write_through : 1;
|
|
|
|
bool cache_disabled : 1;
|
|
|
|
bool accessed : 1;
|
2022-10-12 18:02:25 +00:00
|
|
|
bool ignore0 : 1;
|
2022-10-13 16:42:53 +00:00
|
|
|
bool larger_pages : 1;
|
2022-10-12 18:02:25 +00:00
|
|
|
bool ignore1 : 1;
|
2022-10-13 16:42:53 +00:00
|
|
|
uint8_t available : 3;
|
|
|
|
uint64_t address : 52;
|
2022-10-06 15:13:34 +00:00
|
|
|
|
2022-10-12 18:02:25 +00:00
|
|
|
void set_address(uint64_t addr);
|
2022-10-13 16:42:53 +00:00
|
|
|
uint64_t get_address();
|
2022-10-12 18:02:25 +00:00
|
|
|
};
|
2022-09-05 14:13:51 +00:00
|
|
|
|
2022-10-12 18:02:25 +00:00
|
|
|
struct PageTable
|
|
|
|
{
|
|
|
|
PageDirectoryEntry entries[512];
|
|
|
|
} __attribute__((aligned(PAGE_SIZE)));
|