From 688834a82775540c28ce314579b80964d94aed3c Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 27 Jun 2014 17:22:18 +0000 Subject: [PATCH] MFC 261781: Don't waste a page of KVA for the boot-time memory test on x86. For amd64, reuse the first page of the crashdumpmap as CMAP1/CADDR1. For i386, remove CMAP1/CADDR1 entirely and reuse CMAP3/CADDR3 for the memory test. git-svn-id: svn://svn.freebsd.org/base/stable/10@267964 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/amd64/amd64/pmap.c | 13 +++++-------- sys/i386/i386/machdep.c | 4 ++-- sys/i386/i386/pmap.c | 8 +++----- sys/i386/include/pmap.h | 4 ++-- sys/i386/xen/pmap.c | 4 ++-- sys/pc98/pc98/machdep.c | 4 ++-- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 2b6102331..05ae8bb57 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -812,7 +812,7 @@ void pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; - pt_entry_t *pte, *unused; + pt_entry_t *pte; /* * Create an initial set of page tables to run the kernel in. @@ -858,14 +858,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pte = vtopte(va); /* - * CMAP1 is only used for the memory test. - */ - SYSMAP(caddr_t, CMAP1, CADDR1, 1) - - /* - * Crashdump maps. + * Crashdump maps. The first page is reused as CMAP1 for the + * memory test. */ - SYSMAP(caddr_t, unused, crashdumpmap, MAXDUMPPGS) + SYSMAP(caddr_t, CMAP1, crashdumpmap, MAXDUMPPGS) + CADDR1 = crashdumpmap; virtual_avail = va; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 2e1785b0c..9e25cd983 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2387,7 +2387,7 @@ getmemsize(int first) phys_avail[pa_indx++] = physmap[0]; phys_avail[pa_indx] = physmap[0]; dump_avail[da_indx] = physmap[0]; - pte = CMAP1; + pte = CMAP3; /* * Get dcons buffer address @@ -2409,7 +2409,7 @@ getmemsize(int first) end = trunc_page(physmap[i + 1]); for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { int tmp, page_bad, full; - int *ptr = (int *)CADDR1; + int *ptr = (int *)CADDR3; full = FALSE; /* diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index d5f31ec7b..1f9acfe86 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -256,11 +256,10 @@ struct sysmaps { caddr_t CADDR2; }; static struct sysmaps sysmaps_pcpu[MAXCPU]; -pt_entry_t *CMAP1 = 0; -static pt_entry_t *CMAP3; +pt_entry_t *CMAP3; static pd_entry_t *KPTD; -caddr_t CADDR1 = 0, ptvmmap = 0; -static caddr_t CADDR3; +caddr_t ptvmmap = 0; +caddr_t CADDR3; struct msgbuf *msgbufp = 0; /* @@ -434,7 +433,6 @@ pmap_bootstrap(vm_paddr_t firstaddr) SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1) SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1) } - SYSMAP(caddr_t, CMAP1, CADDR1, 1) SYSMAP(caddr_t, CMAP3, CADDR3, 1) /* diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 0303c604b..100475c7b 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -420,8 +420,8 @@ struct pv_chunk { #ifdef _KERNEL -extern caddr_t CADDR1; -extern pt_entry_t *CMAP1; +extern caddr_t CADDR3; +extern pt_entry_t *CMAP3; extern vm_paddr_t phys_avail[]; extern vm_paddr_t dump_avail[]; extern int pseflag; diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c index 9f3e8bb88..fa9bda813 100644 --- a/sys/i386/xen/pmap.c +++ b/sys/i386/xen/pmap.c @@ -249,9 +249,9 @@ struct sysmaps { caddr_t CADDR2; }; static struct sysmaps sysmaps_pcpu[MAXCPU]; -static pt_entry_t *CMAP3; +pt_entry_t *CMAP3; caddr_t ptvmmap = 0; -static caddr_t CADDR3; +caddr_t CADDR3; struct msgbuf *msgbufp = 0; /* diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index a4887c6a4..a5b799dc7 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1962,7 +1962,7 @@ getmemsize(int first) phys_avail[pa_indx++] = physmap[0]; phys_avail[pa_indx] = physmap[0]; dump_avail[da_indx] = physmap[0]; - pte = CMAP1; + pte = CMAP3; /* * Get dcons buffer address @@ -1983,7 +1983,7 @@ getmemsize(int first) end = trunc_page(physmap[i + 1]); for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { int tmp, page_bad, full; - int *ptr = (int *)CADDR1; + int *ptr = (int *)CADDR3; full = FALSE; /* -- 2.45.0