svn commit: r265317 - projects/arm64/sys/arm64/arm64
Andrew Turner
andrew at FreeBSD.org
Sun May 4 09:07:46 UTC 2014
Author: andrew
Date: Sun May 4 09:07:45 2014
New Revision: 265317
URL: http://svnweb.freebsd.org/changeset/base/265317
Log:
Check if the end address is within the new range before using it.
Modified:
projects/arm64/sys/arm64/arm64/pmap.c
Modified: projects/arm64/sys/arm64/arm64/pmap.c
==============================================================================
--- projects/arm64/sys/arm64/arm64/pmap.c Sun May 4 08:32:53 2014 (r265316)
+++ projects/arm64/sys/arm64/arm64/pmap.c Sun May 4 09:07:45 2014 (r265317)
@@ -162,13 +162,24 @@ pmap_bootstrap(vm_offset_t l1pt, vm_padd
KASSERT(((va >> L2_SHIFT) & Ln_ADDR_MASK) == l2_slot,
("VA inconsistency detected"));
- if (pa >= physmap[map_slot] + physmap[map_slot + 1]) {
+ /*
+ * Check if we can use the current pa, some of it
+ * may fall out side the current physmap slot.
+ */
+ if (pa + L2_SIZE > physmap[map_slot] + physmap[map_slot + 1]) {
map_slot += 2;
- KASSERT(map_slot < physmap_idx, ("..."));
pa = physmap[map_slot];
+ pa = roundup2(pa, L2_SIZE);
+
+ /* TODO: should we wrap if we hit this? */
+ KASSERT(map_slot < physmap_idx,
+ ("Attempting to use invalid physical memory"));
+ /* TODO: This should be easy to fix */
+ KASSERT(pa + L2_SIZE <
+ physmap[map_slot] + physmap[map_slot + 1],
+ ("Physical slot too small"));
}
- /* TODO: Check if this pa is valid */
ptep[l2_slot] = (pa & ~L2_OFFSET) | ATTR_AF | L2_BLOCK;
va += L2_SIZE;
More information about the svn-src-projects
mailing list