Subject: port-sparc64/11580: ddb's show registers causes unaligned memory access
To: None <gnats-bugs@gnats.netbsd.org>
From: None <and@genesyslab.com>
List: netbsd-bugs
Date: 11/27/2000 17:54:10
>Number: 11580
>Category: port-sparc64
>Synopsis: ddb's show registers causes unaligned memory access
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-sparc64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 27 17:54:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Andrei Petrov
>Release: 1.5K
>Organization:
>Environment:
NetBSD 1.5K (MUPPET) #10
>Description:
attempt to use 'show registers' from db prompt causes unaligned memory
access and fall into OF debugger
>How-To-Repeat:
>Fix:
Index: db_interface.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/sparc64/db_interface.c,v
retrieving revision 1.45
diff -c -r1.45 db_interface.c
*** db_interface.c 2000/10/19 05:30:29 1.45
--- db_interface.c 2000/11/28 01:40:47
***************
*** 75,86 ****
static int nil;
struct db_variable db_regs[] = {
{ "tstate", (long *)&DDB_TF->tf_tstate, FCN_NULL, },
{ "pc", (long *)&DDB_TF->tf_pc, FCN_NULL, },
{ "npc", (long *)&DDB_TF->tf_npc, FCN_NULL, },
! { "ipl", (long *)&DDB_TF->tf_oldpil, FCN_NULL, },
! { "y", (long *)&DDB_TF->tf_y, FCN_NULL, },
{ "g0", (long *)&nil, FCN_NULL, },
{ "g1", (long *)&DDB_TF->tf_global[1], FCN_NULL, },
{ "g2", (long *)&DDB_TF->tf_global[2], FCN_NULL, },
--- 75,153 ----
static int nil;
+
+ static int
+ db__char_value(struct db_variable *var, db_expr_t *expr, int mode)
+ {
+
+ switch (mode) {
+ case DB_VAR_SET:
+ *var->valuep = *(char *)expr;
+ break;
+ case DB_VAR_GET:
+ *expr = *(char *)var->valuep;
+ break;
+ #ifdef DIAGNOSTIC
+ default:
+ printf("db__char_value: mode %d\n", mode);
+ break;
+ #endif
+ }
+
+ return 0;
+ }
+
+ #if 0
+ static int
+ db__short_value(struct db_variable *var, db_expr_t *expr, int mode)
+ {
+
+ switch (mode) {
+ case DB_VAR_SET:
+ *var->valuep = *(short *)expr;
+ break;
+ case DB_VAR_GET:
+ *expr = *(short *)var->valuep;
+ break;
+ #ifdef DIAGNOSTIC
+ default:
+ printf("db__short_value: mode %d\n", mode);
+ break;
+ #endif
+ }
+
+ return 0;
+ }
+ #endif
+
+ static int
+ db__int_value(struct db_variable *var, db_expr_t *expr, int mode)
+ {
+
+ switch (mode) {
+ case DB_VAR_SET:
+ *var->valuep = *(int *)expr;
+ break;
+ case DB_VAR_GET:
+ *expr = *(int *)var->valuep;
+ break;
+ #ifdef DIAGNOSTIC
+ default:
+ printf("db__int_value: mode %d\n", mode);
+ break;
+ #endif
+ }
+
+
+ return 0;
+ }
+
struct db_variable db_regs[] = {
{ "tstate", (long *)&DDB_TF->tf_tstate, FCN_NULL, },
{ "pc", (long *)&DDB_TF->tf_pc, FCN_NULL, },
{ "npc", (long *)&DDB_TF->tf_npc, FCN_NULL, },
! { "ipl", (long *)&DDB_TF->tf_oldpil, db__char_value, },
! { "y", (long *)&DDB_TF->tf_y, db__int_value, },
{ "g0", (long *)&nil, FCN_NULL, },
{ "g1", (long *)&DDB_TF->tf_global[1], FCN_NULL, },
{ "g2", (long *)&DDB_TF->tf_global[2], FCN_NULL, },
>Release-Note:
>Audit-Trail:
>Unformatted: