summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2015-01-02 17:45:52 +0000
committeralc <alc@FreeBSD.org>2015-01-02 17:45:52 +0000
commitd5a13901bff0d31efdcb363925086b0e00bea32b (patch)
treefa41565eff257f888b11c0e324e0bc2f147f72ad /sys/arm
parent5309e52c3c33e83023a6edac5ef5dea2b34b5c55 (diff)
downloadFreeBSD-src-d5a13901bff0d31efdcb363925086b0e00bea32b.zip
FreeBSD-src-d5a13901bff0d31efdcb363925086b0e00bea32b.tar.gz
MFC r273701, r274556
By the time that pmap_init() runs, vm_phys_segs[] has been initialized. Obtaining the end of memory address from vm_phys_segs[] is a little easier than obtaining it from phys_avail[]. Enable the use of VM_PHYSSEG_SPARSE on amd64 and i386, making it the default on i386 PAE. (The use of VM_PHYSSEG_SPARSE on i386 PAE saves us some precious kernel virtual address space that would have been wasted on unused vm_page structures.)
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