Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc Move the ddb registers and empty command tabl...
details: https://anonhg.NetBSD.org/src/rev/78a0de531d9f
branches: trunk
changeset: 355258:78a0de531d9f
user: nakayama <nakayama%NetBSD.org@localhost>
date: Fri Jul 21 20:56:10 2017 +0000
description:
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.
diffstat:
sys/arch/sparc/conf/files.sparc | 3 +-
sys/arch/sparc/sparc/db_interface.c | 81 +----------------------
sys/arch/sparc/sparc/db_machdep.c | 128 ++++++++++++++++++++++++++++++++++++
3 files changed, 132 insertions(+), 80 deletions(-)
diffs (258 lines):
diff -r 3b6ff3fcc50e -r 78a0de531d9f sys/arch/sparc/conf/files.sparc
--- a/sys/arch/sparc/conf/files.sparc Fri Jul 21 18:25:25 2017 +0000
+++ b/sys/arch/sparc/conf/files.sparc Fri Jul 21 20:56:10 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc,v 1.156 2016/04/30 05:24:45 macallan Exp $
+# $NetBSD: files.sparc,v 1.157 2017/07/21 20:56:10 nakayama Exp $
# @(#)files.sparc 8.1 (Berkeley) 7/19/93
# sparc-specific configuration info
@@ -317,6 +317,7 @@
file arch/sparc/sparc/vm_machdep.c
file arch/sparc/sparc/db_interface.c ddb | kgdb
+file arch/sparc/sparc/db_machdep.c ddb
file arch/sparc/sparc/db_trace.c ddb
file arch/sparc/sparc/db_disasm.c ddb
diff -r 3b6ff3fcc50e -r 78a0de531d9f sys/arch/sparc/sparc/db_interface.c
--- a/sys/arch/sparc/sparc/db_interface.c Fri Jul 21 18:25:25 2017 +0000
+++ b/sys/arch/sparc/sparc/db_interface.c Fri Jul 21 20:56:10 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.93 2016/12/14 18:50:56 mrg Exp $ */
+/* $NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $ */
/*
* Mach Operating System
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.93 2016/12/14 18:50:56 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -113,8 +113,6 @@
}
#endif
-db_regs_t *ddb_regp;
-
#if defined(DDB)
/*
@@ -132,81 +130,6 @@
#if defined(DDB) || defined(_KMEMUSER)
-static long nil;
-
-/*
- * Machine register set.
- */
-#define dbreg(xx) (long *)offsetof(db_regs_t, db_tf.tf_ ## xx)
-#define dbregfr(xx) (long *)offsetof(db_regs_t, db_fr.fr_ ## xx)
-
-static int db_sparc_regop(const struct db_variable *, db_expr_t *, int);
-
-const struct db_variable db_regs[] = {
- { "psr", dbreg(psr), db_sparc_regop, NULL, },
- { "pc", dbreg(pc), db_sparc_regop, NULL, },
- { "npc", dbreg(npc), db_sparc_regop, NULL, },
- { "y", dbreg(y), db_sparc_regop, NULL, },
- { "wim", dbreg(global[0]), db_sparc_regop, NULL, }, /* see reg.h */
- { "g0", &nil, FCN_NULL, NULL, },
- { "g1", dbreg(global[1]), db_sparc_regop, NULL, },
- { "g2", dbreg(global[2]), db_sparc_regop, NULL, },
- { "g3", dbreg(global[3]), db_sparc_regop, NULL, },
- { "g4", dbreg(global[4]), db_sparc_regop, NULL, },
- { "g5", dbreg(global[5]), db_sparc_regop, NULL, },
- { "g6", dbreg(global[6]), db_sparc_regop, NULL, },
- { "g7", dbreg(global[7]), db_sparc_regop, NULL, },
- { "o0", dbreg(out[0]), db_sparc_regop, NULL, },
- { "o1", dbreg(out[1]), db_sparc_regop, NULL, },
- { "o2", dbreg(out[2]), db_sparc_regop, NULL, },
- { "o3", dbreg(out[3]), db_sparc_regop, NULL, },
- { "o4", dbreg(out[4]), db_sparc_regop, NULL, },
- { "o5", dbreg(out[5]), db_sparc_regop, NULL, },
- { "o6", dbreg(out[6]), db_sparc_regop, NULL, },
- { "o7", dbreg(out[7]), db_sparc_regop, NULL, },
- { "l0", dbregfr(local[0]), db_sparc_regop, NULL, },
- { "l1", dbregfr(local[1]), db_sparc_regop, NULL, },
- { "l2", dbregfr(local[2]), db_sparc_regop, NULL, },
- { "l3", dbregfr(local[3]), db_sparc_regop, NULL, },
- { "l4", dbregfr(local[4]), db_sparc_regop, NULL, },
- { "l5", dbregfr(local[5]), db_sparc_regop, NULL, },
- { "l6", dbregfr(local[6]), db_sparc_regop, NULL, },
- { "l7", dbregfr(local[7]), db_sparc_regop, NULL, },
- { "i0", dbregfr(arg[0]), db_sparc_regop, NULL, },
- { "i1", dbregfr(arg[1]), db_sparc_regop, NULL, },
- { "i2", dbregfr(arg[2]), db_sparc_regop, NULL, },
- { "i3", dbregfr(arg[3]), db_sparc_regop, NULL, },
- { "i4", dbregfr(arg[4]), db_sparc_regop, NULL, },
- { "i5", dbregfr(arg[5]), db_sparc_regop, NULL, },
- { "i6", dbregfr(fp), db_sparc_regop, NULL, },
- { "i7", dbregfr(pc), db_sparc_regop, NULL, },
-};
-const struct db_variable * const db_eregs =
- db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-static int
-db_sparc_regop (const struct db_variable *vp, db_expr_t *val, int opcode)
-{
- db_expr_t *regaddr =
- (db_expr_t *)(((uint8_t *)DDB_REGS) + ((size_t)vp->valuep));
-
- switch (opcode) {
- case DB_VAR_GET:
- *val = *regaddr;
- break;
- case DB_VAR_SET:
- *regaddr = *val;
- break;
- default:
-#ifdef _KERNEL
- panic("db_sparc_regop: unknown op %d", opcode);
-#else
- printf("db_sparc_regop: unknown op %d\n", opcode);
-#endif
- }
- return 0;
-}
-
int db_active = 0;
extern char *trap_type[];
diff -r 3b6ff3fcc50e -r 78a0de531d9f sys/arch/sparc/sparc/db_machdep.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc/sparc/db_machdep.c Fri Jul 21 20:56:10 2017 +0000
@@ -0,0 +1,128 @@
+/* $NetBSD: db_machdep.c,v 1.1 2017/07/21 20:56:10 nakayama Exp $ */
+
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ *
+ * From: db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
+ */
+
+/*
+ * Interface to new debugger.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1 2017/07/21 20:56:10 nakayama Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ddb.h"
+#endif
+
+#include <sys/param.h>
+#include <machine/db_machdep.h>
+#include <ddb/db_user.h>
+#include <ddb/db_command.h>
+#include <ddb/db_variables.h>
+
+/*
+ * Machine register set.
+ */
+#define dbreg(xx) (long *)offsetof(db_regs_t, db_tf.tf_ ## xx)
+#define dbregfr(xx) (long *)offsetof(db_regs_t, db_fr.fr_ ## xx)
+
+static int db_sparc_regop(const struct db_variable *, db_expr_t *, int);
+
+db_regs_t *ddb_regp;
+static long nil;
+
+const struct db_variable db_regs[] = {
+ { "psr", dbreg(psr), db_sparc_regop, NULL, },
+ { "pc", dbreg(pc), db_sparc_regop, NULL, },
+ { "npc", dbreg(npc), db_sparc_regop, NULL, },
+ { "y", dbreg(y), db_sparc_regop, NULL, },
+ { "wim", dbreg(global[0]), db_sparc_regop, NULL, }, /* see reg.h */
+ { "g0", &nil, FCN_NULL, NULL, },
+ { "g1", dbreg(global[1]), db_sparc_regop, NULL, },
+ { "g2", dbreg(global[2]), db_sparc_regop, NULL, },
+ { "g3", dbreg(global[3]), db_sparc_regop, NULL, },
+ { "g4", dbreg(global[4]), db_sparc_regop, NULL, },
+ { "g5", dbreg(global[5]), db_sparc_regop, NULL, },
+ { "g6", dbreg(global[6]), db_sparc_regop, NULL, },
+ { "g7", dbreg(global[7]), db_sparc_regop, NULL, },
+ { "o0", dbreg(out[0]), db_sparc_regop, NULL, },
+ { "o1", dbreg(out[1]), db_sparc_regop, NULL, },
+ { "o2", dbreg(out[2]), db_sparc_regop, NULL, },
+ { "o3", dbreg(out[3]), db_sparc_regop, NULL, },
+ { "o4", dbreg(out[4]), db_sparc_regop, NULL, },
+ { "o5", dbreg(out[5]), db_sparc_regop, NULL, },
+ { "o6", dbreg(out[6]), db_sparc_regop, NULL, },
+ { "o7", dbreg(out[7]), db_sparc_regop, NULL, },
+ { "l0", dbregfr(local[0]), db_sparc_regop, NULL, },
+ { "l1", dbregfr(local[1]), db_sparc_regop, NULL, },
+ { "l2", dbregfr(local[2]), db_sparc_regop, NULL, },
+ { "l3", dbregfr(local[3]), db_sparc_regop, NULL, },
+ { "l4", dbregfr(local[4]), db_sparc_regop, NULL, },
+ { "l5", dbregfr(local[5]), db_sparc_regop, NULL, },
+ { "l6", dbregfr(local[6]), db_sparc_regop, NULL, },
+ { "l7", dbregfr(local[7]), db_sparc_regop, NULL, },
+ { "i0", dbregfr(arg[0]), db_sparc_regop, NULL, },
+ { "i1", dbregfr(arg[1]), db_sparc_regop, NULL, },
+ { "i2", dbregfr(arg[2]), db_sparc_regop, NULL, },
+ { "i3", dbregfr(arg[3]), db_sparc_regop, NULL, },
+ { "i4", dbregfr(arg[4]), db_sparc_regop, NULL, },
+ { "i5", dbregfr(arg[5]), db_sparc_regop, NULL, },
+ { "i6", dbregfr(fp), db_sparc_regop, NULL, },
+ { "i7", dbregfr(pc), db_sparc_regop, NULL, },
+};
+const struct db_variable * const db_eregs =
+ db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
+
+static int
+db_sparc_regop(const struct db_variable *vp, db_expr_t *val, int opcode)
+{
+ db_expr_t *regaddr =
+ (db_expr_t *)(((uint8_t *)DDB_REGS) + ((size_t)vp->valuep));
+
+ switch (opcode) {
+ case DB_VAR_GET:
+ *val = *regaddr;
+ break;
+ case DB_VAR_SET:
+ *regaddr = *val;
+ break;
+ default:
+#ifdef _KERNEL
+ panic("db_sparc_regop: unknown op %d", opcode);
+#else
+ printf("db_sparc_regop: unknown op %d\n", opcode);
+#endif
+ }
+ return 0;
+}
+
+#ifndef DDB
+const struct db_command db_machine_command_table[] = {
+ { DDB_ADD_CMD(NULL, NULL, 0, NULL,NULL,NULL) }
+};
+#endif /* DDB */
Home |
Main Index |
Thread Index |
Old Index