summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/include/kdb.h2
-rw-r--r--sys/amd64/include/kdb.h2
-rw-r--r--sys/i386/include/kdb.h2
-rw-r--r--sys/ia64/include/kdb.h2
-rw-r--r--sys/kern/subr_kdb.c15
-rw-r--r--sys/sparc64/include/kdb.h2
6 files changed, 15 insertions, 10 deletions
diff --git a/sys/alpha/include/kdb.h b/sys/alpha/include/kdb.h
index ded9cd6..fb08d4b 100644
--- a/sys/alpha/include/kdb.h
+++ b/sys/alpha/include/kdb.h
@@ -31,6 +31,8 @@
#include <machine/frame.h>
+#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
+
static __inline void
kdb_cpu_clear_singlestep(void)
{
diff --git a/sys/amd64/include/kdb.h b/sys/amd64/include/kdb.h
index ba35914..131e40e 100644
--- a/sys/amd64/include/kdb.h
+++ b/sys/amd64/include/kdb.h
@@ -32,6 +32,8 @@
#include <machine/frame.h>
#include <machine/psl.h>
+#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
+
static __inline void
kdb_cpu_clear_singlestep(void)
{
diff --git a/sys/i386/include/kdb.h b/sys/i386/include/kdb.h
index ae8cb4f..77e1a6b 100644
--- a/sys/i386/include/kdb.h
+++ b/sys/i386/include/kdb.h
@@ -32,6 +32,8 @@
#include <machine/frame.h>
#include <machine/psl.h>
+#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
+
static __inline void
kdb_cpu_clear_singlestep(void)
{
diff --git a/sys/ia64/include/kdb.h b/sys/ia64/include/kdb.h
index 700a0d7..500a909 100644
--- a/sys/ia64/include/kdb.h
+++ b/sys/ia64/include/kdb.h
@@ -33,6 +33,8 @@
#include <machine/frame.h>
#include <machine/ia64_cpu.h>
+#define KDB_STOPPEDPCB(pc) (pc)->pc_pcb
+
static __inline void
kdb_cpu_clear_singlestep(void)
{
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index b386604..7fb9b9e 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -43,11 +43,8 @@ __FBSDID("$FreeBSD$");
#include <machine/pcb.h>
#ifdef SMP
-#if defined (__i386__) || defined(__amd64__) || defined(__sparc64__) || defined(__alpha__)
-#define HAVE_STOPPEDPCBS
#include <machine/smp.h>
#endif
-#endif
int kdb_active = 0;
void *kdb_jmpbufp = NULL;
@@ -358,19 +355,17 @@ kdb_reenter(void)
struct pcb *
kdb_thr_ctx(struct thread *thr)
{
-#ifdef HAVE_STOPPEDPCBS
+#if defined(SMP) && defined(KDB_STOPPEDPCB)
struct pcpu *pc;
- u_int cpuid;
#endif
-
+
if (thr == curthread)
return (&kdb_pcb);
-#ifdef HAVE_STOPPEDPCBS
+#if defined(SMP) && defined(KDB_STOPPEDPCB)
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
- cpuid = pc->pc_cpuid;
- if (pc->pc_curthread == thr && (stopped_cpus & (1 << cpuid)))
- return (&stoppcbs[cpuid]);
+ if (pc->pc_curthread == thr && (stopped_cpus & pc->pc_cpumask))
+ return (KDB_STOPPEDPCB(pc));
}
#endif
return (thr->td_pcb);
diff --git a/sys/sparc64/include/kdb.h b/sys/sparc64/include/kdb.h
index e5b39c0..3e510e0 100644
--- a/sys/sparc64/include/kdb.h
+++ b/sys/sparc64/include/kdb.h
@@ -31,6 +31,8 @@
#include <machine/cpufunc.h>
+#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid]
+
static __inline void
kdb_cpu_clear_singlestep(void)
{
OpenPOWER on IntegriCloud