| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: machdep.c,v 1.94 2013/01/18 18:41:12 tsutsui Exp $ */ | | 1 | /* $NetBSD: machdep.c,v 1.95 2013/01/26 15:46:24 tsutsui Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000 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 Tohru Nishimura. | | 8 | * by Tohru Nishimura. |
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. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
33 | | | 33 | |
34 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.94 2013/01/18 18:41:12 tsutsui Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.95 2013/01/26 15:46:24 tsutsui Exp $"); |
35 | | | 35 | |
36 | #include "opt_ddb.h" | | 36 | #include "opt_ddb.h" |
37 | #include "opt_kgdb.h" | | 37 | #include "opt_kgdb.h" |
38 | #include "opt_compat_sunos.h" | | 38 | #include "opt_compat_sunos.h" |
39 | #include "opt_modular.h" | | 39 | #include "opt_modular.h" |
40 | #include "opt_panicbutton.h" | | 40 | #include "opt_panicbutton.h" |
41 | #include "opt_m68k_arch.h" | | 41 | #include "opt_m68k_arch.h" |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/proc.h> | | 46 | #include <sys/proc.h> |
47 | #include <sys/buf.h> | | 47 | #include <sys/buf.h> |
| @@ -89,27 +89,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v | | | @@ -89,27 +89,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v |
89 | #include <machine/db_machdep.h> | | 89 | #include <machine/db_machdep.h> |
90 | #include <ddb/db_sym.h> | | 90 | #include <ddb/db_sym.h> |
91 | #include <ddb/db_extern.h> | | 91 | #include <ddb/db_extern.h> |
92 | #endif | | 92 | #endif |
93 | | | 93 | |
94 | #include "ksyms.h" | | 94 | #include "ksyms.h" |
95 | | | 95 | |
96 | /* | | 96 | /* |
97 | * Info for CTL_HW | | 97 | * Info for CTL_HW |
98 | */ | | 98 | */ |
99 | char machine[] = MACHINE; | | 99 | char machine[] = MACHINE; |
100 | char cpu_model[120]; | | 100 | char cpu_model[120]; |
101 | | | 101 | |
102 | /* Our exported CPU info; we can have only one. */ | | 102 | /* Our exported CPU info; we can have only one. */ |
103 | struct cpu_info cpu_info_store; | | 103 | struct cpu_info cpu_info_store; |
104 | | | 104 | |
105 | struct vm_map *phys_map = NULL; | | 105 | struct vm_map *phys_map = NULL; |
106 | | | 106 | |
107 | int maxmem; /* max memory per process */ | | 107 | int maxmem; /* max memory per process */ |
108 | | | 108 | |
109 | extern u_int lowram; | | 109 | extern u_int lowram; |
110 | | | 110 | |
111 | void luna68k_init(void); | | 111 | void luna68k_init(void); |
112 | void identifycpu(void); | | 112 | void identifycpu(void); |
113 | void dumpsys(void); | | 113 | void dumpsys(void); |
114 | | | 114 | |
115 | void straytrap(int, u_short); | | 115 | void straytrap(int, u_short); |
| @@ -467,27 +467,27 @@ haltsys: | | | @@ -467,27 +467,27 @@ haltsys: |
467 | for (;;) | | 467 | for (;;) |
468 | ; | | 468 | ; |
469 | } | | 469 | } |
470 | | | 470 | |
471 | /* | | 471 | /* |
472 | * Initialize the kernel crash dump header. | | 472 | * Initialize the kernel crash dump header. |
473 | */ | | 473 | */ |
474 | void | | 474 | void |
475 | cpu_init_kcore_hdr(void) | | 475 | cpu_init_kcore_hdr(void) |
476 | { | | 476 | { |
477 | cpu_kcore_hdr_t *h = &cpu_kcore_hdr; | | 477 | cpu_kcore_hdr_t *h = &cpu_kcore_hdr; |
478 | struct m68k_kcore_hdr *m = &h->un._m68k; | | 478 | struct m68k_kcore_hdr *m = &h->un._m68k; |
479 | | | 479 | |
480 | memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr)); | | 480 | memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr)); |
481 | | | 481 | |
482 | /* | | 482 | /* |
483 | * Initialize the `dispatcher' portion of the header. | | 483 | * Initialize the `dispatcher' portion of the header. |
484 | */ | | 484 | */ |
485 | strcpy(h->name, machine); | | 485 | strcpy(h->name, machine); |
486 | h->page_size = PAGE_SIZE; | | 486 | h->page_size = PAGE_SIZE; |
487 | h->kernbase = KERNBASE; | | 487 | h->kernbase = KERNBASE; |
488 | | | 488 | |
489 | /* | | 489 | /* |
490 | * Fill in information about our MMU configuration. | | 490 | * Fill in information about our MMU configuration. |
491 | */ | | 491 | */ |
492 | m->mmutype = mmutype; | | 492 | m->mmutype = mmutype; |
493 | m->sg_v = SG_V; | | 493 | m->sg_v = SG_V; |
| @@ -542,27 +542,27 @@ cpu_init_kcore_hdr(void) | | | @@ -542,27 +542,27 @@ cpu_init_kcore_hdr(void) |
542 | int | | 542 | int |
543 | cpu_dumpsize(void) | | 543 | cpu_dumpsize(void) |
544 | { | | 544 | { |
545 | | | 545 | |
546 | return btodb(MDHDRSIZE); | | 546 | return btodb(MDHDRSIZE); |
547 | } | | 547 | } |
548 | | | 548 | |
549 | /* | | 549 | /* |
550 | * Called by dumpsys() to dump the machine-dependent header. | | 550 | * Called by dumpsys() to dump the machine-dependent header. |
551 | */ | | 551 | */ |
552 | int | | 552 | int |
553 | cpu_dump(int (*dump)(dev_t, daddr_t, void *, size_t), daddr_t *blknop) | | 553 | cpu_dump(int (*dump)(dev_t, daddr_t, void *, size_t), daddr_t *blknop) |
554 | { | | 554 | { |
555 | int buf[MDHDRSIZE / sizeof(int)]; | | 555 | int buf[MDHDRSIZE / sizeof(int)]; |
556 | cpu_kcore_hdr_t *chdr; | | 556 | cpu_kcore_hdr_t *chdr; |
557 | kcore_seg_t *kseg; | | 557 | kcore_seg_t *kseg; |
558 | int error; | | 558 | int error; |
559 | | | 559 | |
560 | kseg = (kcore_seg_t *)buf; | | 560 | kseg = (kcore_seg_t *)buf; |
561 | chdr = (cpu_kcore_hdr_t *)&buf[ALIGN(sizeof(kcore_seg_t)) / | | 561 | chdr = (cpu_kcore_hdr_t *)&buf[ALIGN(sizeof(kcore_seg_t)) / |
562 | sizeof(int)]; | | 562 | sizeof(int)]; |
563 | | | 563 | |
564 | /* Create the segment header. */ | | 564 | /* Create the segment header. */ |
565 | CORE_SETMAGIC(*kseg, KCORE_MAGIC, MID_MACHINE, CORE_CPU); | | 565 | CORE_SETMAGIC(*kseg, KCORE_MAGIC, MID_MACHINE, CORE_CPU); |
566 | kseg->c_size = MDHDRSIZE - ALIGN(sizeof(kcore_seg_t)); | | 566 | kseg->c_size = MDHDRSIZE - ALIGN(sizeof(kcore_seg_t)); |
567 | | | 567 | |
568 | memcpy(chdr, &cpu_kcore_hdr, sizeof(cpu_kcore_hdr_t)); | | 568 | memcpy(chdr, &cpu_kcore_hdr, sizeof(cpu_kcore_hdr_t)); |
| @@ -791,27 +791,27 @@ luna68k_abort(const char *cp) | | | @@ -791,27 +791,27 @@ luna68k_abort(const char *cp) |
791 | cpu_Debugger(); | | 791 | cpu_Debugger(); |
792 | #else | | 792 | #else |
793 | #ifdef PANICBUTTON | | 793 | #ifdef PANICBUTTON |
794 | panic(cp); | | 794 | panic(cp); |
795 | #else | | 795 | #else |
796 | printf("%s ignored\n", cp); | | 796 | printf("%s ignored\n", cp); |
797 | #endif /* PANICBUTTON */ | | 797 | #endif /* PANICBUTTON */ |
798 | #endif /* DDB */ | | 798 | #endif /* DDB */ |
799 | } | | 799 | } |
800 | | | 800 | |
801 | /* | | 801 | /* |
802 | * cpu_exec_aout_makecmds(): | | 802 | * cpu_exec_aout_makecmds(): |
803 | * CPU-dependent a.out format hook for execve(). | | 803 | * CPU-dependent a.out format hook for execve(). |
804 | * | | 804 | * |
805 | * Determine of the given exec package refers to something which we | | 805 | * Determine of the given exec package refers to something which we |
806 | * understand and, if so, set up the vmcmds for it. | | 806 | * understand and, if so, set up the vmcmds for it. |
807 | */ | | 807 | */ |
808 | int | | 808 | int |
809 | cpu_exec_aout_makecmds(struct lwp *l, struct exec_package *epp) | | 809 | cpu_exec_aout_makecmds(struct lwp *l, struct exec_package *epp) |
810 | { | | 810 | { |
811 | int error = ENOEXEC; | | 811 | int error = ENOEXEC; |
812 | #ifdef COMPAT_SUNOS | | 812 | #ifdef COMPAT_SUNOS |
813 | extern sunos_exec_aout_makecmds(struct proc *, struct exec_package *); | | 813 | extern sunos_exec_aout_makecmds(struct proc *, struct exec_package *); |
814 | | | 814 | |
815 | if ((error = sunos_exec_aout_makecmds(l->l_proc, epp)) == 0) | | 815 | if ((error = sunos_exec_aout_makecmds(l->l_proc, epp)) == 0) |
816 | return 0; | | 816 | return 0; |
817 | #endif | | 817 | #endif |