os/include/kernel/paging.h
2025-07-01 12:48:05 +02:00

43 lines
980 B
C

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
struct PageDirectory {
size_t page_table;
};
struct PageTable {
};
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));
void setup_paging();
void set_page_table_entry(size_t address, void* ptr);
void set_page_directory_entry(uintptr_t address, struct x86_Page_Table* table);