| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $ */ | | 1 | /* $NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> | | 4 | * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -16,52 +16,52 @@ | | | @@ -16,52 +16,52 @@ |
16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
| | | 29 | #include "opt_cpu.h" |
| | | 30 | |
29 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18 2011/08/27 21:15:07 reinoud Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.19 2011/08/27 21:43:06 jmcneill Exp $"); |
31 | | | 33 | |
32 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
33 | #include <sys/conf.h> | | 35 | #include <sys/conf.h> |
34 | #include <sys/proc.h> | | 36 | #include <sys/proc.h> |
35 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
36 | #include <sys/device.h> | | 38 | #include <sys/device.h> |
37 | #include <sys/reboot.h> | | 39 | #include <sys/reboot.h> |
38 | #include <sys/lwp.h> | | 40 | #include <sys/lwp.h> |
39 | #include <sys/cpu.h> | | 41 | #include <sys/cpu.h> |
40 | #include <sys/mbuf.h> | | 42 | #include <sys/mbuf.h> |
41 | #include <sys/msgbuf.h> | | 43 | #include <sys/msgbuf.h> |
42 | | | 44 | |
43 | #include <dev/cons.h> | | 45 | #include <dev/cons.h> |
44 | | | 46 | |
45 | #include <machine/cpu.h> | | 47 | #include <machine/cpu.h> |
46 | #include <machine/mainbus.h> | | 48 | #include <machine/mainbus.h> |
47 | #include <machine/pcb.h> | | 49 | #include <machine/pcb.h> |
48 | #include <machine/thunk.h> | | 50 | #include <machine/thunk.h> |
49 | | | 51 | |
50 | #include <uvm/uvm_extern.h> | | 52 | #include <uvm/uvm_extern.h> |
51 | #include <uvm/uvm_page.h> | | 53 | #include <uvm/uvm_page.h> |
52 | | | 54 | |
53 | #define CPU_DEBUG | | | |
54 | | | | |
55 | static int cpu_match(device_t, cfdata_t, void *); | | 55 | static int cpu_match(device_t, cfdata_t, void *); |
56 | static void cpu_attach(device_t, device_t, void *); | | 56 | static void cpu_attach(device_t, device_t, void *); |
57 | | | 57 | |
58 | struct cpu_info cpu_info_primary = { | | 58 | struct cpu_info cpu_info_primary = { |
59 | .ci_dev = 0, | | 59 | .ci_dev = 0, |
60 | .ci_self = &cpu_info_primary, | | 60 | .ci_self = &cpu_info_primary, |
61 | .ci_idepth = -1, | | 61 | .ci_idepth = -1, |
62 | .ci_curlwp = &lwp0, | | 62 | .ci_curlwp = &lwp0, |
63 | }; | | 63 | }; |
64 | | | 64 | |
65 | char cpu_model[48] = "virtual processor"; | | 65 | char cpu_model[48] = "virtual processor"; |
66 | | | 66 | |
67 | typedef struct cpu_softc { | | 67 | typedef struct cpu_softc { |