diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-12-02 23:19:27 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-12-02 23:19:27 -0800 |
| commit | eba0daf3d43a5f44a7932103322f1bed1a2f59d8 (patch) | |
| tree | a929c23d6ec8d6d08a1a622302db756837bbc052 | |
| parent | a807608b9151e9b3f3487dee9b1740ea1c07b488 (diff) | |
[SPARC32]: Move get_wchan into processor.c
| -rw-r--r-- | arch/sparc/kernel/process.c | 36 | ||||
| -rw-r--r-- | include/asm-sparc/processor.h | 29 |
2 files changed, 37 insertions, 28 deletions
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index ed1490899355..28f900520f03 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -725,3 +725,39 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) "g1", "g2", "g3", "o0", "o1", "memory", "cc"); return retval; } + +extern void scheduling_functions_start_here(void); +extern void scheduling_functions_end_here(void); + +unsigned long get_wchan(struct task_struct *task) +{ + unsigned long pc, fp, bias = 0; + unsigned long task_base = (unsigned long) task; + unsigned long ret = 0; + struct reg_window *rw; + int count = 0; + + if (!task || task == current || + task->state == TASK_RUNNING) + goto out; + + fp = task->thread_info->ksp + bias; + do { + /* Bogus frame pointer? */ + if (fp < (task_base + sizeof(struct task_struct)) || + fp >= (task_base + (2 * PAGE_SIZE))) + break; + rw = (struct reg_window *) fp; + pc = rw->ins[7]; + if (pc < ((unsigned long) scheduling_functions_start_here) || + pc >= ((unsigned long) scheduling_functions_end_here)) { + ret = pc; + goto out; + } + fp = rw->ins[6] + bias; + } while (++count < 16); + +out: + return ret; +} + diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h index 91a7410dc21f..d6ef337682f4 100644 --- a/include/asm-sparc/processor.h +++ b/include/asm-sparc/processor.h @@ -139,34 +139,7 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc, #define release_thread(tsk) do { } while(0) extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); -#define get_wchan(__TSK) \ -({ extern void scheduling_functions_start_here(void); \ - extern void scheduling_functions_end_here(void); \ - unsigned long pc, fp, bias = 0; \ - unsigned long task_base = (unsigned long) (__TSK); \ - unsigned long __ret = 0; \ - struct reg_window *rw; \ - int count = 0; \ - if (!(__TSK) || (__TSK) == current || \ - (__TSK)->state == TASK_RUNNING) \ - goto __out; \ - fp = (__TSK)->thread_info->ksp + bias; \ - do { \ - /* Bogus frame pointer? */ \ - if (fp < (task_base + sizeof(struct task_struct)) || \ - fp >= (task_base + (2 * PAGE_SIZE))) \ - break; \ - rw = (struct reg_window *) fp; \ - pc = rw->ins[7]; \ - if (pc < ((unsigned long) scheduling_functions_start_here) || \ - pc >= ((unsigned long) scheduling_functions_end_here)) { \ - __ret = pc; \ - goto __out; \ - } \ - fp = rw->ins[6] + bias; \ - } while (++count < 16); \ -__out: __ret; \ -}) +extern unsigned long get_wchan(struct task_struct *); #define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc) #define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP]) |
