kernel: initial vmm implementation

This commit is contained in:
Matheus
2023-04-16 20:47:41 -03:00
parent fac767129e
commit 30d64485fd
6 changed files with 357 additions and 1 deletions
+2
View File
@@ -6,6 +6,7 @@
#include <kernel/term.h>
#include <kernel/pmm.h>
#include <arch/mmu.h>
#include <kernel/vmm.h>
static cpu_t bsp_cpu;
@@ -19,5 +20,6 @@ void kernel_entry() {
term_init();
logging_sethook(term_putchar);
arch_mmu_init();
vmm_init();
__assert(!"kernel entry end");
}
+1 -1
View File
@@ -69,7 +69,7 @@ static bool add_page(pagetableptr_t top, void *vaddr, uint64_t entry, int depth)
pdpt = pmm_alloc(1, PMM_SECTION_DEFAULT);
if (pdpt == NULL)
return false;
pml4[pml4offset] = (uint64_t)FROM_HHDM(pdpt) | INTERMEDIATE_FLAGS;
pml4[pml4offset] = (uint64_t)pdpt | INTERMEDIATE_FLAGS;
pdpt = MAKE_HHDM(pdpt);
memset(pdpt, 0, PAGE_SIZE);
}