| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_trace.c,v 1.58 2018/02/28 20:11:09 mrg Exp $ */ | | 1 | /* $NetBSD: db_trace.c,v 1.59 2020/07/06 08:30:10 rin Exp $ */ |
2 | /* $OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $ */ | | 2 | /* $OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Mach Operating System | | 5 | * Mach Operating System |
6 | * Copyright (c) 1992 Carnegie Mellon University | | 6 | * Copyright (c) 1992 Carnegie Mellon University |
7 | * All Rights Reserved. | | 7 | * All Rights Reserved. |
8 | * | | 8 | * |
9 | * Permission to use, copy, modify and distribute this software and its | | 9 | * Permission to use, copy, modify and distribute this software and its |
10 | * documentation is hereby granted, provided that both the copyright | | 10 | * documentation is hereby granted, provided that both the copyright |
11 | * notice and this permission notice appear in all copies of the | | 11 | * notice and this permission notice appear in all copies of the |
12 | * software, derivative works or modified versions, and any portions | | 12 | * software, derivative works or modified versions, and any portions |
13 | * thereof, and that both notices appear in supporting documentation. | | 13 | * thereof, and that both notices appear in supporting documentation. |
14 | * | | 14 | * |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * | | 18 | * |
19 | * Carnegie Mellon requests users of this software to return to | | 19 | * Carnegie Mellon requests users of this software to return to |
20 | * | | 20 | * |
21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | | 21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
22 | * School of Computer Science | | 22 | * School of Computer Science |
23 | * Carnegie Mellon University | | 23 | * Carnegie Mellon University |
24 | * Pittsburgh PA 15213-3890 | | 24 | * Pittsburgh PA 15213-3890 |
25 | * | | 25 | * |
26 | * any improvements or extensions that they make and grant Carnegie Mellon | | 26 | * any improvements or extensions that they make and grant Carnegie Mellon |
27 | * the rights to redistribute these changes. | | 27 | * the rights to redistribute these changes. |
28 | */ | | 28 | */ |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.58 2018/02/28 20:11:09 mrg Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.59 2020/07/06 08:30:10 rin Exp $"); |
32 | | | 32 | |
33 | #include "opt_ppcarch.h" | | 33 | #include "opt_ppcarch.h" |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/proc.h> | | 36 | #include <sys/proc.h> |
37 | #include <sys/kernel.h> | | 37 | #include <sys/kernel.h> |
38 | | | 38 | |
39 | #include <uvm/uvm_extern.h> | | 39 | #include <uvm/uvm_extern.h> |
40 | | | 40 | |
41 | #include <machine/db_machdep.h> | | 41 | #include <machine/db_machdep.h> |
42 | #include <machine/pmap.h> | | 42 | #include <machine/pmap.h> |
43 | | | 43 | |
44 | #include <powerpc/pcb.h> | | 44 | #include <powerpc/pcb.h> |
| @@ -203,27 +203,29 @@ db_stack_trace_print(db_expr_t addr, boo | | | @@ -203,27 +203,29 @@ db_stack_trace_print(db_expr_t addr, boo |
203 | (*pr)("%s ", tf->tf_srr1 & PSL_PR ? "user" : "kernel"); | | 203 | (*pr)("%s ", tf->tf_srr1 & PSL_PR ? "user" : "kernel"); |
204 | if (lr + 4 == (db_addr_t) sctrapexit) { | | 204 | if (lr + 4 == (db_addr_t) sctrapexit) { |
205 | (*pr)("SC trap #%d by ", tf->tf_fixreg[0]); | | 205 | (*pr)("SC trap #%d by ", tf->tf_fixreg[0]); |
206 | goto print_trap; | | 206 | goto print_trap; |
207 | } | | 207 | } |
208 | switch (tf->tf_exc) { | | 208 | switch (tf->tf_exc) { |
209 | case EXC_DSI: | | 209 | case EXC_DSI: |
210 | #ifdef PPC_OEA | | 210 | #ifdef PPC_OEA |
211 | (*pr)("DSI %s trap @ %#x by ", | | 211 | (*pr)("DSI %s trap @ %#x by ", |
212 | tf->tf_dsisr & DSISR_STORE ? "write" : "read", | | 212 | tf->tf_dsisr & DSISR_STORE ? "write" : "read", |
213 | tf->tf_dar); | | 213 | tf->tf_dar); |
214 | #endif | | 214 | #endif |
215 | #ifdef PPC_IBM4XX | | 215 | #ifdef PPC_IBM4XX |
216 | (*pr)("DSI %s trap @ %#x by ", | | 216 | trapstr = "DSI"; |
| | | 217 | dsi: |
| | | 218 | (*pr)("%s %s trap @ %#x by ", trapstr, |
217 | tf->tf_esr & ESR_DST ? "write" : "read", | | 219 | tf->tf_esr & ESR_DST ? "write" : "read", |
218 | tf->tf_dear); | | 220 | tf->tf_dear); |
219 | #endif | | 221 | #endif |
220 | goto print_trap; | | 222 | goto print_trap; |
221 | case EXC_ALI: | | 223 | case EXC_ALI: |
222 | #ifdef PPC_OEA | | 224 | #ifdef PPC_OEA |
223 | (*pr)("ALI trap @ %#x (DSISR %#x) ", | | 225 | (*pr)("ALI trap @ %#x (DSISR %#x) ", |
224 | tf->tf_dar, tf->tf_dsisr); | | 226 | tf->tf_dar, tf->tf_dsisr); |
225 | goto print_trap; | | 227 | goto print_trap; |
226 | #else | | 228 | #else |
227 | trapstr = "ALI"; break; | | 229 | trapstr = "ALI"; break; |
228 | #endif | | 230 | #endif |
229 | case EXC_ISI: trapstr = "ISI"; break; | | 231 | case EXC_ISI: trapstr = "ISI"; break; |
| @@ -231,27 +233,31 @@ db_stack_trace_print(db_expr_t addr, boo | | | @@ -231,27 +233,31 @@ db_stack_trace_print(db_expr_t addr, boo |
231 | case EXC_SC: trapstr = "SC"; break; | | 233 | case EXC_SC: trapstr = "SC"; break; |
232 | case EXC_EXI: trapstr = "EXI"; break; | | 234 | case EXC_EXI: trapstr = "EXI"; break; |
233 | case EXC_MCHK: trapstr = "MCHK"; break; | | 235 | case EXC_MCHK: trapstr = "MCHK"; break; |
234 | case EXC_VEC: trapstr = "VEC"; break; | | 236 | case EXC_VEC: trapstr = "VEC"; break; |
235 | case EXC_FPU: trapstr = "FPU"; break; | | 237 | case EXC_FPU: trapstr = "FPU"; break; |
236 | case EXC_FPA: trapstr = "FPA"; break; | | 238 | case EXC_FPA: trapstr = "FPA"; break; |
237 | case EXC_DECR: trapstr = "DECR"; break; | | 239 | case EXC_DECR: trapstr = "DECR"; break; |
238 | case EXC_BPT: trapstr = "BPT"; break; | | 240 | case EXC_BPT: trapstr = "BPT"; break; |
239 | case EXC_TRC: trapstr = "TRC"; break; | | 241 | case EXC_TRC: trapstr = "TRC"; break; |
240 | case EXC_RUNMODETRC: trapstr = "RUNMODETRC"; break; | | 242 | case EXC_RUNMODETRC: trapstr = "RUNMODETRC"; break; |
241 | case EXC_PERF: trapstr = "PERF"; break; | | 243 | case EXC_PERF: trapstr = "PERF"; break; |
242 | case EXC_SMI: trapstr = "SMI"; break; | | 244 | case EXC_SMI: trapstr = "SMI"; break; |
243 | case EXC_RST: trapstr = "RST"; break; | | 245 | case EXC_RST: trapstr = "RST"; break; |
244 | case EXC_DTMISS: trapstr = "DTMISS"; break; | | 246 | case EXC_DTMISS: trapstr = "DTMISS"; |
| | | 247 | #ifdef PPC_IBM4XX |
| | | 248 | goto dsi; |
| | | 249 | #endif |
| | | 250 | break; |
245 | case EXC_ITMISS: trapstr = "ITMISS"; break; | | 251 | case EXC_ITMISS: trapstr = "ITMISS"; break; |
246 | case EXC_FIT: trapstr = "FIT"; break; | | 252 | case EXC_FIT: trapstr = "FIT"; break; |
247 | case EXC_PIT: trapstr = "PIT"; break; | | 253 | case EXC_PIT: trapstr = "PIT"; break; |
248 | case EXC_WDOG: trapstr = "WDOG"; break; | | 254 | case EXC_WDOG: trapstr = "WDOG"; break; |
249 | default: trapstr = NULL; break; | | 255 | default: trapstr = NULL; break; |
250 | } | | 256 | } |
251 | if (trapstr != NULL) { | | 257 | if (trapstr != NULL) { |
252 | (*pr)("%s trap by ", trapstr); | | 258 | (*pr)("%s trap by ", trapstr); |
253 | } else { | | 259 | } else { |
254 | (*pr)("trap %#x by ", tf->tf_exc); | | 260 | (*pr)("trap %#x by ", tf->tf_exc); |
255 | } | | 261 | } |
256 | print_trap: | | 262 | print_trap: |
257 | lr = (db_addr_t) tf->tf_srr0; | | 263 | lr = (db_addr_t) tf->tf_srr0; |
| @@ -268,27 +274,28 @@ db_stack_trace_print(db_expr_t addr, boo | | | @@ -268,27 +274,28 @@ db_stack_trace_print(db_expr_t addr, boo |
268 | diff, tf->tf_srr1); | | 274 | diff, tf->tf_srr1); |
269 | } | | 275 | } |
270 | (*pr)("%-10s r1=%#x cr=%#x xer=%#x ctr=%#x", | | 276 | (*pr)("%-10s r1=%#x cr=%#x xer=%#x ctr=%#x", |
271 | "", tf->tf_fixreg[1], tf->tf_cr, tf->tf_xer, tf->tf_ctr); | | 277 | "", tf->tf_fixreg[1], tf->tf_cr, tf->tf_xer, tf->tf_ctr); |
272 | #ifdef PPC_OEA | | 278 | #ifdef PPC_OEA |
273 | if (tf->tf_exc == EXC_DSI) | | 279 | if (tf->tf_exc == EXC_DSI) |
274 | (*pr)(" dsisr=%#x", tf->tf_dsisr); | | 280 | (*pr)(" dsisr=%#x", tf->tf_dsisr); |
275 | #ifdef PPC_OEA601 | | 281 | #ifdef PPC_OEA601 |
276 | if ((mfpvr() >> 16) == MPC601) | | 282 | if ((mfpvr() >> 16) == MPC601) |
277 | (*pr)(" mq=%#x", tf->tf_mq); | | 283 | (*pr)(" mq=%#x", tf->tf_mq); |
278 | #endif /* PPC_OEA601 */ | | 284 | #endif /* PPC_OEA601 */ |
279 | #endif /* PPC_OEA */ | | 285 | #endif /* PPC_OEA */ |
280 | #ifdef PPC_IBM4XX | | 286 | #ifdef PPC_IBM4XX |
281 | if (tf->tf_exc == EXC_DSI) | | 287 | if (tf->tf_exc == EXC_DSI || |
| | | 288 | tf->tf_exc == EXC_DTMISS) |
282 | (*pr)(" dear=%#x", tf->tf_dear); | | 289 | (*pr)(" dear=%#x", tf->tf_dear); |
283 | (*pr)(" esr=%#x pid=%#x", tf->tf_esr, tf->tf_pid); | | 290 | (*pr)(" esr=%#x pid=%#x", tf->tf_esr, tf->tf_pid); |
284 | #endif | | 291 | #endif |
285 | (*pr)("\n"); | | 292 | (*pr)("\n"); |
286 | frame = (db_addr_t) tf->tf_fixreg[1]; | | 293 | frame = (db_addr_t) tf->tf_fixreg[1]; |
287 | in_kernel = !(tf->tf_srr1 & PSL_PR); | | 294 | in_kernel = !(tf->tf_srr1 & PSL_PR); |
288 | if (kernel_only && !in_kernel) | | 295 | if (kernel_only && !in_kernel) |
289 | break; | | 296 | break; |
290 | goto next_frame; | | 297 | goto next_frame; |
291 | } | | 298 | } |
292 | | | 299 | |
293 | diff = 0; | | 300 | diff = 0; |
294 | symname = NULL; | | 301 | symname = NULL; |