fix: use the boot pt

This commit is contained in:
starnakin 2024-10-15 10:55:13 +02:00
parent 5f075a9090
commit fd1086b408
2 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,7 @@ extern uint32_t boot_page_directory;
// Pour récupérer une entrée spécifique // Pour récupérer une entrée spécifique
uint32_t *page_directory = &boot_page_directory; 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() unsigned long read_cr3()
{ {
@ -37,7 +37,7 @@ static inline void load_cr3(uint64_t cr3_value)
void init_memory(void) void init_memory(void)
{ {
for (int i = 0; i < 1024; i++) //for (int i = 0x00; i < 0x300; i++)
page_table_entries[i] = (i << 12) | INIT_FLAGS; // page_table_entries[i] = (i << 12) | INIT_FLAGS;
page_directory[1] = (uint32_t)page_table_entries | INIT_FLAGS; //page_directory[1] = (uint32_t)page_table_entries | INIT_FLAGS;
} }

View File

@ -16,7 +16,7 @@ static int16_t find_next_block(size_t nb_pages)
for (uint16_t i = 1; i < PT_SIZE; i++) { for (uint16_t i = 1; i < PT_SIZE; i++) {
uint16_t j; uint16_t j;
for (j = 0; 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++) j++)
; ;
if (j == nb_pages) 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++) { for (size_t i = page_index; i < page_index + nb_pages; i++) {
free_frames((void *)(page_table_entries[i] >> 12), PAGE_SIZE); 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; return 0;
} }