fix: memory: use 1024 instead of 4096 when use 32bit ptr

This commit is contained in:
Starnakin 2024-10-25 15:33:31 +02:00
parent a9bfb49bb8
commit cbcff77a4a
2 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ void *alloc_pages(size_t size)
current_page_table[i] = current_page_table[i] =
((uint32_t)frame & PAGE_MASK) | INIT_FLAGS; ((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) int free_pages(void *page_ptr, size_t size)

View File

@ -12,7 +12,7 @@ int16_t create_page_table(uint16_t pd_index)
if (!frame) if (!frame)
return -1; return -1;
page_directory[pd_index] = ((uint32_t)frame & PAGE_MASK) | 0x03; 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); init_page_table(page_table, 0);
return 0; return 0;
} }