From cbcff77a4aa328038f40d43d57b24dadf86af2df Mon Sep 17 00:00:00 2001 From: Starnakin Date: Fri, 25 Oct 2024 15:33:31 +0200 Subject: [PATCH] fix: memory: use 1024 instead of 4096 when use 32bit ptr --- src/memory/page.c | 2 +- src/memory/page_table.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory/page.c b/src/memory/page.c index 01e1054..265c9c9 100644 --- a/src/memory/page.c +++ b/src/memory/page.c @@ -57,7 +57,7 @@ void *alloc_pages(size_t size) current_page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS; } - return (void *)(((current_pd_index * 1024) + index) * PAGE_SIZE); + return (void *)(((current_pd_index * 1024) + index) * 1024); } int free_pages(void *page_ptr, size_t size) diff --git a/src/memory/page_table.c b/src/memory/page_table.c index d23155d..b7e4b09 100644 --- a/src/memory/page_table.c +++ b/src/memory/page_table.c @@ -12,7 +12,7 @@ int16_t create_page_table(uint16_t pd_index) if (!frame) return -1; page_directory[pd_index] = ((uint32_t)frame & PAGE_MASK) | 0x03; - uint32_t *page_table = (uint32_t *)((PT_START + pd_index) * PAGE_SIZE); + uint32_t *page_table = (uint32_t *)((PT_START + pd_index) * 1024); init_page_table(page_table, 0); return 0; }