Sun May 15 10:35:54 2016 UTC ()
Explicitly mention MP_TRAMPOLINE in these comments, so that NXR links them.


(maxv)
diff -r1.216 -r1.217 src/sys/arch/amd64/amd64/machdep.c
diff -r1.754 -r1.755 src/sys/arch/i386/i386/machdep.c
diff -r1.194 -r1.195 src/sys/arch/x86/x86/pmap.c

cvs diff -r1.216 -r1.217 src/sys/arch/amd64/amd64/machdep.c (expand / switch to unified diff)

--- src/sys/arch/amd64/amd64/machdep.c 2016/05/12 06:45:16 1.216
+++ src/sys/arch/amd64/amd64/machdep.c 2016/05/15 10:35:54 1.217
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.216 2016/05/12 06:45:16 maxv Exp $ */ 1/* $NetBSD: machdep.c,v 1.217 2016/05/15 10:35:54 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 4 * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
5 * The NetBSD Foundation, Inc. 5 * The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace 9 * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
10 * Simulation Facility, NASA Ames Research Center. 10 * Simulation Facility, NASA Ames Research Center.
11 * 11 *
12 * This code is derived from software contributed to The NetBSD Foundation 12 * This code is derived from software contributed to The NetBSD Foundation
13 * by Coyote Point Systems, Inc. which was written under contract to Coyote 13 * by Coyote Point Systems, Inc. which was written under contract to Coyote
14 * Point by Jed Davis and Devon O'Dell. 14 * Point by Jed Davis and Devon O'Dell.
@@ -101,27 +101,27 @@ @@ -101,27 +101,27 @@
101 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 101 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
102 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 102 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
103 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 103 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
104 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 104 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
105 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 105 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
106 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 106 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
107 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 107 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
108 * SUCH DAMAGE. 108 * SUCH DAMAGE.
109 * 109 *
110 * @(#)machdep.c 7.4 (Berkeley) 6/3/91 110 * @(#)machdep.c 7.4 (Berkeley) 6/3/91
111 */ 111 */
112 112
113#include <sys/cdefs.h> 113#include <sys/cdefs.h>
114__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.216 2016/05/12 06:45:16 maxv Exp $"); 114__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.217 2016/05/15 10:35:54 maxv Exp $");
115 115
116/* #define XENDEBUG_LOW */ 116/* #define XENDEBUG_LOW */
117 117
118#include "opt_modular.h" 118#include "opt_modular.h"
119#include "opt_user_ldt.h" 119#include "opt_user_ldt.h"
120#include "opt_ddb.h" 120#include "opt_ddb.h"
121#include "opt_kgdb.h" 121#include "opt_kgdb.h"
122#include "opt_cpureset_delay.h" 122#include "opt_cpureset_delay.h"
123#include "opt_mtrr.h" 123#include "opt_mtrr.h"
124#include "opt_realmem.h" 124#include "opt_realmem.h"
125#include "opt_xen.h" 125#include "opt_xen.h"
126#ifndef XEN 126#ifndef XEN
127#include "opt_physmem.h" 127#include "opt_physmem.h"
@@ -1569,27 +1569,27 @@ init_x86_64(paddr_t first_avail) @@ -1569,27 +1569,27 @@ init_x86_64(paddr_t first_avail)
1569 1569
1570 /* 1570 /*
1571 * Initialize PAGE_SIZE-dependent variables. 1571 * Initialize PAGE_SIZE-dependent variables.
1572 */ 1572 */
1573 uvm_setpagesize(); 1573 uvm_setpagesize();
1574 1574
1575 uvmexp.ncolors = 2; 1575 uvmexp.ncolors = 2;
1576 1576
1577#ifndef XEN 1577#ifndef XEN
1578 /* 1578 /*
1579 * Low memory reservations: 1579 * Low memory reservations:
1580 * Page 0: BIOS data 1580 * Page 0: BIOS data
1581 * Page 1: BIOS callback (not used yet, for symmetry with i386) 1581 * Page 1: BIOS callback (not used yet, for symmetry with i386)
1582 * Page 2: MP bootstrap 1582 * Page 2: MP bootstrap code (MP_TRAMPOLINE)
1583 * Page 3: ACPI wakeup code (ACPI_WAKEUP_ADDR) 1583 * Page 3: ACPI wakeup code (ACPI_WAKEUP_ADDR)
1584 * Page 4: Temporary page table for 0MB-4MB 1584 * Page 4: Temporary page table for 0MB-4MB
1585 * Page 5: Temporary page directory 1585 * Page 5: Temporary page directory
1586 * Page 6: Temporary page map level 3 1586 * Page 6: Temporary page map level 3
1587 * Page 7: Temporary page map level 4 1587 * Page 7: Temporary page map level 4
1588 */ 1588 */
1589 avail_start = 8 * PAGE_SIZE; 1589 avail_start = 8 * PAGE_SIZE;
1590 1590
1591#if !defined(REALBASEMEM) && !defined(REALEXTMEM) 1591#if !defined(REALBASEMEM) && !defined(REALEXTMEM)
1592 /* 1592 /*
1593 * Check to see if we have a memory map from the BIOS (passed 1593 * Check to see if we have a memory map from the BIOS (passed
1594 * to us by the boot program. 1594 * to us by the boot program.
1595 */ 1595 */

