arm64_pmap: narrow scope of bti_same test
The pmap_bti_same test in pmap_enter_l3c only happens in the !ADDR_IS_KERNEL case; in the other case, a KASSERT fails. So move the test into that case to save a bit of time when ADDR_IS_KERNEL. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D45160
This commit is contained in:
+13
-14
@@ -5662,6 +5662,19 @@ pmap_enter_l3c(pmap_t pmap, vm_offset_t va, pt_entry_t l3e, u_int flags,
|
||||
}
|
||||
}
|
||||
l3p = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*ml3p));
|
||||
|
||||
have_l3p:
|
||||
/*
|
||||
* If bti is not the same for the whole L3C range, return
|
||||
* failure and let vm_fault() cope. Check after L3 allocation,
|
||||
* since it could sleep.
|
||||
*/
|
||||
if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) {
|
||||
(*ml3p)->ref_count -= L3C_ENTRIES - 1;
|
||||
pmap_abort_ptp(pmap, va, *ml3p);
|
||||
*ml3p = NULL;
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
} else {
|
||||
*ml3p = NULL;
|
||||
|
||||
@@ -5684,22 +5697,8 @@ pmap_enter_l3c(pmap_t pmap, vm_offset_t va, pt_entry_t l3e, u_int flags,
|
||||
pmap_load(pde)));
|
||||
}
|
||||
}
|
||||
have_l3p:
|
||||
l3p = &l3p[pmap_l3_index(va)];
|
||||
|
||||
/*
|
||||
* If bti is not the same for the whole L3C range, return failure
|
||||
* and let vm_fault() cope. Check after L3 allocation, since
|
||||
* it could sleep.
|
||||
*/
|
||||
if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) {
|
||||
KASSERT(*ml3p != NULL, ("pmap_enter_l3c: missing L3 PTP"));
|
||||
(*ml3p)->ref_count -= L3C_ENTRIES - 1;
|
||||
pmap_abort_ptp(pmap, va, *ml3p);
|
||||
*ml3p = NULL;
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there are existing mappings, either abort or remove them.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user