Date: Fri, 18 Sep 2020 12:37:41 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365879 - head/sys/arm64/arm64 Message-ID: <202009181237.08ICbf2F075235@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Sep 18 12:37:41 2020 New Revision: 365879 URL: https://svnweb.freebsd.org/changeset/base/365879 Log: Assert we are not traversing through superpages in the arm64 pmap. Reviewed by: alc, andrew MFC after: 1 week Sponsored by: Juniper Networks, Inc., Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26465 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Fri Sep 18 12:30:39 2020 (r365878) +++ head/sys/arm64/arm64/pmap.c Fri Sep 18 12:37:41 2020 (r365879) @@ -433,12 +433,15 @@ pmap_l1(pmap_t pmap, vm_offset_t va) } static __inline pd_entry_t * -pmap_l1_to_l2(pd_entry_t *l1, vm_offset_t va) +pmap_l1_to_l2(pd_entry_t *l1p, vm_offset_t va) { - pd_entry_t *l2; + pd_entry_t l1, *l2p; - l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); - return (&l2[pmap_l2_index(va)]); + l1 = pmap_load(l1p); + KASSERT((l1 & ATTR_DESCR_MASK) == L1_TABLE, + ("%s: L1 entry %#lx is a leaf", __func__, l1)); + l2p = (pd_entry_t *)PHYS_TO_DMAP(l1 & ~ATTR_MASK); + return (&l2p[pmap_l2_index(va)]); } static __inline pd_entry_t * @@ -454,12 +457,16 @@ pmap_l2(pmap_t pmap, vm_offset_t va) } static __inline pt_entry_t * -pmap_l2_to_l3(pd_entry_t *l2, vm_offset_t va) +pmap_l2_to_l3(pd_entry_t *l2p, vm_offset_t va) { - pt_entry_t *l3; + pd_entry_t l2; + pt_entry_t *l3p; - l3 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l2) & ~ATTR_MASK); - return (&l3[pmap_l3_index(va)]); + l2 = pmap_load(l2p); + KASSERT((l2 & ATTR_DESCR_MASK) == L2_TABLE, + ("%s: L2 entry %#lx is a leaf", __func__, l2)); + l3p = (pt_entry_t *)PHYS_TO_DMAP(l2 & ~ATTR_MASK); + return (&l3p[pmap_l3_index(va)]); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009181237.08ICbf2F075235>