summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-04-03 22:51:47 +0000
committermarcel <marcel@FreeBSD.org>2006-04-03 22:51:47 +0000
commit8278e2d5fbf3b90494b259664803d77b2c5c2a96 (patch)
tree981658ebfce6b57566091fd168aa6d3b3c08789c /sys
parent8582a7eef54875ec23f28273f78836913636fa30 (diff)
downloadFreeBSD-src-8278e2d5fbf3b90494b259664803d77b2c5c2a96.zip
FreeBSD-src-8278e2d5fbf3b90494b259664803d77b2c5c2a96.tar.gz
Eliminate HAVE_STOPPEDPCBS. On ia64 the PCPU holds a pointer to the
PCB in which the context of stopped CPUs is stored. To access this PCB from KDB, we introduce a new define, called KDB_STOPPEDPCB. The definition, when present, lives in <machine/kdb.h> and abstracts where MD code saves the context. Define KDB_STOPPEDPCB on i386, amd64, alpha and sparc64 in accordance to previous code.
Diffstat (limited to 'sys')
-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