From 3c2ee7b28cfd715e28e72d76efd89ba3c38aa970 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 28 Dec 2021 17:17:42 -0600 Subject: [PATCH] arm64: Enhance pmap_pte_exists()'s error reporting Report the descriptor type and level at which the page table does not match the caller's expectations. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 4bd3eef7a18f..15bb813f591d 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -607,6 +607,7 @@ pmap_pte_exists(pmap_t pmap, vm_offset_t va, int level, const char *diag) { pd_entry_t *l0p, *l1p, *l2p; pt_entry_t desc, *l3p; + int walk_level __diagused; KASSERT(level >= 0 && level < 4, ("%s: %s passed an out-of-range level (%d)", __func__, diag, @@ -628,11 +629,17 @@ pmap_pte_exists(pmap_t pmap, vm_offset_t va, int level, const char *diag) desc = pmap_load(l3p) & ATTR_DESCR_MASK; if (desc == L3_PAGE && level == 3) return (l3p); - } - } - } + else + walk_level = 3; + } else + walk_level = 2; + } else + walk_level = 1; + } else + walk_level = 0; KASSERT(diag == NULL, - ("%s: va %#lx is not mapped at level %d", diag, va, level)); + ("%s: va %#lx not mapped at level %d, desc %ld at level %d", + diag, va, level, desc, walk_level)); return (NULL); }