cvs diff -r1.754 -r1.755 src/sys/arch/i386/i386/machdep.c (expand / switch to unified diff)

--- src/sys/arch/i386/i386/machdep.c 2015/04/24 00:04:04 1.754
+++ src/sys/arch/i386/i386/machdep.c 2016/05/15 10:35:54 1.755
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.754 2015/04/24 00:04:04 khorben Exp $ */ 1/* $NetBSD: machdep.c,v 1.755 2016/05/15 10:35:54 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 4 * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
5 * The NetBSD Foundation, Inc. 5 * The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace 9 * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace
10 * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal, 10 * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal,
11 * and by Andrew Doran. 11 * and by Andrew Doran.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions 14 * modification, are permitted provided that the following conditions
@@ -57,27 +57,27 @@ @@ -57,27 +57,27 @@
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE. 64 * SUCH DAMAGE.
65 * 65 *
66 * @(#)machdep.c 7.4 (Berkeley) 6/3/91 66 * @(#)machdep.c 7.4 (Berkeley) 6/3/91
67 */ 67 */
68 68
69#include <sys/cdefs.h> 69#include <sys/cdefs.h>
70__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.754 2015/04/24 00:04:04 khorben Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.755 2016/05/15 10:35:54 maxv Exp $");
71 71
72#include "opt_beep.h" 72#include "opt_beep.h"
73#include "opt_compat_ibcs2.h" 73#include "opt_compat_ibcs2.h"
74#include "opt_compat_freebsd.h" 74#include "opt_compat_freebsd.h"
75#include "opt_compat_netbsd.h" 75#include "opt_compat_netbsd.h"
76#include "opt_compat_svr4.h" 76#include "opt_compat_svr4.h"
77#include "opt_cpureset_delay.h" 77#include "opt_cpureset_delay.h"
78#include "opt_ddb.h" 78#include "opt_ddb.h"
79#include "opt_ipkdb.h" 79#include "opt_ipkdb.h"
80#include "opt_kgdb.h" 80#include "opt_kgdb.h"
81#include "opt_mtrr.h" 81#include "opt_mtrr.h"
82#include "opt_modular.h" 82#include "opt_modular.h"
83#include "opt_multiboot.h" 83#include "opt_multiboot.h"
@@ -1187,28 +1187,28 @@ init386(paddr_t first_avail) @@ -1187,28 +1187,28 @@ init386(paddr_t first_avail)
1187 1187
1188 /* 1188 /*
1189 * Start with 2 color bins -- this is just a guess to get us 1189 * Start with 2 color bins -- this is just a guess to get us
1190 * started. We'll recolor when we determine the largest cache 1190 * started. We'll recolor when we determine the largest cache
1191 * sizes on the system. 1191 * sizes on the system.
1192 */ 1192 */
1193 uvmexp.ncolors = 2; 1193 uvmexp.ncolors = 2;
1194 1194
1195#ifndef XEN 1195#ifndef XEN
1196 /* 1196 /*
1197 * Low memory reservations: 1197 * Low memory reservations:
1198 * Page 0: BIOS data 1198 * Page 0: BIOS data
1199 * Page 1: BIOS callback 1199 * Page 1: BIOS callback
1200 * Page 2: MP bootstrap 1200 * Page 2: MP bootstrap code (MP_TRAMPOLINE)
1201 * Page 3: ACPI wakeup code 1201 * Page 3: ACPI wakeup code (ACPI_WAKEUP_ADDR)
1202 * Page 4: Temporary page table for 0MB-4MB 1202 * Page 4: Temporary page table for 0MB-4MB
1203 * Page 5: Temporary page directory 1203 * Page 5: Temporary page directory
1204 */ 1204 */
1205 avail_start = 6 * PAGE_SIZE; 1205 avail_start = 6 * PAGE_SIZE;
1206#else /* !XEN */ 1206#else /* !XEN */
1207 /* steal one page for gdt */ 1207 /* steal one page for gdt */
1208 gdt = (void *)((u_long)first_avail + KERNBASE); 1208 gdt = (void *)((u_long)first_avail + KERNBASE);
1209 first_avail += PAGE_SIZE; 1209 first_avail += PAGE_SIZE;
1210 /* Make sure the end of the space used by the kernel is rounded. */ 1210 /* Make sure the end of the space used by the kernel is rounded. */
1211 first_avail = round_page(first_avail); 1211 first_avail = round_page(first_avail);
1212 avail_start = first_avail; 1212 avail_start = first_avail;
1213 avail_end = ctob((paddr_t)xen_start_info.nr_pages); 1213 avail_end = ctob((paddr_t)xen_start_info.nr_pages);
1214 pmap_pa_start = (KERNTEXTOFF - KERNBASE); 1214 pmap_pa_start = (KERNTEXTOFF - KERNBASE);

