diff options
author | alc <alc@FreeBSD.org> | 2014-10-26 17:56:47 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2014-10-26 17:56:47 +0000 |
commit | dc84db712f49f0e5b76255c06d74c409e2b15079 (patch) | |
tree | 27c065bf1dba723914a91e8e924d8d2f4b3707bc | |
parent | bc5702addf6a68dc471c6dd3884ca164587b8271 (diff) | |
download | FreeBSD-src-dc84db712f49f0e5b76255c06d74c409e2b15079.zip FreeBSD-src-dc84db712f49f0e5b76255c06d74c409e2b15079.tar.gz |
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[].
Discussed with: Svatopluk Kraus
-rw-r--r-- | sys/amd64/amd64/pmap.c | 4 | ||||
-rw-r--r-- | sys/arm/arm/pmap-v6.c | 6 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index b57e5f1..29e6980 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> +#include <vm/vm_phys.h> #include <vm/vm_radix.h> #include <vm/vm_reserv.h> #include <vm/uma.h> @@ -1056,8 +1057,7 @@ pmap_init(void) /* * Calculate the size of the pv head table for superpages. */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_2mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = howmany(vm_phys_segs[vm_phys_nsegs - 1].end, NBPDR); /* * Allocate memory for the pv head table for superpages. diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index c0d5a2e..a913809 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. diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 90ea046..8513724 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/vm_pageout.h> #include <vm/vm_pager.h> +#include <vm/vm_phys.h> #include <vm/vm_radix.h> #include <vm/vm_reserv.h> #include <vm/uma.h> @@ -778,9 +779,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_4mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = trunc_4mpage(vm_phys_segs[vm_phys_nsegs - 1].end - + PAGE_SIZE) / NBPDR + 1; /* * Allocate memory for the pv head table for superpages. |