From 5fc386102380e6c15c81df4fd750f54641535eaa Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Tue, 15 Feb 2022 15:00:53 +0000 Subject: beginning to things out into cpu-dependent and cpu-independent code --- kc/core/memory.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'kc/core/memory.c') diff --git a/kc/core/memory.c b/kc/core/memory.c index 7571f0d..0319246 100644 --- a/kc/core/memory.c +++ b/kc/core/memory.c @@ -3,6 +3,7 @@ #include "panic.h" #include "vm_tree.h" #include "vm_object.h" +#include "cpu/mmu.h" #include @@ -109,13 +110,7 @@ static size_t init_get_max_paddr(struct memory_range *ranges, int count) static phys_addr_t get_kernel_pm4_phys(void) { - phys_addr_t pm4_phys; - __asm__ ( - "mov %%cr3, %0\n\t" - : "=r"(pm4_phys) - ); - - return page_address(pm4_phys, 1); + return mmu_get_map(); } static phys_addr_t get_kernel_pm3_phys(void) @@ -382,7 +377,7 @@ void page_unmap(void *vaddr) { *pte = 0; } - __asm__ ("invlpg (%0)" :: "r"(vaddr)); + mmu_invalidate(vaddr); } phys_addr_t page_alloc(void) -- cgit v1.3.1-1-g115d