From 457244222b49d35cd606d02620430821d56b6fa2 Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 15 Oct 2024 13:32:02 +0200 Subject: [PATCH] core: add a new pte --- src/memory/memory.c | 10 ++++++---- src/memory/page.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/memory/memory.c b/src/memory/memory.c index 1119523..f252df1 100644 --- a/src/memory/memory.c +++ b/src/memory/memory.c @@ -12,7 +12,7 @@ extern uint32_t boot_page_directory; // Pour récupérer une entrée spécifique uint32_t *page_directory = &boot_page_directory; -uint32_t *page_table_entries = &boot_page_table1; +uint32_t page_table_entries[1024]; unsigned long read_cr3() { @@ -37,7 +37,9 @@ static inline void load_cr3(uint64_t cr3_value) void init_memory(void) { - //for (int i = 0x00; i < 0x300; i++) - // page_table_entries[i] = (i << 12) | INIT_FLAGS; - //page_directory[1] = (uint32_t)page_table_entries | INIT_FLAGS; + + for (int i = 0; i < 1024; i++) + page_table_entries[i] = (i << 12) | INIT_FLAGS; + + page_directory[0] = ((uint32_t)page_table_entries << 12) | INIT_FLAGS; } \ No newline at end of file diff --git a/src/memory/page.c b/src/memory/page.c index d25ccd1..5f63d7b 100644 --- a/src/memory/page.c +++ b/src/memory/page.c @@ -6,10 +6,10 @@ #include "memory.h" #include "utils.h" -#define PT_SIZE 0x300 +#define PT_SIZE 1024 #define MAX_TLB_ENTRIES 32 -extern uint32_t page_table_entries[PT_SIZE] __attribute__((aligned(4096))); +extern uint32_t page_table_entries[PT_SIZE]; static int16_t find_next_block(size_t nb_pages) {