summaryrefslogtreecommitdiff
path: root/kc/core/memory.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-02-15 15:00:53 +0000
committerAda Christine <adachristine18@gmail.com>2022-02-15 15:00:53 +0000
commit5fc386102380e6c15c81df4fd750f54641535eaa (patch)
treec3aed0635aa10a80e1bbbe46a80e4e67f2be2c39 /kc/core/memory.c
parent0c1bc025700656ce17bbd71f7d149744d65b7fb6 (diff)
beginning to things out into cpu-dependent and cpu-independent code
Diffstat (limited to 'kc/core/memory.c')
-rw-r--r--kc/core/memory.c11
1 files changed, 3 insertions, 8 deletions
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 <stdint.h>
@@ -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)