From e8b1030e140bf0590b4acd4d6dcb84afc7af6403 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 1 Oct 2023 03:19:35 +0200 Subject: pmap: Factorize l4 base access This also makes the code more coherent with other levels. --- i386/intel/pmap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c index 7d0ec6c8..e8016fe6 100644 --- a/i386/intel/pmap.c +++ b/i386/intel/pmap.c @@ -448,8 +448,11 @@ pmap_ptp(const pmap_t pmap, vm_offset_t lin_addr) { pt_entry_t *pdp_table; #ifdef __x86_64__ - pt_entry_t pdp; - pdp = pmap->l4base[lin2l4num(lin_addr)]; + pt_entry_t *l4_table; + l4_table = pmap_l4base(pmap, lin_addr); + if (l4_table == PT_ENTRY_NULL) + return(PT_ENTRY_NULL); + pt_entry_t pdp = *l4_table; if ((pdp & INTEL_PTE_VALID) == 0) return PT_ENTRY_NULL; pdp_table = (pt_entry_t *) ptetokv(pdp); -- cgit v1.2.3