summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/pmap-v6.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c
index b2be785..3df1c8a 100644
--- a/sys/arm/arm/pmap-v6.c
+++ b/sys/arm/arm/pmap-v6.c
@@ -172,6 +172,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
+#include <vm/vm_phys.h>
#include <vm/vm_extern.h>
#include <vm/vm_reserv.h>
@@ -1342,9 +1343,10 @@ pmap_init(void)
/*
* Calculate the size of the pv head table for superpages.
+ * Handle the possibility that "vm_phys_segs[...].end" is zero.
*/
- for (i = 0; phys_avail[i + 1]; i += 2);
- pv_npg = round_1mpage(phys_avail[(i - 2) + 1]) / NBPDR;
+ pv_npg = trunc_1mpage(vm_phys_segs[vm_phys_nsegs - 1].end -
+ PAGE_SIZE) / NBPDR + 1;
/*
* Allocate memory for the pv head table for superpages.
OpenPOWER on IntegriCloud