33 lines
674 B
C
33 lines
674 B
C
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#ifndef PAGE_SIZE
|
|
#define PAGE_SIZE 4096
|
|
#endif
|
|
|
|
struct PageDirectoryEntry
|
|
{
|
|
bool present : 1;
|
|
bool read_write : 1;
|
|
bool user : 1;
|
|
bool write_through : 1;
|
|
bool cache_disabled : 1;
|
|
bool accessed : 1;
|
|
bool ignore0 : 1;
|
|
bool larger_pages : 1;
|
|
bool ignore1 : 1;
|
|
uint8_t available : 3;
|
|
uint64_t address : 48;
|
|
uint8_t available2 : 3;
|
|
bool no_execute : 1;
|
|
|
|
void set_address(uint64_t addr);
|
|
uint64_t get_address();
|
|
} __attribute__((packed));
|
|
|
|
struct PageTable
|
|
{
|
|
PageDirectoryEntry entries[512];
|
|
} __attribute__((aligned(PAGE_SIZE)));
|
|
|
|
static_assert(sizeof(PageDirectoryEntry) == 8UL); |