#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); }