cvs diff -r1.194 -r1.195 src/sys/arch/x86/x86/pmap.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/pmap.c 2016/05/14 09:37:21 1.194
+++ src/sys/arch/x86/x86/pmap.c 2016/05/15 10:35:54 1.195
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.194 2016/05/14 09:37:21 maxv Exp $ */ 1/* $NetBSD: pmap.c,v 1.195 2016/05/15 10:35:54 maxv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -161,27 +161,27 @@ @@ -161,27 +161,27 @@
161 * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson 161 * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson
162 * and David Greenman. 162 * and David Greenman.
163 * 163 *
164 * [3] the Mach pmap. this pmap, from CMU, seems to have migrated 164 * [3] the Mach pmap. this pmap, from CMU, seems to have migrated
165 * between several processors. the VAX version was done by 165 * between several processors. the VAX version was done by
166 * Avadis Tevanian, Jr., and Michael Wayne Young. the i386 166 * Avadis Tevanian, Jr., and Michael Wayne Young. the i386
167 * version was done by Lance Berc, Mike Kupfer, Bob Baron, 167 * version was done by Lance Berc, Mike Kupfer, Bob Baron,
168 * David Golub, and Richard Draves. the alpha version was 168 * David Golub, and Richard Draves. the alpha version was
169 * done by Alessandro Forin (CMU/Mach) and Chris Demetriou 169 * done by Alessandro Forin (CMU/Mach) and Chris Demetriou
170 * (NetBSD/alpha). 170 * (NetBSD/alpha).
171 */ 171 */
172 172
173#include <sys/cdefs.h> 173#include <sys/cdefs.h>
174__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.194 2016/05/14 09:37:21 maxv Exp $"); 174__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.195 2016/05/15 10:35:54 maxv Exp $");
175 175
176#include "opt_user_ldt.h" 176#include "opt_user_ldt.h"
177#include "opt_lockdebug.h" 177#include "opt_lockdebug.h"
178#include "opt_multiprocessor.h" 178#include "opt_multiprocessor.h"
179#include "opt_xen.h" 179#include "opt_xen.h"
180#if !defined(__x86_64__) 180#if !defined(__x86_64__)
181#include "opt_kstack_dr0.h" 181#include "opt_kstack_dr0.h"
182#endif /* !defined(__x86_64__) */ 182#endif /* !defined(__x86_64__) */
183 183
184#include <sys/param.h> 184#include <sys/param.h>
185#include <sys/systm.h> 185#include <sys/systm.h>
186#include <sys/proc.h> 186#include <sys/proc.h>
187#include <sys/pool.h> 187#include <sys/pool.h>
@@ -4521,35 +4521,35 @@ pmap_update(struct pmap *pmap) @@ -4521,35 +4521,35 @@ pmap_update(struct pmap *pmap)
4521 pmap_free_ptps(empty_ptps); 4521 pmap_free_ptps(empty_ptps);
4522 } 4522 }
4523} 4523}
4524 4524
4525#if PTP_LEVELS > 4 4525#if PTP_LEVELS > 4
4526#error "Unsupported number of page table mappings" 4526#error "Unsupported number of page table mappings"
4527#endif 4527#endif
4528 4528
4529paddr_t 4529paddr_t
4530pmap_init_tmp_pgtbl(paddr_t pg) 4530pmap_init_tmp_pgtbl(paddr_t pg)
4531{ 4531{
4532 static bool maps_loaded; 4532 static bool maps_loaded;
4533 static const paddr_t x86_tmp_pml_paddr[] = { 4533 static const paddr_t x86_tmp_pml_paddr[] = {
4534 4 * PAGE_SIZE, 4534 4 * PAGE_SIZE, /* L1 */
4535 5 * PAGE_SIZE, 4535 5 * PAGE_SIZE, /* L2 */
4536 6 * PAGE_SIZE, 4536 6 * PAGE_SIZE, /* L3 */
4537 7 * PAGE_SIZE 4537 7 * PAGE_SIZE /* L4 */
4538 }; 4538 };
4539 static vaddr_t x86_tmp_pml_vaddr[] = { 0, 0, 0, 0 }; 4539 static vaddr_t x86_tmp_pml_vaddr[] = { 0, 0, 0, 0 };
4540 4540
4541 pd_entry_t *tmp_pml, *kernel_pml; 4541 pd_entry_t *tmp_pml, *kernel_pml;
4542  4542
4543 int level; 4543 int level;
4544 4544
4545 if (!maps_loaded) { 4545 if (!maps_loaded) {
4546 for (level = 0; level < PTP_LEVELS; ++level) { 4546 for (level = 0; level < PTP_LEVELS; ++level) {
4547 x86_tmp_pml_vaddr[level] = 4547 x86_tmp_pml_vaddr[level] =
4548 uvm_km_alloc(kernel_map, PAGE_SIZE, 0, 4548 uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
4549 UVM_KMF_VAONLY); 4549 UVM_KMF_VAONLY);
4550 4550
4551 if (x86_tmp_pml_vaddr[level] == 0) 4551 if (x86_tmp_pml_vaddr[level] == 0)
4552 panic("mapping of real mode PML failed\n"); 4552 panic("mapping of real mode PML failed\n");
4553 pmap_kenter_pa(x86_tmp_pml_vaddr[level], 4553 pmap_kenter_pa(x86_tmp_pml_vaddr[level],
4554 x86_tmp_pml_paddr[level], 4554 x86_tmp_pml_paddr[level],
4555 VM_PROT_READ | VM_PROT_WRITE, 0); 4555 VM_PROT_READ | VM_PROT_WRITE, 0);