Module Name:    src
Committed By:   mrg
Date:           Mon Feb 14 03:18:11 UTC 2011

Modified Files:
        src/sys/arch/sparc/sparc: cpu.c cpuvar.h db_interface.c

Log Message:
add a "mach xcall" command to dump info about each cpus xpmsg{} values.

while here, move the prototype for cpu_debug_dump() to cpuvar.h and
avoid the copy in db_interface.c.


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sparc/sparc/cpuvar.h
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sparc/sparc/db_interface.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.228 src/sys/arch/sparc/sparc/cpu.c:1.229
--- src/sys/arch/sparc/sparc/cpu.c:1.228	Fri Feb  4 09:23:00 2011
+++ src/sys/arch/sparc/sparc/cpu.c	Mon Feb 14 03:18:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.228 2011/02/04 09:23:00 mrg Exp $ */
+/*	$NetBSD: cpu.c,v 1.229 2011/02/14 03:18:10 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.228 2011/02/04 09:23:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.229 2011/02/14 03:18:10 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -80,6 +80,7 @@
 #include <machine/pmap.h>
 
 #if defined(MULTIPROCESSOR) && defined(DDB)
+#include <ddb/db_output.h>
 #include <machine/db_machdep.h>
 #endif
 
@@ -2165,8 +2166,6 @@
 
 #include "ioconf.h"
 
-void cpu_debug_dump(void);
-
 /*
  * Dump CPU information from ddb.
  */
@@ -2189,4 +2188,35 @@
 		    ci->curpcb);
 	}
 }
+
+#if defined(MULTIPROCESSOR)
+/*
+ * Dump CPU xcall from ddb.
+ */
+void
+cpu_xcall_dump(void)
+{
+	struct cpu_info *ci;
+	CPU_INFO_ITERATOR cii;
+
+	db_printf("%-4s %-10s %-10s %-10s %-10s %-10s "
+		    "%-4s %-4s %-4s\n",
+	          "CPU#", "FUNC", "TRAP", "ARG0", "ARG1", "ARG2",
+	            "TAG", "RECV", "COMPL");
+	for (CPU_INFO_FOREACH(cii, ci)) {
+		db_printf("%-4d %-10p %-10p 0x%-8x 0x%-8x 0x%-8x "
+			    "%-4d %-4d %-4d\n",
+		    ci->ci_cpuid,
+		    ci->msg.u.xpmsg_func.func,
+		    ci->msg.u.xpmsg_func.trap,
+		    ci->msg.u.xpmsg_func.arg0,
+		    ci->msg.u.xpmsg_func.arg1,
+		    ci->msg.u.xpmsg_func.arg2,
+		    ci->msg.tag,
+		    ci->msg.received,
+		    ci->msg.complete);
+	}
+}
+#endif
+
 #endif

Index: src/sys/arch/sparc/sparc/cpuvar.h
diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.86 src/sys/arch/sparc/sparc/cpuvar.h:1.87
--- src/sys/arch/sparc/sparc/cpuvar.h:1.86	Thu Jan 27 06:24:59 2011
+++ src/sys/arch/sparc/sparc/cpuvar.h	Mon Feb 14 03:18:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.86 2011/01/27 06:24:59 mrg Exp $ */
+/*	$NetBSD: cpuvar.h,v 1.87 2011/02/14 03:18:10 mrg Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -496,5 +496,12 @@
 
 #define cpuinfo	(*(struct cpu_info *)CPUINFO_VA)
 
+#if defined(DDB) || defined(MULTIPROCESSOR)
+/*
+ * These are called by ddb mach functions.
+ */
+void cpu_debug_dump(void);
+void cpu_xcall_dump(void);
+#endif
 
 #endif	/* _sparc_cpuvar_h */

Index: src/sys/arch/sparc/sparc/db_interface.c
diff -u src/sys/arch/sparc/sparc/db_interface.c:1.87 src/sys/arch/sparc/sparc/db_interface.c:1.88
--- src/sys/arch/sparc/sparc/db_interface.c:1.87	Sat Nov  6 11:46:02 2010
+++ src/sys/arch/sparc/sparc/db_interface.c	Mon Feb 14 03:18:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.87 2010/11/06 11:46:02 uebayasi Exp $ */
+/*	$NetBSD: db_interface.c,v 1.88 2011/02/14 03:18:11 mrg Exp $ */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.87 2010/11/06 11:46:02 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.88 2011/02/14 03:18:11 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -201,6 +201,7 @@
 void db_uvmhistdump(db_expr_t, bool, db_expr_t, const char *);
 #ifdef MULTIPROCESSOR
 void db_cpu_cmd(db_expr_t, bool, db_expr_t, const char *);
+void db_xcall_cmd(db_expr_t, bool, db_expr_t, const char *);
 #endif
 void db_page_cmd(db_expr_t, bool, db_expr_t, const char *);
 
@@ -447,7 +448,6 @@
 }
 
 #if defined(MULTIPROCESSOR)
-extern void cpu_debug_dump(void); /* XXX */
 
 void
 db_cpu_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
@@ -482,6 +482,12 @@
 	ddb_cpuinfo = ci;
 }
 
+void
+db_xcall_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
+{
+	cpu_xcall_dump();
+}
+
 #endif /* MULTIPROCESSOR */
 
 const struct db_command db_machine_command_table[] = {
@@ -500,6 +506,8 @@
 #ifdef MULTIPROCESSOR
 	{ DDB_ADD_CMD("cpu",	db_cpu_cmd,	0,
 	  "switch to another cpu's registers", "cpu-no", NULL) },
+	{ DDB_ADD_CMD("xcall",	db_xcall_cmd,	0,
+	  "show xcall information on all cpus", NULL, NULL) },
 #endif
 	{ DDB_ADD_CMD(NULL,     NULL,           0,	NULL,NULL,NULL) }
 };

Reply via email to