Module Name:    src
Committed By:   maxv
Date:           Tue Aug 15 06:57:53 UTC 2017

Modified Files:
        src/sys/arch/amd64/amd64: db_interface.c
        src/sys/arch/i386/i386: db_interface.c

Log Message:
Reduce the diff between amd64 and i386.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amd64/amd64/db_interface.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/i386/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/amd64/amd64/db_interface.c
diff -u src/sys/arch/amd64/amd64/db_interface.c:1.25 src/sys/arch/amd64/amd64/db_interface.c:1.26
--- src/sys/arch/amd64/amd64/db_interface.c:1.25	Tue May 23 08:54:38 2017
+++ src/sys/arch/amd64/amd64/db_interface.c	Tue Aug 15 06:57:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.25 2017/05/23 08:54:38 nonaka Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.26 2017/08/15 06:57:53 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.25 2017/05/23 08:54:38 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.26 2017/08/15 06:57:53 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -66,9 +66,9 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 extern const char *const trap_type[];
 extern int trap_types;
 
-int	db_active;
+int	db_active = 0;
 db_regs_t ddb_regs;	/* register state */
-db_regs_t *ddb_regp;
+db_regs_t *ddb_regp = NULL;
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);
 
@@ -77,7 +77,7 @@ const struct db_command db_machine_comma
 	{ DDB_ADD_CMD("cpu",	db_mach_cpu,	0,
 	  "switch to another cpu", "cpu-no", NULL) },
 #endif
-	{ DDB_ADD_CMD(NULL,     NULL,          0,NULL,NULL,NULL) },
+	{ DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) },
 };
 
 void kdbprinttrap(int, int);
@@ -143,7 +143,6 @@ db_suspend_others(void)
 #else
 		x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
 #endif /* XEN */
-
 	}
 	ddb_mp_online = x86_mp_online;
 	x86_mp_online = false;
@@ -201,7 +200,7 @@ kdb_trap(int type, int code, db_regs_t *
 	case -1:	/* keyboard interrupt */
 		break;
 	default:
-		if (!db_onpanic && db_recover==0)
+		if (!db_onpanic && db_recover == 0)
 			return (0);
 
 		kdbprinttrap(type, code);
@@ -235,10 +234,10 @@ kdb_trap(int type, int code, db_regs_t *
 	cnpollc(false);
 	db_active--;
 	splx(s);
-#ifdef MULTIPROCESSOR  
+#ifdef MULTIPROCESSOR
 	db_resume_others();
 	}
-#endif  
+#endif
 	ddb_regp = &dbreg;
 
 	*regs = ddb_regs;

Index: src/sys/arch/i386/i386/db_interface.c
diff -u src/sys/arch/i386/i386/db_interface.c:1.72 src/sys/arch/i386/i386/db_interface.c:1.73
--- src/sys/arch/i386/i386/db_interface.c:1.72	Tue May 23 08:54:38 2017
+++ src/sys/arch/i386/i386/db_interface.c	Tue Aug 15 06:57:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.72 2017/05/23 08:54:38 nonaka Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.73 2017/08/15 06:57:53 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.72 2017/05/23 08:54:38 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.73 2017/08/15 06:57:53 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -48,8 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 #include <sys/atomic.h>
 #include <sys/cpu.h>
 
-#include <uvm/uvm_extern.h>
-
 #include <dev/cons.h>
 
 #include <machine/cpufunc.h>
@@ -75,6 +73,7 @@ extern int trap_types;
 
 int	db_active = 0;
 db_regs_t ddb_regs;	/* register state */
+db_regs_t *ddb_regp = NULL;
 
 void db_mach_cpu (db_expr_t, bool, db_expr_t, const char *);
 
@@ -83,8 +82,7 @@ const struct db_command db_machine_comma
 	{ DDB_ADD_CMD("cpu",	db_mach_cpu,	0,
 	  "switch to another cpu", "cpu-no", NULL) },
 #endif
-		
-	{ DDB_ADD_CMD(NULL, NULL, 0,  NULL,NULL,NULL) },
+	{ DDB_ADD_CMD(NULL, NULL, 0, NULL, NULL, NULL) },
 };
 
 void kdbprinttrap(int, int);
@@ -98,9 +96,7 @@ int ddb_vec;
 static bool ddb_mp_online;
 #endif
 
-db_regs_t *ddb_regp = 0;
-
-#define NOCPU -1
+#define NOCPU	-1
 
 int ddb_cpu = NOCPU;
 
@@ -246,6 +242,7 @@ kdb_trap(int type, int code, db_regs_t *
 	ddb_regs.tf_fs &= 0xffff;
 	ddb_regs.tf_gs &= 0xffff;
 	ddb_regs.tf_ss &= 0xffff;
+
 	s = splhigh();
 	db_active++;
 	cnpollc(true);
@@ -356,6 +353,7 @@ ddb_suspend(struct trapframe *frame)
 	ci->ci_ddb_regs = &regs;
 
 	atomic_or_32(&ci->ci_flags, CPUF_PAUSE);
+
 	while (ci->ci_flags & CPUF_PAUSE)
 		;
 	ci->ci_ddb_regs = 0;
@@ -366,11 +364,7 @@ ddb_suspend(struct trapframe *frame)
 extern void cpu_debug_dump(void); /* XXX */
 
 void
-db_mach_cpu(
-	db_expr_t	addr,
-	bool		have_addr,
-	db_expr_t	count,
-	const char *	modif)
+db_mach_cpu(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
 {
 	struct cpu_info *ci;
 	if (!have_addr) {
@@ -401,5 +395,4 @@ db_mach_cpu(
 	ddb_regp = ci->ci_ddb_regs;
 }
 
-
 #endif

Reply via email to