blob: 0de5bfaa0bda145d0c4152ffea16e56ee97bfa49 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
}
|