| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: x86_machdep.c,v 1.143 2020/05/21 21:12:30 ad Exp $ */ | | 1 | /* $NetBSD: x86_machdep.c,v 1.144 2020/07/04 21:02:16 chs Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, | | 4 | * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, |
5 | * Copyright (c) 2005, 2008, 2009, 2019 The NetBSD Foundation, Inc. | | 5 | * Copyright (c) 2005, 2008, 2009, 2019 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 Julio M. Merino Vidal, and Andrew Doran. | | 9 | * by Julio M. Merino Vidal, and Andrew Doran. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.143 2020/05/21 21:12:30 ad Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.144 2020/07/04 21:02:16 chs Exp $"); |
35 | | | 35 | |
36 | #include "opt_modular.h" | | 36 | #include "opt_modular.h" |
37 | #include "opt_physmem.h" | | 37 | #include "opt_physmem.h" |
38 | #include "opt_splash.h" | | 38 | #include "opt_splash.h" |
39 | #include "opt_kaslr.h" | | 39 | #include "opt_kaslr.h" |
40 | #include "opt_svs.h" | | 40 | #include "opt_svs.h" |
41 | #include "opt_xen.h" | | 41 | #include "opt_xen.h" |
42 | | | 42 | |
43 | #include <sys/types.h> | | 43 | #include <sys/types.h> |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/systm.h> | | 45 | #include <sys/systm.h> |
46 | #include <sys/kcore.h> | | 46 | #include <sys/kcore.h> |
47 | #include <sys/errno.h> | | 47 | #include <sys/errno.h> |
| @@ -90,30 +90,26 @@ __KERNEL_RCSID(0, "$NetBSD: x86_machdep. | | | @@ -90,30 +90,26 @@ __KERNEL_RCSID(0, "$NetBSD: x86_machdep. |
90 | #if defined(MEMORY_DISK_HOOKS) && defined(MEMORY_DISK_DYNAMIC) | | 90 | #if defined(MEMORY_DISK_HOOKS) && defined(MEMORY_DISK_DYNAMIC) |
91 | #include <dev/md.h> | | 91 | #include <dev/md.h> |
92 | #endif | | 92 | #endif |
93 | | | 93 | |
94 | void (*x86_cpu_idle)(void); | | 94 | void (*x86_cpu_idle)(void); |
95 | static bool x86_cpu_idle_ipi; | | 95 | static bool x86_cpu_idle_ipi; |
96 | static char x86_cpu_idle_text[16]; | | 96 | static char x86_cpu_idle_text[16]; |
97 | | | 97 | |
98 | #ifdef XEN | | 98 | #ifdef XEN |
99 | | | 99 | |
100 | #include <xen/xen.h> | | 100 | #include <xen/xen.h> |
101 | #include <xen/hypervisor.h> | | 101 | #include <xen/hypervisor.h> |
102 | #endif | | 102 | #endif |
103 | #ifdef XENPV | | | |
104 | char module_machine_amd64_xen[] = "amd64-xen"; | | | |
105 | char module_machine_i386pae_xen[] = "i386pae-xen"; | | | |
106 | #endif | | | |
107 | | | 103 | |
108 | #ifndef XENPV | | 104 | #ifndef XENPV |
109 | void (*delay_func)(unsigned int) = i8254_delay; | | 105 | void (*delay_func)(unsigned int) = i8254_delay; |
110 | void (*x86_initclock_func)(void) = i8254_initclocks; | | 106 | void (*x86_initclock_func)(void) = i8254_initclocks; |
111 | #else /* XENPV */ | | 107 | #else /* XENPV */ |
112 | void (*delay_func)(unsigned int) = xen_delay; | | 108 | void (*delay_func)(unsigned int) = xen_delay; |
113 | void (*x86_initclock_func)(void) = xen_initclocks; | | 109 | void (*x86_initclock_func)(void) = xen_initclocks; |
114 | #endif | | 110 | #endif |
115 | | | 111 | |
116 | | | 112 | |
117 | /* --------------------------------------------------------------------- */ | | 113 | /* --------------------------------------------------------------------- */ |
118 | | | 114 | |
119 | /* | | 115 | /* |
| @@ -214,35 +210,26 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot | | | @@ -214,35 +210,26 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot |
214 | KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL); | | 210 | KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL); |
215 | } | | 211 | } |
216 | | | 212 | |
217 | #ifdef MODULAR | | 213 | #ifdef MODULAR |
218 | /* | | 214 | /* |
219 | * Push any modules loaded by the boot loader. | | 215 | * Push any modules loaded by the boot loader. |
220 | */ | | 216 | */ |
221 | void | | 217 | void |
222 | module_init_md(void) | | 218 | module_init_md(void) |
223 | { | | 219 | { |
224 | struct btinfo_modulelist *biml; | | 220 | struct btinfo_modulelist *biml; |
225 | struct bi_modulelist_entry *bi, *bimax; | | 221 | struct bi_modulelist_entry *bi, *bimax; |
226 | | | 222 | |
227 | /* setup module path for XEN kernels */ | | | |
228 | #ifdef XENPV | | | |
229 | #ifdef __x86_64__ | | | |
230 | module_machine = module_machine_amd64_xen; | | | |
231 | #else | | | |
232 | module_machine = module_machine_i386pae_xen; | | | |
233 | #endif | | | |
234 | #endif | | | |
235 | | | | |
236 | biml = lookup_bootinfo(BTINFO_MODULELIST); | | 223 | biml = lookup_bootinfo(BTINFO_MODULELIST); |
237 | if (biml == NULL) { | | 224 | if (biml == NULL) { |
238 | aprint_debug("No module info at boot\n"); | | 225 | aprint_debug("No module info at boot\n"); |
239 | return; | | 226 | return; |
240 | } | | 227 | } |
241 | | | 228 | |
242 | bi = (struct bi_modulelist_entry *)((uint8_t *)biml + sizeof(*biml)); | | 229 | bi = (struct bi_modulelist_entry *)((uint8_t *)biml + sizeof(*biml)); |
243 | bimax = bi + biml->num; | | 230 | bimax = bi + biml->num; |
244 | for (; bi < bimax; bi++) { | | 231 | for (; bi < bimax; bi++) { |
245 | switch (bi->type) { | | 232 | switch (bi->type) { |
246 | case BI_MODULE_ELF: | | 233 | case BI_MODULE_ELF: |
247 | aprint_debug("Prep module path=%s len=%d pa=%x\n", | | 234 | aprint_debug("Prep module path=%s len=%d pa=%x\n", |
248 | bi->path, bi->len, bi->base); | | 235 | bi->path, bi->len, bi->base); |