42_KFS/src/memory/memory.c

20 lines
509 B
C
Raw Normal View History

#include "memory.h"
2024-10-14 18:29:46 -04:00
#include "kprintf.h"
#include "string.h"
2024-10-14 18:29:46 -04:00
#include <stdint.h>
2024-10-14 18:29:46 -04:00
extern uint32_t boot_page_directory;
uint32_t *page_directory = &boot_page_directory;
2024-10-17 10:10:39 -04:00
uint32_t page_table1[1024] __attribute__((aligned(4096)));
uint32_t page_table_entries[1024] __attribute__((aligned(4096)));
2024-10-14 18:29:46 -04:00
void init_memory(void)
{
2024-10-17 10:10:39 -04:00
for (int16_t i = 0; i < 0x300; i++)
page_directory[i] = 0x02;
for (int16_t i = 0; i < 1024; i++)
page_table1[i] = i << 12 | 0x03;
page_directory[0] = (uint32_t)page_table1 | 0x03;
}