8000 arm64: Handle an unaligned start in pmap_mask_set_locked() · mcusim/freebsd-src@383fd3e · GitHub
[go: up one dir, main page]

Skip to content

Commit 383fd3e

Browse files
committed
arm64: Handle an unaligned start in pmap_mask_set_locked()
In pmap_mask_set_locked(), correctly handle a starting address that is in the middle of an L3C page. The symptoms arising from this error included assertion failures in pmap_demote_l3c(). Reported by: andrew Reviewed by: markj Fixes: fd6cb03 "arm64 pmap: Add ATTR_CONTIGUOUS support [Part 1]" Differential Revision: https://reviews.freebsd.org/D45851
1 parent 7f50027 commit 383fd3e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

sys/arm64/arm64/pmap.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4403,8 +4403,22 @@ pmap_mask_set_locked(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t m
44034403
va = va_next;
44044404
}
44054405
if ((l3 & ATTR_CONTIGUOUS) != 0) {
4406-
l3p += L3C_ENTRIES - 1;
4407-
sva += L3C_SIZE - L3_SIZE;
4406+
/*
4407+
* Does this L3C page extend beyond
4408+
* the requested range? Handle the
4409+
* possibility that "va_next" is zero.
4410+
*/
4411+
if ((sva | L3C_OFFSET) > va_next - 1)
4412+
break;
4413+
4414+
/*
4415+
* Skip ahead to the last L3_PAGE
4416+
* within this L3C page.
4417+
*/
4418+
l3p = (pt_entry_t *)((uintptr_t)l3p |
4419+
((L3C_ENTRIES - 1) *
4420+
sizeof(pt_entry_t)));
4421+
sva |= L3C_SIZE - L3_SIZE;
44084422
}
44094423
continue;
44104424
}

0 commit comments

Comments
 (0)
0