diff options
Diffstat (limited to 'include/arch/x86_64')
-rw-r--r-- | include/arch/x86_64/page-mapping.h | 7 | ||||
-rw-r--r-- | include/arch/x86_64/page.h | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/arch/x86_64/page-mapping.h b/include/arch/x86_64/page-mapping.h index bc495dd..fd620ea 100644 --- a/include/arch/x86_64/page-mapping.h +++ b/include/arch/x86_64/page-mapping.h @@ -5,4 +5,11 @@ pmle_t *page_mapping_traverse(pmle_t *pml4, uint8_t depth, uint16_t *path); +/**@FUNC Get the pmle associated with this virtual address down to a given depth. + * At depth=0, gets &pml4[pml4i] + * At depth=1, gets &pml4[pml4i][pml3i] + * At depth=2, gets &pml4[pml4i][pml3i][pml2i] + * etc...*/ +pmle_t *mem_mapping_vptr_mapping(pmle_t *pml4, uint8_t depth, uintptr_t vptr); + #endif diff --git a/include/arch/x86_64/page.h b/include/arch/x86_64/page.h index e62b8d6..7c6186a 100644 --- a/include/arch/x86_64/page.h +++ b/include/arch/x86_64/page.h @@ -33,8 +33,8 @@ typedef union jove_PageMapLevelEntry typedef uint16_t pmli_t; -#define PML_SHL(l) ((l * 9) + 3) -#define PML_I_FOR_LAYER(v, l) ((v >> PML_SHL(l)) % 512) +#define PML_SHL(l) (((l) * 9) + 3) +#define PML_I_FOR_LAYER(v, l) (((v) >> PML_SHL(l)) % 512) uintptr_t vmem_ident_tophys(void *vptr); void *vmem_phys_tovirt(uintptr_t pptr); |