fix: memory: current_page_table addr

This commit is contained in:
Starnakin 2024-10-25 16:19:25 +02:00
parent cbcff77a4a
commit 659ba24f12

View File

@ -13,14 +13,13 @@ static uint16_t current_pd_index;
static int16_t find_next_block(size_t nb_pages) static int16_t find_next_block(size_t nb_pages)
{ {
for (uint16_t pd_index = 0; pd_index < 768; pd_index++) { for (uint16_t pd_index = 1; pd_index < 768; pd_index++) {
if (page_directory[pd_index] == 0x02) { if (page_directory[pd_index] == 0x02) {
if (create_page_table(pd_index) < 0) if (create_page_table(pd_index) < 0)
return -2; return -2;
} }
current_pd_index = pd_index; current_pd_index = pd_index;
current_page_table = current_page_table = (uint32_t *)((PT_START + pd_index) * 1024);
(uint32_t *)((PT_START + pd_index) * PAGE_SIZE);
for (uint16_t i = 0; i + nb_pages < PT_SIZE; i++) { for (uint16_t i = 0; i + nb_pages < PT_SIZE; i++) {
uint16_t j; uint16_t j;
for (j = 0; current_page_table[i + j] >> 12 == i + j && for (j = 0; current_page_table[i + j] >> 12 == i + j &&