diff options
-rw-r--r-- | sys/arch/sparc64/sparc64/db_interface.c | 25 | ||||
-rw-r--r-- | sys/ddb/db_variables.c | 26 | ||||
-rw-r--r-- | sys/ddb/db_variables.h | 15 |
3 files changed, 29 insertions, 37 deletions
diff --git a/sys/arch/sparc64/sparc64/db_interface.c b/sys/arch/sparc64/sparc64/db_interface.c index 4a0f1b77568..35fc20317a7 100644 --- a/sys/arch/sparc64/sparc64/db_interface.c +++ b/sys/arch/sparc64/sparc64/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.20 2006/07/06 17:51:26 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.21 2006/07/06 19:05:56 miod Exp $ */ /* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */ /* @@ -120,33 +120,12 @@ db__short_value(struct db_variable *var, db_expr_t *expr, int mode) } #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, }, + { "y", (long *)&DDB_TF->tf_y, db_var_rw_int, }, { "g0", (long *)&nil, FCN_NULL, }, { "g1", (long *)&DDB_TF->tf_global[1], FCN_NULL, }, { "g2", (long *)&DDB_TF->tf_global[2], FCN_NULL, }, diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c index f5fd5725fba..ab7303495a7 100644 --- a/sys/ddb/db_variables.c +++ b/sys/ddb/db_variables.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_variables.c,v 1.11 2006/07/06 18:14:48 miod Exp $ */ +/* $OpenBSD: db_variables.c,v 1.12 2006/07/06 19:05:58 miod Exp $ */ /* $NetBSD: db_variables.c,v 1.8 1996/02/05 01:57:19 christos Exp $ */ /* @@ -42,12 +42,12 @@ #include <ddb/db_var.h> struct db_variable db_vars[] = { - { "radix", (long *)&db_radix, FCN_NULL }, - { "maxoff", (long *)&db_maxoff, FCN_NULL }, - { "maxwidth", (long *)&db_max_width, FCN_NULL }, - { "tabstops", (long *)&db_tab_stop_width, FCN_NULL }, - { "lines", (long *)&db_max_line, FCN_NULL }, - { "log", (long *)&db_log, FCN_NULL } + { "radix", (long *)&db_radix, db_var_rw_int }, + { "maxoff", (long *)&db_maxoff, db_var_rw_int }, + { "maxwidth", (long *)&db_max_width, db_var_rw_int }, + { "tabstops", (long *)&db_tab_stop_width, db_var_rw_int }, + { "lines", (long *)&db_max_line, db_var_rw_int }, + { "log", (long *)&db_log, db_var_rw_int } }; struct db_variable *db_evars = db_vars + sizeof(db_vars)/sizeof(db_vars[0]); @@ -159,3 +159,15 @@ db_set_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) db_write_variable(vp, &value); } + +int +db_var_rw_int(struct db_variable *var, db_expr_t *expr, int mode) +{ + + if (mode == DB_VAR_SET) + *var->valuep = *(int *)expr; + else + *expr = *(int *)var->valuep; + return (0); +} + diff --git a/sys/ddb/db_variables.h b/sys/ddb/db_variables.h index 3c5450d0dd2..92426c3da0b 100644 --- a/sys/ddb/db_variables.h +++ b/sys/ddb/db_variables.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_variables.h,v 1.6 2002/03/14 01:26:51 millert Exp $ */ +/* $OpenBSD: db_variables.h,v 1.7 2006/07/06 19:05:58 miod Exp $ */ /* $NetBSD: db_variables.h,v 1.5 1996/02/05 01:57:21 christos Exp $ */ /* @@ -51,11 +51,12 @@ extern struct db_variable *db_evars; extern struct db_variable db_regs[]; /* machine registers */ extern struct db_variable *db_eregs; -int db_find_variable(struct db_variable **); -int db_get_variable(db_expr_t *); -int db_set_variable(db_expr_t); -void db_read_variable(struct db_variable *, db_expr_t *); -void db_write_variable(struct db_variable *, db_expr_t *); -void db_set_cmd(db_expr_t, int, db_expr_t, char *); +int db_find_variable(struct db_variable **); +int db_get_variable(db_expr_t *); +int db_set_variable(db_expr_t); +void db_read_variable(struct db_variable *, db_expr_t *); +void db_write_variable(struct db_variable *, db_expr_t *); +void db_set_cmd(db_expr_t, int, db_expr_t, char *); +int db_var_rw_int(struct db_variable *, db_expr_t *, int); #endif /* _DB_VARIABLES_H_ */ |