Fri Sep 21 22:12:36 2012 UTC ()
Add a 'mach fault' command to print DFAR/DFSR/IFAR/IFSR/TTBR


(matt)
diff -r1.14 -r1.15 src/sys/arch/arm/arm32/db_machdep.c
diff -r1.5 -r1.6 src/sys/arch/arm/include/arm32/db_machdep.h

cvs diff -r1.14 -r1.15 src/sys/arch/arm/arm32/db_machdep.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm32/db_machdep.c 2012/08/31 11:52:39 1.14
+++ src/sys/arch/arm/arm32/db_machdep.c 2012/09/21 22:12:35 1.15
@@ -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
83const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); 83const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
84 84
85const struct db_command db_machine_command_table[] = { 85const 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
102int 105int
103db_access_und_sp(const struct db_variable *vp, db_expr_t *valp, int rw) 106db_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
129void 132void
130db_show_panic_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) 133db_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
 142void
 143db_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
141void 153void
142db_show_frame_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) 154db_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

cvs diff -r1.5 -r1.6 src/sys/arch/arm/include/arm32/db_machdep.h (expand / switch to unified diff)

--- src/sys/arch/arm/include/arm32/db_machdep.h 2009/03/14 14:45:55 1.5
+++ src/sys/arch/arm/include/arm32/db_machdep.h 2012/09/21 22:12:36 1.6
@@ -1,11 +1,12 @@ @@ -1,11 +1,12 @@
1/* $NetBSD: db_machdep.h,v 1.5 2009/03/14 14:45:55 dsl Exp $ */ 1/* $NetBSD: db_machdep.h,v 1.6 2012/09/21 22:12:36 matt Exp $ */
2 2
3#ifndef _ARM32_DB_MACHDEP_H_ 3#ifndef _ARM32_DB_MACHDEP_H_
4#define _ARM32_DB_MACHDEP_H_ 4#define _ARM32_DB_MACHDEP_H_
5 5
6#include <arm/db_machdep.h> 6#include <arm/db_machdep.h>
7 7
8void db_show_panic_cmd(db_expr_t, bool, db_expr_t, const char *); 8void db_show_panic_cmd(db_expr_t, bool, db_expr_t, const char *);
9void db_show_frame_cmd(db_expr_t, bool, db_expr_t, const char *); 9void db_show_frame_cmd(db_expr_t, bool, db_expr_t, const char *);
 10void db_show_fault_cmd(db_expr_t, bool, db_expr_t, const char *);
10 11
11#endif 12#endif