- Rename cpu_lookup_byindex() to cpu_lookup(). The hardware ID isn't of interest to MI code. No functional change. - Change /dev/cpu to operate on cpu index, not hardware ID. Now cpuctl shouldn't print confused output.diff -r1.18 -r1.19 src/sys/arch/amd64/amd64/db_interface.c
(ad)
--- src/sys/arch/amd64/amd64/db_interface.c 2008/05/28 11:45:15 1.18
+++ src/sys/arch/amd64/amd64/db_interface.c 2008/10/15 08:13:17 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: db_interface.c,v 1.18 2008/05/28 11:45:15 ad Exp $ */ | 1 | /* $NetBSD: db_interface.c,v 1.19 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Mach Operating System | 4 | * Mach Operating System | |
5 | * Copyright (c) 1991,1990 Carnegie Mellon University | 5 | * Copyright (c) 1991,1990 Carnegie Mellon University | |
6 | * All Rights Reserved. | 6 | * All Rights Reserved. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify and distribute this software and its | 8 | * Permission to use, copy, modify and distribute this software and its | |
9 | * documentation is hereby granted, provided that both the copyright | 9 | * documentation is hereby granted, provided that both the copyright | |
10 | * notice and this permission notice appear in all copies of the | 10 | * notice and this permission notice appear in all copies of the | |
11 | * software, derivative works or modified versions, and any portions | 11 | * software, derivative works or modified versions, and any portions | |
12 | * thereof, and that both notices appear in supporting documentation. | 12 | * thereof, and that both notices appear in supporting documentation. | |
13 | * | 13 | * | |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
23 | * Pittsburgh PA 15213-3890 | 23 | * Pittsburgh PA 15213-3890 | |
24 | * | 24 | * | |
25 | * any improvements or extensions that they make and grant Carnegie the | 25 | * any improvements or extensions that they make and grant Carnegie the | |
26 | * rights to redistribute these changes. | 26 | * rights to redistribute these changes. | |
27 | * | 27 | * | |
28 | * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) | 28 | * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | /* | 31 | /* | |
32 | * Interface to new debugger. | 32 | * Interface to new debugger. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.18 2008/05/28 11:45:15 ad Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.19 2008/10/15 08:13:17 ad Exp $"); | |
37 | 37 | |||
38 | #include "opt_ddb.h" | 38 | #include "opt_ddb.h" | |
39 | #include "opt_multiprocessor.h" | 39 | #include "opt_multiprocessor.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/proc.h> | 42 | #include <sys/proc.h> | |
43 | #include <sys/reboot.h> | 43 | #include <sys/reboot.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/atomic.h> | 45 | #include <sys/atomic.h> | |
46 | #include <sys/cpu.h> | 46 | #include <sys/cpu.h> | |
47 | 47 | |||
48 | #include <uvm/uvm_extern.h> | 48 | #include <uvm/uvm_extern.h> | |
49 | 49 | |||
@@ -273,27 +273,27 @@ extern void cpu_debug_dump(void); /* XXX | @@ -273,27 +273,27 @@ extern void cpu_debug_dump(void); /* XXX | |||
273 | void | 273 | void | |
274 | db_mach_cpu(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) | 274 | db_mach_cpu(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) | |
275 | { | 275 | { | |
276 | struct cpu_info *ci; | 276 | struct cpu_info *ci; | |
277 | if (!have_addr) { | 277 | if (!have_addr) { | |
278 | cpu_debug_dump(); | 278 | cpu_debug_dump(); | |
279 | return; | 279 | return; | |
280 | } | 280 | } | |
281 | 281 | |||
282 | if (addr < 0) { | 282 | if (addr < 0) { | |
283 | db_printf("%ld: CPU out of range\n", addr); | 283 | db_printf("%ld: CPU out of range\n", addr); | |
284 | return; | 284 | return; | |
285 | } | 285 | } | |
286 | ci = cpu_lookup_byindex(addr); | 286 | ci = cpu_lookup(addr); | |
287 | if (ci == NULL) { | 287 | if (ci == NULL) { | |
288 | db_printf("CPU %ld not configured\n", addr); | 288 | db_printf("CPU %ld not configured\n", addr); | |
289 | return; | 289 | return; | |
290 | } | 290 | } | |
291 | if (ci != curcpu()) { | 291 | if (ci != curcpu()) { | |
292 | if (!(ci->ci_flags & CPUF_PAUSE)) { | 292 | if (!(ci->ci_flags & CPUF_PAUSE)) { | |
293 | db_printf("CPU %ld not paused\n", addr); | 293 | db_printf("CPU %ld not paused\n", addr); | |
294 | return; | 294 | return; | |
295 | } | 295 | } | |
296 | } | 296 | } | |
297 | if (ci->ci_ddb_regs == 0) { | 297 | if (ci->ci_ddb_regs == 0) { | |
298 | db_printf("CPU %ld has no saved regs\n", addr); | 298 | db_printf("CPU %ld has no saved regs\n", addr); | |
299 | return; | 299 | return; |
--- src/sys/arch/i386/i386/db_interface.c 2008/05/28 11:45:15 1.61
+++ src/sys/arch/i386/i386/db_interface.c 2008/10/15 08:13:17 1.62
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: db_interface.c,v 1.61 2008/05/28 11:45:15 ad Exp $ */ | 1 | /* $NetBSD: db_interface.c,v 1.62 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Mach Operating System | 4 | * Mach Operating System | |
5 | * Copyright (c) 1991,1990 Carnegie Mellon University | 5 | * Copyright (c) 1991,1990 Carnegie Mellon University | |
6 | * All Rights Reserved. | 6 | * All Rights Reserved. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify and distribute this software and its | 8 | * Permission to use, copy, modify and distribute this software and its | |
9 | * documentation is hereby granted, provided that both the copyright | 9 | * documentation is hereby granted, provided that both the copyright | |
10 | * notice and this permission notice appear in all copies of the | 10 | * notice and this permission notice appear in all copies of the | |
11 | * software, derivative works or modified versions, and any portions | 11 | * software, derivative works or modified versions, and any portions | |
12 | * thereof, and that both notices appear in supporting documentation. | 12 | * thereof, and that both notices appear in supporting documentation. | |
13 | * | 13 | * | |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
23 | * Pittsburgh PA 15213-3890 | 23 | * Pittsburgh PA 15213-3890 | |
24 | * | 24 | * | |
25 | * any improvements or extensions that they make and grant Carnegie the | 25 | * any improvements or extensions that they make and grant Carnegie the | |
26 | * rights to redistribute these changes. | 26 | * rights to redistribute these changes. | |
27 | * | 27 | * | |
28 | * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) | 28 | * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | /* | 31 | /* | |
32 | * Interface to new debugger. | 32 | * Interface to new debugger. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.61 2008/05/28 11:45:15 ad Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.62 2008/10/15 08:13:17 ad Exp $"); | |
37 | 37 | |||
38 | #include "opt_ddb.h" | 38 | #include "opt_ddb.h" | |
39 | #include "opt_multiprocessor.h" | 39 | #include "opt_multiprocessor.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/proc.h> | 42 | #include <sys/proc.h> | |
43 | #include <sys/reboot.h> | 43 | #include <sys/reboot.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/atomic.h> | 45 | #include <sys/atomic.h> | |
46 | #include <sys/simplelock.h> | 46 | #include <sys/simplelock.h> | |
47 | #include <sys/cpu.h> | 47 | #include <sys/cpu.h> | |
48 | 48 | |||
49 | #include <uvm/uvm_extern.h> | 49 | #include <uvm/uvm_extern.h> | |
@@ -349,27 +349,27 @@ db_mach_cpu( | @@ -349,27 +349,27 @@ db_mach_cpu( | |||
349 | db_expr_t count, | 349 | db_expr_t count, | |
350 | const char * modif) | 350 | const char * modif) | |
351 | { | 351 | { | |
352 | struct cpu_info *ci; | 352 | struct cpu_info *ci; | |
353 | if (!have_addr) { | 353 | if (!have_addr) { | |
354 | cpu_debug_dump(); | 354 | cpu_debug_dump(); | |
355 | return; | 355 | return; | |
356 | } | 356 | } | |
357 | 357 | |||
358 | if (addr < 0) { | 358 | if (addr < 0) { | |
359 | db_printf("%ld: CPU out of range\n", addr); | 359 | db_printf("%ld: CPU out of range\n", addr); | |
360 | return; | 360 | return; | |
361 | } | 361 | } | |
362 | ci = cpu_lookup_byindex(addr); | 362 | ci = cpu_lookup(addr); | |
363 | if (ci == NULL) { | 363 | if (ci == NULL) { | |
364 | db_printf("CPU %ld not configured\n", addr); | 364 | db_printf("CPU %ld not configured\n", addr); | |
365 | return; | 365 | return; | |
366 | } | 366 | } | |
367 | if (ci != curcpu()) { | 367 | if (ci != curcpu()) { | |
368 | if (!(ci->ci_flags & CPUF_PAUSE)) { | 368 | if (!(ci->ci_flags & CPUF_PAUSE)) { | |
369 | db_printf("CPU %ld not paused\n", addr); | 369 | db_printf("CPU %ld not paused\n", addr); | |
370 | return; | 370 | return; | |
371 | } | 371 | } | |
372 | } | 372 | } | |
373 | if (ci->ci_ddb_regs == 0) { | 373 | if (ci->ci_ddb_regs == 0) { | |
374 | db_printf("CPU %ld has no saved regs\n", addr); | 374 | db_printf("CPU %ld has no saved regs\n", addr); | |
375 | return; | 375 | return; |
--- src/sys/arch/x86/x86/cpu.c 2008/06/03 23:05:01 1.56
+++ src/sys/arch/x86/x86/cpu.c 2008/10/15 08:13:17 1.57
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.56 2008/06/03 23:05:01 jmcneill Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.57 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2006, 2007, 2008 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 Bill Sommerfeld of RedBack Networks Inc, and by Andrew Doran. | 8 | * by Bill Sommerfeld of RedBack Networks Inc, and 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. | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 52 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE | 54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE | |
55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
61 | * SUCH DAMAGE. | 61 | * SUCH DAMAGE. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56 2008/06/03 23:05:01 jmcneill Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.57 2008/10/15 08:13:17 ad Exp $"); | |
66 | 66 | |||
67 | #include "opt_ddb.h" | 67 | #include "opt_ddb.h" | |
68 | #include "opt_mpbios.h" /* for MPDEBUG */ | 68 | #include "opt_mpbios.h" /* for MPDEBUG */ | |
69 | #include "opt_mtrr.h" | 69 | #include "opt_mtrr.h" | |
70 | 70 | |||
71 | #include "lapic.h" | 71 | #include "lapic.h" | |
72 | #include "ioapic.h" | 72 | #include "ioapic.h" | |
73 | 73 | |||
74 | #include <sys/param.h> | 74 | #include <sys/param.h> | |
75 | #include <sys/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/user.h> | 76 | #include <sys/user.h> | |
77 | #include <sys/systm.h> | 77 | #include <sys/systm.h> | |
78 | #include <sys/device.h> | 78 | #include <sys/device.h> | |
@@ -501,27 +501,27 @@ cpu_init(struct cpu_info *ci) | @@ -501,27 +501,27 @@ cpu_init(struct cpu_info *ci) | |||
501 | } | 501 | } | |
502 | } | 502 | } | |
503 | 503 | |||
504 | void | 504 | void | |
505 | cpu_boot_secondary_processors(void) | 505 | cpu_boot_secondary_processors(void) | |
506 | { | 506 | { | |
507 | struct cpu_info *ci; | 507 | struct cpu_info *ci; | |
508 | u_long i; | 508 | u_long i; | |
509 | 509 | |||
510 | /* Now that we know the number of CPUs, patch the text segment. */ | 510 | /* Now that we know the number of CPUs, patch the text segment. */ | |
511 | x86_patch(); | 511 | x86_patch(); | |
512 | 512 | |||
513 | for (i=0; i < maxcpus; i++) { | 513 | for (i=0; i < maxcpus; i++) { | |
514 | ci = cpu_lookup_byindex(i); | 514 | ci = cpu_lookup(i); | |
515 | if (ci == NULL) | 515 | if (ci == NULL) | |
516 | continue; | 516 | continue; | |
517 | if (ci->ci_data.cpu_idlelwp == NULL) | 517 | if (ci->ci_data.cpu_idlelwp == NULL) | |
518 | continue; | 518 | continue; | |
519 | if ((ci->ci_flags & CPUF_PRESENT) == 0) | 519 | if ((ci->ci_flags & CPUF_PRESENT) == 0) | |
520 | continue; | 520 | continue; | |
521 | if (ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY)) | 521 | if (ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY)) | |
522 | continue; | 522 | continue; | |
523 | cpu_boot_secondary(ci); | 523 | cpu_boot_secondary(ci); | |
524 | } | 524 | } | |
525 | 525 | |||
526 | x86_mp_online = true; | 526 | x86_mp_online = true; | |
527 | 527 | |||
@@ -538,27 +538,27 @@ cpu_init_idle_lwp(struct cpu_info *ci) | @@ -538,27 +538,27 @@ cpu_init_idle_lwp(struct cpu_info *ci) | |||
538 | struct lwp *l = ci->ci_data.cpu_idlelwp; | 538 | struct lwp *l = ci->ci_data.cpu_idlelwp; | |
539 | struct pcb *pcb = &l->l_addr->u_pcb; | 539 | struct pcb *pcb = &l->l_addr->u_pcb; | |
540 | 540 | |||
541 | pcb->pcb_cr0 = rcr0(); | 541 | pcb->pcb_cr0 = rcr0(); | |
542 | } | 542 | } | |
543 | 543 | |||
544 | void | 544 | void | |
545 | cpu_init_idle_lwps(void) | 545 | cpu_init_idle_lwps(void) | |
546 | { | 546 | { | |
547 | struct cpu_info *ci; | 547 | struct cpu_info *ci; | |
548 | u_long i; | 548 | u_long i; | |
549 | 549 | |||
550 | for (i = 0; i < maxcpus; i++) { | 550 | for (i = 0; i < maxcpus; i++) { | |
551 | ci = cpu_lookup_byindex(i); | 551 | ci = cpu_lookup(i); | |
552 | if (ci == NULL) | 552 | if (ci == NULL) | |
553 | continue; | 553 | continue; | |
554 | if (ci->ci_data.cpu_idlelwp == NULL) | 554 | if (ci->ci_data.cpu_idlelwp == NULL) | |
555 | continue; | 555 | continue; | |
556 | if ((ci->ci_flags & CPUF_PRESENT) == 0) | 556 | if ((ci->ci_flags & CPUF_PRESENT) == 0) | |
557 | continue; | 557 | continue; | |
558 | cpu_init_idle_lwp(ci); | 558 | cpu_init_idle_lwp(ci); | |
559 | } | 559 | } | |
560 | } | 560 | } | |
561 | 561 | |||
562 | void | 562 | void | |
563 | cpu_start_secondary(struct cpu_info *ci) | 563 | cpu_start_secondary(struct cpu_info *ci) | |
564 | { | 564 | { |
--- src/sys/kern/kern_cpu.c 2008/08/28 06:18:26 1.35
+++ src/sys/kern/kern_cpu.c 2008/10/15 08:13:17 1.36
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: kern_cpu.c,v 1.35 2008/08/28 06:18:26 yamt Exp $ */ | 1 | /* $NetBSD: kern_cpu.c,v 1.36 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007, 2008 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. | |
@@ -47,27 +47,27 @@ | @@ -47,27 +47,27 @@ | |||
47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
55 | * SUCH DAMAGE. | 55 | * SUCH DAMAGE. | |
56 | */ | 56 | */ | |
57 | 57 | |||
58 | #include <sys/cdefs.h> | 58 | #include <sys/cdefs.h> | |
59 | 59 | |||
60 | __KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.35 2008/08/28 06:18:26 yamt Exp $"); | 60 | __KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.36 2008/10/15 08:13:17 ad Exp $"); | |
61 | 61 | |||
62 | #include <sys/param.h> | 62 | #include <sys/param.h> | |
63 | #include <sys/systm.h> | 63 | #include <sys/systm.h> | |
64 | #include <sys/idle.h> | 64 | #include <sys/idle.h> | |
65 | #include <sys/sched.h> | 65 | #include <sys/sched.h> | |
66 | #include <sys/intr.h> | 66 | #include <sys/intr.h> | |
67 | #include <sys/conf.h> | 67 | #include <sys/conf.h> | |
68 | #include <sys/cpu.h> | 68 | #include <sys/cpu.h> | |
69 | #include <sys/cpuio.h> | 69 | #include <sys/cpuio.h> | |
70 | #include <sys/proc.h> | 70 | #include <sys/proc.h> | |
71 | #include <sys/percpu.h> | 71 | #include <sys/percpu.h> | |
72 | #include <sys/kernel.h> | 72 | #include <sys/kernel.h> | |
73 | #include <sys/kauth.h> | 73 | #include <sys/kauth.h> | |
@@ -155,43 +155,45 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void | @@ -155,43 +155,45 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void | |||
155 | u_int id; | 155 | u_int id; | |
156 | 156 | |||
157 | error = 0; | 157 | error = 0; | |
158 | 158 | |||
159 | mutex_enter(&cpu_lock); | 159 | mutex_enter(&cpu_lock); | |
160 | switch (cmd) { | 160 | switch (cmd) { | |
161 | case IOC_CPU_SETSTATE: | 161 | case IOC_CPU_SETSTATE: | |
162 | cs = data; | 162 | cs = data; | |
163 | error = kauth_authorize_system(l->l_cred, | 163 | error = kauth_authorize_system(l->l_cred, | |
164 | KAUTH_SYSTEM_CPU, KAUTH_REQ_SYSTEM_CPU_SETSTATE, cs, NULL, | 164 | KAUTH_SYSTEM_CPU, KAUTH_REQ_SYSTEM_CPU_SETSTATE, cs, NULL, | |
165 | NULL); | 165 | NULL); | |
166 | if (error != 0) | 166 | if (error != 0) | |
167 | break; | 167 | break; | |
168 | if ((ci = cpu_lookup(cs->cs_id)) == NULL) { | 168 | if (cs->cs_id >= __arraycount(cpu_infos) || | |
169 | (ci = cpu_lookup(cs->cs_id)) == NULL) { | |||
169 | error = ESRCH; | 170 | error = ESRCH; | |
170 | break; | 171 | break; | |
171 | } | 172 | } | |
172 | if (!cs->cs_intr) { | 173 | if (!cs->cs_intr) { | |
173 | error = EOPNOTSUPP; | 174 | error = EOPNOTSUPP; | |
174 | break; | 175 | break; | |
175 | } | 176 | } | |
176 | error = cpu_setonline(ci, cs->cs_online); | 177 | error = cpu_setonline(ci, cs->cs_online); | |
177 | break; | 178 | break; | |
178 | 179 | |||
179 | case IOC_CPU_GETSTATE: | 180 | case IOC_CPU_GETSTATE: | |
180 | cs = data; | 181 | cs = data; | |
181 | id = cs->cs_id; | 182 | id = cs->cs_id; | |
182 | memset(cs, 0, sizeof(*cs)); | 183 | memset(cs, 0, sizeof(*cs)); | |
183 | cs->cs_id = id; | 184 | cs->cs_id = id; | |
184 | if ((ci = cpu_lookup(id)) == NULL) { | 185 | if (cs->cs_id >= __arraycount(cpu_infos) || | |
186 | (ci = cpu_lookup(id)) == NULL) { | |||
185 | error = ESRCH; | 187 | error = ESRCH; | |
186 | break; | 188 | break; | |
187 | } | 189 | } | |
188 | if ((ci->ci_schedstate.spc_flags & SPCF_OFFLINE) != 0) | 190 | if ((ci->ci_schedstate.spc_flags & SPCF_OFFLINE) != 0) | |
189 | cs->cs_online = false; | 191 | cs->cs_online = false; | |
190 | else | 192 | else | |
191 | cs->cs_online = true; | 193 | cs->cs_online = true; | |
192 | cs->cs_intr = true; | 194 | cs->cs_intr = true; | |
193 | cs->cs_lastmod = ci->ci_schedstate.spc_lastmod; | 195 | cs->cs_lastmod = ci->ci_schedstate.spc_lastmod; | |
194 | break; | 196 | break; | |
195 | 197 | |||
196 | case IOC_CPU_MAPID: | 198 | case IOC_CPU_MAPID: | |
197 | i = 0; | 199 | i = 0; | |
@@ -209,45 +211,31 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void | @@ -209,45 +211,31 @@ cpuctl_ioctl(dev_t dev, u_long cmd, void | |||
209 | *(int *)data = ncpu; | 211 | *(int *)data = ncpu; | |
210 | break; | 212 | break; | |
211 | 213 | |||
212 | default: | 214 | default: | |
213 | error = ENOTTY; | 215 | error = ENOTTY; | |
214 | break; | 216 | break; | |
215 | } | 217 | } | |
216 | mutex_exit(&cpu_lock); | 218 | mutex_exit(&cpu_lock); | |
217 | 219 | |||
218 | return error; | 220 | return error; | |
219 | } | 221 | } | |
220 | 222 | |||
221 | struct cpu_info * | 223 | struct cpu_info * | |
222 | cpu_lookup(cpuid_t id) | 224 | cpu_lookup(u_int idx) | |
223 | { | |||
224 | CPU_INFO_ITERATOR cii; | |||
225 | struct cpu_info *ci; | |||
226 | ||||
227 | for (CPU_INFO_FOREACH(cii, ci)) { | |||
228 | if (ci->ci_cpuid == id) | |||
229 | return ci; | |||
230 | } | |||
231 | ||||
232 | return NULL; | |||
233 | } | |||
234 | ||||
235 | struct cpu_info * | |||
236 | cpu_lookup_byindex(u_int idx) | |||
237 | { | 225 | { | |
238 | struct cpu_info *ci = cpu_infos[idx]; | 226 | struct cpu_info *ci = cpu_infos[idx]; | |
239 | 227 | |||
240 | KASSERT(idx < MAXCPUS); | 228 | KASSERT(idx < __arraycount(cpu_infos)); | |
241 | KASSERT(ci == NULL || cpu_index(ci) == idx); | 229 | KASSERT(ci == NULL || cpu_index(ci) == idx); | |
242 | 230 | |||
243 | return ci; | 231 | return ci; | |
244 | } | 232 | } | |
245 | 233 | |||
246 | static void | 234 | static void | |
247 | cpu_xc_offline(struct cpu_info *ci) | 235 | cpu_xc_offline(struct cpu_info *ci) | |
248 | { | 236 | { | |
249 | struct schedstate_percpu *spc, *mspc = NULL; | 237 | struct schedstate_percpu *spc, *mspc = NULL; | |
250 | struct cpu_info *mci; | 238 | struct cpu_info *mci; | |
251 | struct lwp *l; | 239 | struct lwp *l; | |
252 | CPU_INFO_ITERATOR cii; | 240 | CPU_INFO_ITERATOR cii; | |
253 | int s; | 241 | int s; |
--- src/sys/kern/subr_pool.c 2008/08/11 02:48:42 1.169
+++ src/sys/kern/subr_pool.c 2008/10/15 08:13:17 1.170
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: subr_pool.c,v 1.169 2008/08/11 02:48:42 yamt Exp $ */ | 1 | /* $NetBSD: subr_pool.c,v 1.170 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008 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 Paul Kranenburg; by Jason R. Thorpe of the Numerical Aerospace | 8 | * by Paul Kranenburg; by Jason R. Thorpe of the Numerical Aerospace | |
9 | * Simulation Facility, NASA Ames Research Center, and by Andrew Doran. | 9 | * Simulation Facility, NASA Ames Research Center, and by 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: subr_pool.c,v 1.169 2008/08/11 02:48:42 yamt Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.170 2008/10/15 08:13:17 ad Exp $"); | |
35 | 35 | |||
36 | #include "opt_ddb.h" | 36 | #include "opt_ddb.h" | |
37 | #include "opt_pool.h" | 37 | #include "opt_pool.h" | |
38 | #include "opt_poollog.h" | 38 | #include "opt_poollog.h" | |
39 | #include "opt_lockdebug.h" | 39 | #include "opt_lockdebug.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/bitops.h> | 43 | #include <sys/bitops.h> | |
44 | #include <sys/proc.h> | 44 | #include <sys/proc.h> | |
45 | #include <sys/errno.h> | 45 | #include <sys/errno.h> | |
46 | #include <sys/kernel.h> | 46 | #include <sys/kernel.h> | |
47 | #include <sys/malloc.h> | 47 | #include <sys/malloc.h> | |
@@ -2972,27 +2972,27 @@ found: | @@ -2972,27 +2972,27 @@ found: | |||
2972 | incache = true; | 2972 | incache = true; | |
2973 | goto print; | 2973 | goto print; | |
2974 | } | 2974 | } | |
2975 | } | 2975 | } | |
2976 | for (i = 0; i < MAXCPUS; i++) { | 2976 | for (i = 0; i < MAXCPUS; i++) { | |
2977 | pool_cache_cpu_t *cc; | 2977 | pool_cache_cpu_t *cc; | |
2978 | 2978 | |||
2979 | if ((cc = pc->pc_cpus[i]) == NULL) { | 2979 | if ((cc = pc->pc_cpus[i]) == NULL) { | |
2980 | continue; | 2980 | continue; | |
2981 | } | 2981 | } | |
2982 | if (pool_in_cg(pp, cc->cc_current, addr) || | 2982 | if (pool_in_cg(pp, cc->cc_current, addr) || | |
2983 | pool_in_cg(pp, cc->cc_previous, addr)) { | 2983 | pool_in_cg(pp, cc->cc_previous, addr)) { | |
2984 | struct cpu_info *ci = | 2984 | struct cpu_info *ci = | |
2985 | cpu_lookup_byindex(i); | 2985 | cpu_lookup(i); | |
2986 | 2986 | |||
2987 | incpucache = true; | 2987 | incpucache = true; | |
2988 | snprintf(cpucachestr, | 2988 | snprintf(cpucachestr, | |
2989 | sizeof(cpucachestr), | 2989 | sizeof(cpucachestr), | |
2990 | "cached by CPU %u", | 2990 | "cached by CPU %u", | |
2991 | ci->ci_index); | 2991 | ci->ci_index); | |
2992 | goto print; | 2992 | goto print; | |
2993 | } | 2993 | } | |
2994 | } | 2994 | } | |
2995 | } | 2995 | } | |
2996 | print: | 2996 | print: | |
2997 | item = (uintptr_t)ph->ph_page + ph->ph_off; | 2997 | item = (uintptr_t)ph->ph_page + ph->ph_off; | |
2998 | item = item + rounddown(addr - item, pp->pr_size); | 2998 | item = item + rounddown(addr - item, pp->pr_size); |
--- src/sys/kern/sys_select.c 2008/06/04 13:02:41 1.9
+++ src/sys/kern/sys_select.c 2008/10/15 08:13:17 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sys_select.c,v 1.9 2008/06/04 13:02:41 rmind Exp $ */ | 1 | /* $NetBSD: sys_select.c,v 1.10 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007, 2008 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. | |
@@ -60,27 +60,27 @@ | @@ -60,27 +60,27 @@ | |||
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
63 | * SUCH DAMAGE. | 63 | * SUCH DAMAGE. | |
64 | * | 64 | * | |
65 | * @(#)sys_generic.c 8.9 (Berkeley) 2/14/95 | 65 | * @(#)sys_generic.c 8.9 (Berkeley) 2/14/95 | |
66 | */ | 66 | */ | |
67 | 67 | |||
68 | /* | 68 | /* | |
69 | * System calls relating to files. | 69 | * System calls relating to files. | |
70 | */ | 70 | */ | |
71 | 71 | |||
72 | #include <sys/cdefs.h> | 72 | #include <sys/cdefs.h> | |
73 | __KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.9 2008/06/04 13:02:41 rmind Exp $"); | 73 | __KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.10 2008/10/15 08:13:17 ad Exp $"); | |
74 | 74 | |||
75 | #include <sys/param.h> | 75 | #include <sys/param.h> | |
76 | #include <sys/systm.h> | 76 | #include <sys/systm.h> | |
77 | #include <sys/filedesc.h> | 77 | #include <sys/filedesc.h> | |
78 | #include <sys/ioctl.h> | 78 | #include <sys/ioctl.h> | |
79 | #include <sys/file.h> | 79 | #include <sys/file.h> | |
80 | #include <sys/proc.h> | 80 | #include <sys/proc.h> | |
81 | #include <sys/socketvar.h> | 81 | #include <sys/socketvar.h> | |
82 | #include <sys/signalvar.h> | 82 | #include <sys/signalvar.h> | |
83 | #include <sys/uio.h> | 83 | #include <sys/uio.h> | |
84 | #include <sys/kernel.h> | 84 | #include <sys/kernel.h> | |
85 | #include <sys/stat.h> | 85 | #include <sys/stat.h> | |
86 | #include <sys/poll.h> | 86 | #include <sys/poll.h> | |
@@ -651,27 +651,27 @@ selnotify(struct selinfo *sip, int event | @@ -651,27 +651,27 @@ selnotify(struct selinfo *sip, int event | |||
651 | if (swapin) | 651 | if (swapin) | |
652 | uvm_kick_scheduler(); | 652 | uvm_kick_scheduler(); | |
653 | } | 653 | } | |
654 | 654 | |||
655 | if ((mask = sip->sel_collision) != 0) { | 655 | if ((mask = sip->sel_collision) != 0) { | |
656 | /* | 656 | /* | |
657 | * There was a collision (multiple waiters): we must | 657 | * There was a collision (multiple waiters): we must | |
658 | * inform all potentially interested waiters. | 658 | * inform all potentially interested waiters. | |
659 | */ | 659 | */ | |
660 | sip->sel_collision = 0; | 660 | sip->sel_collision = 0; | |
661 | do { | 661 | do { | |
662 | index = ffs(mask) - 1; | 662 | index = ffs(mask) - 1; | |
663 | mask &= ~(1 << index); | 663 | mask &= ~(1 << index); | |
664 | sc = cpu_lookup_byindex(index)->ci_data.cpu_selcpu; | 664 | sc = cpu_lookup(index)->ci_data.cpu_selcpu; | |
665 | mutex_spin_enter(&sc->sc_lock); | 665 | mutex_spin_enter(&sc->sc_lock); | |
666 | sc->sc_ncoll++; | 666 | sc->sc_ncoll++; | |
667 | sleepq_wake(&sc->sc_sleepq, sc, (u_int)-1, | 667 | sleepq_wake(&sc->sc_sleepq, sc, (u_int)-1, | |
668 | &sc->sc_lock); | 668 | &sc->sc_lock); | |
669 | } while (__predict_false(mask != 0)); | 669 | } while (__predict_false(mask != 0)); | |
670 | } | 670 | } | |
671 | } | 671 | } | |
672 | 672 | |||
673 | /* | 673 | /* | |
674 | * Remove an LWP from all objects that it is waiting for. Concurrency | 674 | * Remove an LWP from all objects that it is waiting for. Concurrency | |
675 | * issues: | 675 | * issues: | |
676 | * | 676 | * | |
677 | * The object owner's (e.g. device driver) lock is not held here. Calls | 677 | * The object owner's (e.g. device driver) lock is not held here. Calls |
--- src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2008/10/02 19:37:23 1.12
+++ src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2008/10/15 08:13:17 1.13
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: misc_stub.c,v 1.12 2008/10/02 19:37:23 pooka Exp $ */ | 1 | /* $NetBSD: misc_stub.c,v 1.13 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by Google Summer of Code. | 6 | * Development of this software was supported by Google Summer of Code. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -60,26 +60,26 @@ preempt() | @@ -60,26 +60,26 @@ preempt() | |||
60 | 60 | |||
61 | /* see yield */ | 61 | /* see yield */ | |
62 | return; | 62 | return; | |
63 | } | 63 | } | |
64 | 64 | |||
65 | void | 65 | void | |
66 | knote(struct klist *list, long hint) | 66 | knote(struct klist *list, long hint) | |
67 | { | 67 | { | |
68 | 68 | |||
69 | return; | 69 | return; | |
70 | } | 70 | } | |
71 | 71 | |||
72 | struct cpu_info * | 72 | struct cpu_info * | |
73 | cpu_lookup_byindex(u_int index) | 73 | cpu_lookup(u_int index) | |
74 | { | 74 | { | |
75 | extern struct cpu_info rump_cpu; | 75 | extern struct cpu_info rump_cpu; | |
76 | 76 | |||
77 | return &rump_cpu; | 77 | return &rump_cpu; | |
78 | } | 78 | } | |
79 | 79 | |||
80 | void | 80 | void | |
81 | evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent, | 81 | evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent, | |
82 | const char *group, const char *name) | 82 | const char *group, const char *name) | |
83 | { | 83 | { | |
84 | 84 | |||
85 | } | 85 | } |
--- src/sys/sys/cpu.h 2008/05/19 17:06:02 1.22
+++ src/sys/sys/cpu.h 2008/10/15 08:13:17 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cpu.h,v 1.22 2008/05/19 17:06:02 ad Exp $ */ | 1 | /* $NetBSD: cpu.h,v 1.23 2008/10/15 08:13:17 ad Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007 YAMAMOTO Takashi, | 4 | * Copyright (c) 2007 YAMAMOTO Takashi, | |
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. | |
@@ -61,28 +61,27 @@ void cpu_need_resched(struct cpu_info *, | @@ -61,28 +61,27 @@ void cpu_need_resched(struct cpu_info *, | |||
61 | #define CPU_INFO_FOREACH(cii, ci) \ | 61 | #define CPU_INFO_FOREACH(cii, ci) \ | |
62 | (void)cii, ci = curcpu(); ci != NULL; ci = NULL | 62 | (void)cii, ci = curcpu(); ci != NULL; ci = NULL | |
63 | #endif | 63 | #endif | |
64 | 64 | |||
65 | #ifndef CPU_IS_PRIMARY | 65 | #ifndef CPU_IS_PRIMARY | |
66 | #define CPU_IS_PRIMARY(ci) ((void)ci, 1) | 66 | #define CPU_IS_PRIMARY(ci) ((void)ci, 1) | |
67 | #endif | 67 | #endif | |
68 | 68 | |||
69 | #ifdef __HAVE_MD_CPU_OFFLINE | 69 | #ifdef __HAVE_MD_CPU_OFFLINE | |
70 | void cpu_offline_md(void); | 70 | void cpu_offline_md(void); | |
71 | #endif | 71 | #endif | |
72 | 72 | |||
73 | lwp_t *cpu_switchto(lwp_t *, lwp_t *, bool); | 73 | lwp_t *cpu_switchto(lwp_t *, lwp_t *, bool); | |
74 | struct cpu_info *cpu_lookup(cpuid_t); | 74 | struct cpu_info *cpu_lookup(u_int); | |
75 | struct cpu_info *cpu_lookup_byindex(u_int); | |||
76 | int cpu_setonline(struct cpu_info *, bool); | 75 | int cpu_setonline(struct cpu_info *, bool); | |
77 | bool cpu_intr_p(void); | 76 | bool cpu_intr_p(void); | |
78 | bool cpu_kpreempt_enter(uintptr_t, int); | 77 | bool cpu_kpreempt_enter(uintptr_t, int); | |
79 | void cpu_kpreempt_exit(uintptr_t); | 78 | void cpu_kpreempt_exit(uintptr_t); | |
80 | bool cpu_kpreempt_disabled(void); | 79 | bool cpu_kpreempt_disabled(void); | |
81 | 80 | |||
82 | CIRCLEQ_HEAD(cpuqueue, cpu_info); | 81 | CIRCLEQ_HEAD(cpuqueue, cpu_info); | |
83 | 82 | |||
84 | extern kmutex_t cpu_lock; | 83 | extern kmutex_t cpu_lock; | |
85 | extern u_int maxcpus; | 84 | extern u_int maxcpus; | |
86 | extern struct cpuqueue cpu_queue; | 85 | extern struct cpuqueue cpu_queue; | |
87 | 86 | |||
88 | static inline u_int | 87 | static inline u_int |