summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal/paging.c
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/paging.c
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/paging.c')
-rw-r--r--arch/x86_64/hal/paging.c8
1 files changed, 8 insertions, 0 deletions
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)
{