core: add a new pte

This commit is contained in:
starnakin 2024-10-15 13:32:02 +02:00
parent 577d6c97ec
commit 457244222b
2 changed files with 8 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 = &boot_page_table1; uint32_t page_table_entries[1024];
unsigned long read_cr3() unsigned long read_cr3()
{ {
@ -37,7 +37,9 @@ static inline void load_cr3(uint64_t cr3_value)
void init_memory(void) void init_memory(void)
{ {
//for (int i = 0x00; i < 0x300; i++)
// page_table_entries[i] = (i << 12) | INIT_FLAGS; for (int i = 0; i < 1024; i++)
//page_directory[1] = (uint32_t)page_table_entries | INIT_FLAGS; page_table_entries[i] = (i << 12) | INIT_FLAGS;
page_directory[0] = ((uint32_t)page_table_entries << 12) | INIT_FLAGS;
} }

View File

@ -6,10 +6,10 @@
#include "memory.h" #include "memory.h"
#include "utils.h" #include "utils.h"
#define PT_SIZE 0x300 #define PT_SIZE 1024
#define MAX_TLB_ENTRIES 32 #define MAX_TLB_ENTRIES 32
extern uint32_t page_table_entries[PT_SIZE] __attribute__((aligned(4096))); extern uint32_t page_table_entries[PT_SIZE];
static int16_t find_next_block(size_t nb_pages) static int16_t find_next_block(size_t nb_pages)
{ {