@@ -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 @@
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 @@
{ 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 @@
#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 @@
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 @@
cnpollc(false);
db_active--;
splx(s);
-#ifdef MULTIPROCESSOR
+#ifdef MULTIPROCESSOR
db_resume_others();
}
-#endif
+#endif
ddb_regp = &dbreg;
*regs = ddb_regs;
@@ -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 @@
#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 @@
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 @@
{ 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,10 +96,8 @@
static bool ddb_mp_online;
#endif
-db_regs_t *ddb_regp = 0;
+#define NOCPU -1
-#define NOCPU -1
-
int ddb_cpu = NOCPU;
typedef void (vector)(void);
@@ -246,6 +242,7 @@
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 @@
ci->ci_ddb_regs = ®s;
atomic_or_32(&ci->ci_flags, CPUF_PAUSE);
+
while (ci->ci_flags & CPUF_PAUSE)
;
ci->ci_ddb_regs = 0;
@@ -366,11 +364,7 @@
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) {
@@ -400,6 +394,5 @@
db_printf("using CPU %ld", addr);
ddb_regp = ci->ci_ddb_regs;
}
-
#endif