From 9fd57e7e340f246c720b6fc2cc8dcd59dd1cf159 Mon Sep 17 00:00:00 2001 From: vanten-s Date: Sun, 23 Feb 2025 16:03:03 +0100 Subject: [PATCH] FINALLY THE STRUCTURE IS CORRECT!!!!!!! I HATE C --- .gitignore | 4 ++++ arch/i686/paging.c | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index ed85fd2..5202d5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ bochsout.txt +opt +.ccls +.ccls-cache +.envrc diff --git a/arch/i686/paging.c b/arch/i686/paging.c index affc06f..fd8c586 100644 --- a/arch/i686/paging.c +++ b/arch/i686/paging.c @@ -6,21 +6,22 @@ #include struct x86_Page_Directory { - uint32_t address : 20; - uint8_t available_1 : 4; - bool page_Size: 1; - bool available_2: 1; - bool accesed: 1; - bool cache_disable: 1; - bool write_through: 1; - bool user_supervisor: 1; - bool read_write: 1; 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; + uint32_t address : 20; } __attribute__((packed)); -struct x86_Page_Directory page_directory[1024] __attribute__((aligned(4096))); +extern uint32_t boot_page_directory[1024] __attribute__((aligned(4096))); void setup_paging() { - size_t size = sizeof(page_directory[0]); + size_t size = sizeof(boot_page_directory[0]); + struct x86_Page_Directory *directory = (struct x86_Page_Directory*) boot_page_directory; + uint32_t table_1 = boot_page_directory[768]; }