From 8278e2d5fbf3b90494b259664803d77b2c5c2a96 Mon Sep 17 00:00:00 2001 From: marcel Date: Mon, 3 Apr 2006 22:51:47 +0000 Subject: 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 and abstracts where MD code saves the context. Define KDB_STOPPEDPCB on i386, amd64, alpha and sparc64 in accordance to previous code. --- sys/alpha/include/kdb.h | 2 ++ sys/amd64/include/kdb.h | 2 ++ sys/i386/include/kdb.h | 2 ++ sys/ia64/include/kdb.h | 2 ++ sys/kern/subr_kdb.c | 15 +++++---------- sys/sparc64/include/kdb.h | 2 ++ 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 +#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 #include +#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 #include +#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 #include +#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 #ifdef SMP -#if defined (__i386__) || defined(__amd64__) || defined(__sparc64__) || defined(__alpha__) -#define HAVE_STOPPEDPCBS #include #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 +#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid] + static __inline void kdb_cpu_clear_singlestep(void) { -- cgit v1.1