diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2025-08-19 15:03:42 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2025-08-19 15:03:42 -0400 |
commit | 772717dc22e04b4d168d0f77bee6b6357118768c (patch) | |
tree | 9da95703c3376091904e295930104b51c280008d /arch/x86_64/page-mapping.c | |
parent | 7ee9347560768641096df68c545ac085a20233e4 (diff) | |
download | jove-kernel-main.tar.gz jove-kernel-main.tar.bz2 jove-kernel-main.zip |
refactor KO_MEMORY_MAPPING invokemain
Diffstat (limited to 'arch/x86_64/page-mapping.c')
-rw-r--r-- | arch/x86_64/page-mapping.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <stddef.h> + +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); +} |