| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_machdep.c,v 1.14 2012/08/31 11:52:39 skrll Exp $ */ | | 1 | /* $NetBSD: db_machdep.c,v 1.15 2012/09/21 22:12:35 matt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996 Mark Brinicombe | | 4 | * Copyright (c) 1996 Mark Brinicombe |
5 | * | | 5 | * |
6 | * Mach Operating System | | 6 | * Mach Operating System |
7 | * Copyright (c) 1991,1990 Carnegie Mellon University | | 7 | * Copyright (c) 1991,1990 Carnegie Mellon University |
8 | * All Rights Reserved. | | 8 | * All Rights Reserved. |
9 | * | | 9 | * |
10 | * Permission to use, copy, modify and distribute this software and its | | 10 | * Permission to use, copy, modify and distribute this software and its |
11 | * documentation is hereby granted, provided that both the copyright | | 11 | * documentation is hereby granted, provided that both the copyright |
12 | * notice and this permission notice appear in all copies of the | | 12 | * notice and this permission notice appear in all copies of the |
13 | * software, derivative works or modified versions, and any portions | | 13 | * software, derivative works or modified versions, and any portions |
14 | * thereof, and that both notices appear in supporting documentation. | | 14 | * thereof, and that both notices appear in supporting documentation. |
| @@ -19,27 +19,27 @@ | | | @@ -19,27 +19,27 @@ |
19 | * | | 19 | * |
20 | * Carnegie Mellon requests users of this software to return to | | 20 | * Carnegie Mellon requests users of this software to return to |
21 | * | | 21 | * |
22 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | | 22 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
23 | * School of Computer Science | | 23 | * School of Computer Science |
24 | * Carnegie Mellon University | | 24 | * Carnegie Mellon University |
25 | * Pittsburgh PA 15213-3890 | | 25 | * Pittsburgh PA 15213-3890 |
26 | * | | 26 | * |
27 | * any improvements or extensions that they make and grant Carnegie the | | 27 | * any improvements or extensions that they make and grant Carnegie the |
28 | * rights to redistribute these changes. | | 28 | * rights to redistribute these changes. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | __KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.14 2012/08/31 11:52:39 skrll Exp $"); | | 32 | __KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.15 2012/09/21 22:12:35 matt Exp $"); |
33 | | | 33 | |
34 | #include <sys/param.h> | | 34 | #include <sys/param.h> |
35 | #include <sys/proc.h> | | 35 | #include <sys/proc.h> |
36 | #include <sys/vnode.h> | | 36 | #include <sys/vnode.h> |
37 | #include <sys/systm.h> | | 37 | #include <sys/systm.h> |
38 | | | 38 | |
39 | #include <arm/arm32/db_machdep.h> | | 39 | #include <arm/arm32/db_machdep.h> |
40 | #include <arm/cpufunc.h> | | 40 | #include <arm/cpufunc.h> |
41 | | | 41 | |
42 | #include <ddb/db_access.h> | | 42 | #include <ddb/db_access.h> |
43 | #include <ddb/db_sym.h> | | 43 | #include <ddb/db_sym.h> |
44 | #include <ddb/db_output.h> | | 44 | #include <ddb/db_output.h> |
45 | #include <ddb/db_variables.h> | | 45 | #include <ddb/db_variables.h> |
| @@ -81,26 +81,29 @@ const struct db_variable db_regs[] = { | | | @@ -81,26 +81,29 @@ const struct db_variable db_regs[] = { |
81 | }; | | 81 | }; |
82 | | | 82 | |
83 | const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); | | 83 | const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); |
84 | | | 84 | |
85 | const struct db_command db_machine_command_table[] = { | | 85 | const struct db_command db_machine_command_table[] = { |
86 | { DDB_ADD_CMD("frame", db_show_frame_cmd, 0, | | 86 | { DDB_ADD_CMD("frame", db_show_frame_cmd, 0, |
87 | "Displays the contents of a trapframe", | | 87 | "Displays the contents of a trapframe", |
88 | "[address]", | | 88 | "[address]", |
89 | " address:\taddress of trapfame to display")}, | | 89 | " address:\taddress of trapfame to display")}, |
90 | #ifdef _KERNEL | | 90 | #ifdef _KERNEL |
91 | { DDB_ADD_CMD("panic", db_show_panic_cmd, 0, | | 91 | { DDB_ADD_CMD("panic", db_show_panic_cmd, 0, |
92 | "Displays the last panic string", | | 92 | "Displays the last panic string", |
93 | NULL,NULL) }, | | 93 | NULL,NULL) }, |
| | | 94 | { DDB_ADD_CMD("fault", db_show_fault_cmd, 0, |
| | | 95 | "Displays the fault registers", |
| | | 96 | NULL,NULL) }, |
94 | #endif | | 97 | #endif |
95 | #ifdef ARM32_DB_COMMANDS | | 98 | #ifdef ARM32_DB_COMMANDS |
96 | ARM32_DB_COMMANDS, | | 99 | ARM32_DB_COMMANDS, |
97 | #endif | | 100 | #endif |
98 | { DDB_ADD_CMD(NULL, NULL, 0,NULL,NULL,NULL) } | | 101 | { DDB_ADD_CMD(NULL, NULL, 0,NULL,NULL,NULL) } |
99 | }; | | 102 | }; |
100 | | | 103 | |
101 | #ifdef _KERNEL | | 104 | #ifdef _KERNEL |
102 | int | | 105 | int |
103 | db_access_und_sp(const struct db_variable *vp, db_expr_t *valp, int rw) | | 106 | db_access_und_sp(const struct db_variable *vp, db_expr_t *valp, int rw) |
104 | { | | 107 | { |
105 | | | 108 | |
106 | if (rw == DB_VAR_GET) | | 109 | if (rw == DB_VAR_GET) |
| @@ -125,26 +128,35 @@ db_access_irq_sp(const struct db_variabl | | | @@ -125,26 +128,35 @@ db_access_irq_sp(const struct db_variabl |
125 | *valp = get_stackptr(PSR_IRQ32_MODE); | | 128 | *valp = get_stackptr(PSR_IRQ32_MODE); |
126 | return(0); | | 129 | return(0); |
127 | } | | 130 | } |
128 | | | 131 | |
129 | void | | 132 | void |
130 | db_show_panic_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) | | 133 | db_show_panic_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) |
131 | { | | 134 | { |
132 | int s; | | 135 | int s; |
133 | s = splhigh(); | | 136 | s = splhigh(); |
134 | | | 137 | |
135 | db_printf("Panic string: %s\n", panicstr); | | 138 | db_printf("Panic string: %s\n", panicstr); |
136 | (void)splx(s); | | 139 | (void)splx(s); |
137 | } | | 140 | } |
| | | 141 | |
| | | 142 | void |
| | | 143 | db_show_fault_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) |
| | | 144 | { |
| | | 145 | db_printf("DFAR=%#x DFSR=%#x IFAR=%#x IFSR=%#x TTBR=%#x\n", |
| | | 146 | armreg_dfar_read(), armreg_dfsr_read(), |
| | | 147 | armreg_ifar_read(), armreg_ifsr_read(), |
| | | 148 | armreg_ttbr_read()); |
| | | 149 | } |
138 | #endif | | 150 | #endif |
139 | | | 151 | |
140 | | | 152 | |
141 | void | | 153 | void |
142 | db_show_frame_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) | | 154 | db_show_frame_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) |
143 | { | | 155 | { |
144 | struct trapframe *frame; | | 156 | struct trapframe *frame; |
145 | | | 157 | |
146 | if (!have_addr) { | | 158 | if (!have_addr) { |
147 | db_printf("frame address must be specified\n"); | | 159 | db_printf("frame address must be specified\n"); |
148 | return; | | 160 | return; |
149 | } | | 161 | } |
150 | | | 162 | |