From fd1086b40834e4000a56e26f866246c540ab0a2f Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 15 Oct 2024 10:55:13 +0200 Subject: [PATCH] fix: use the boot pt --- src/memory/memory.c | 8 ++++---- src/memory/page.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/memory/memory.c b/src/memory/memory.c index df51a0a..1119523 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[1024] __attribute__((aligned(4096))); +uint32_t *page_table_entries = &boot_page_table1; unsigned long read_cr3() { @@ -37,7 +37,7 @@ static inline void load_cr3(uint64_t cr3_value) void init_memory(void) { - for (int i = 0; i < 1024; i++) - page_table_entries[i] = (i << 12) | INIT_FLAGS; - page_directory[1] = (uint32_t)page_table_entries | INIT_FLAGS; + //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; } \ No newline at end of file diff --git a/src/memory/page.c b/src/memory/page.c index 7579ad3..d25ccd1 100644 --- a/src/memory/page.c +++ b/src/memory/page.c @@ -16,7 +16,7 @@ static int16_t find_next_block(size_t nb_pages) for (uint16_t i = 1; i < PT_SIZE; i++) { uint16_t j; for (j = 0; - page_table_entries[i + j] >> 12 == i + j && j < nb_pages; + page_table_entries[i + j] >> 12 == 0 && j < nb_pages; j++) ; if (j == nb_pages) @@ -66,7 +66,7 @@ int free_pages(void *page_ptr, size_t size) } for (size_t i = page_index; i < page_index + nb_pages; i++) { free_frames((void *)(page_table_entries[i] >> 12), PAGE_SIZE); - page_table_entries[i] = (i >> 12) | INIT_FLAGS; + page_table_entries[i] = INIT_FLAGS; } return 0; }