summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-10-07 17:37:26 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-10-07 17:37:26 -0400
commit434ddcd907832b1febc7d70e4faa52109c7eb3bd (patch)
tree00c1ade91f9806d831f10e6006732b294e73f613 /arch/x86_64/hal
parent8d48bbd9746228b63bafa5f92b621998d7d8f3d3 (diff)
downloadjove-kernel-434ddcd907832b1febc7d70e4faa52109c7eb3bd.tar.gz
jove-kernel-434ddcd907832b1febc7d70e4faa52109c7eb3bd.tar.bz2
jove-kernel-434ddcd907832b1febc7d70e4faa52109c7eb3bd.zip
add memory region object for better memory managment
Diffstat (limited to 'arch/x86_64/hal')
-rw-r--r--arch/x86_64/hal/obj.c2
-rw-r--r--arch/x86_64/hal/paging.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/arch/x86_64/hal/obj.c b/arch/x86_64/hal/obj.c
index 75cb0c0..110351c 100644
--- a/arch/x86_64/hal/obj.c
+++ b/arch/x86_64/hal/obj.c
@@ -1,5 +1,5 @@
#include "obj.h"
-#include "arch/x86_64/lock.h"
+#include "sys/lock.h"
#include "lib/printf.h"
#include "paging.h"
#include "hal/obj.h"
diff --git a/arch/x86_64/hal/paging.c b/arch/x86_64/hal/paging.c
index a0d6ca9..1587c62 100644
--- a/arch/x86_64/hal/paging.c
+++ b/arch/x86_64/hal/paging.c
@@ -28,6 +28,14 @@ phys_tovirt(uintptr_t phys)
return (void*)(phys | IDENT_VIRT_BASE);
}
+physaddr_t
+phys_fromvirt(virtaddr_t virt)
+{
+ if(virt < IDENT_VIRT_BASE) return 0;
+ if(virt > KERNEL_VIRT_BASE) return KPTR_TOPHYS(virt);
+ return virt & ~IDENT_VIRT_BASE;
+}
+
uintptr_t
paging_get_pml4(void)
{