34 lines
744 B
C
Raw Normal View History

2022-09-05 16:13:51 +02:00
#pragma once
#include <stdint.h>
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif
struct PageDirectoryEntry
2022-09-05 16:13:51 +02:00
{
2022-10-13 18:42:53 +02:00
bool present : 1;
bool read_write : 1;
bool user : 1;
bool write_through : 1;
bool cache_disabled : 1;
bool accessed : 1;
bool ignore0 : 1;
2022-10-13 18:42:53 +02:00
bool larger_pages : 1;
bool ignore1 : 1;
2022-10-13 18:42:53 +02:00
uint8_t available : 3;
uint64_t address : 48;
bool owned_by_task : 1; // Part of the available for OS use bits.
uint8_t available2 : 2;
bool no_execute : 1;
2022-10-06 17:13:34 +02:00
void set_address(uint64_t addr);
2022-10-13 18:42:53 +02:00
uint64_t get_address();
} __attribute__((packed));
2022-09-05 16:13:51 +02:00
struct PageTable
{
PageDirectoryEntry entries[512];
} __attribute__((aligned(PAGE_SIZE)));
static_assert(sizeof(PageDirectoryEntry) == 8UL);