From 772717dc22e04b4d168d0f77bee6b6357118768c Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Tue, 19 Aug 2025 15:03:42 -0400 Subject: refactor KO_MEMORY_MAPPING invoke --- arch/x86_64/page-mapping.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 arch/x86_64/page-mapping.c (limited to 'arch/x86_64/page-mapping.c') diff --git a/arch/x86_64/page-mapping.c b/arch/x86_64/page-mapping.c new file mode 100644 index 0000000..0de5bfa --- /dev/null +++ b/arch/x86_64/page-mapping.c @@ -0,0 +1,15 @@ +#include "arch/x86_64/page-mapping.h" +#include "arch/x86_64/page.h" +#include + +pmle_t* +page_mapping_traverse(pmle_t *pml4, uint8_t depth, uint16_t *path) +{ + uint16_t pathi = path[0]; + + pmle_t *pmle = &pml4[pathi]; + pmle_t *pmle_table = vmem_phys_tovirt(pmle->paddr << 12); + if(depth == 0) return pmle; + if(!pmle->p) return NULL; + return page_mapping_traverse(pmle_table, depth - 1, path + 1); +} -- cgit v1.2.1