2024-11-27 21:57:18 +01:00
|
|
|
#include <stddef.h>
|
2025-07-01 12:48:05 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2024-11-27 21:57:18 +01:00
|
|
|
|
|
|
|
struct PageDirectory {
|
|
|
|
size_t page_table;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PageTable {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2025-07-01 12:48:05 +02:00
|
|
|
struct x86_Page_Directory {
|
|
|
|
bool present: 1;
|
|
|
|
bool read_write: 1;
|
|
|
|
bool user_supervisor: 1;
|
|
|
|
bool write_through: 1;
|
|
|
|
bool cache_disable: 1;
|
|
|
|
bool accesed: 1;
|
|
|
|
bool available_2: 1;
|
|
|
|
bool page_size: 1;
|
|
|
|
uint8_t available_1 : 4;
|
|
|
|
uintptr_t address : 20; // Multiply by 0x1000
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct x86_Page_Table {
|
|
|
|
bool present: 1;
|
|
|
|
bool read_write: 1;
|
|
|
|
bool user_supervisor: 1;
|
|
|
|
bool write_through: 1;
|
|
|
|
bool cache_disable: 1;
|
|
|
|
bool accesed: 1;
|
|
|
|
bool dirty: 1;
|
|
|
|
bool page_attribute_table: 1;
|
|
|
|
bool global: 1;
|
|
|
|
uint8_t available_1 : 3;
|
|
|
|
uintptr_t address : 20; // Multiply by 0x1000
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2024-11-27 21:57:18 +01:00
|
|
|
void setup_paging();
|
2025-07-01 12:48:05 +02:00
|
|
|
void set_page_table_entry(size_t address, void* ptr);
|
|
|
|
void set_page_directory_entry(uintptr_t address, struct x86_Page_Table* table);
|