Commit 51983eb2 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Un-macroify get_wchan.

parent eba0daf3
......@@ -814,3 +814,41 @@ asmlinkage int sparc_execve(struct pt_regs *regs)
out:
return error;
}
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 thread_info_base;
struct reg_window *rw;
unsigned long ret = 0;
int count = 0;
if (!task || task == current ||
task->state == TASK_RUNNING)
goto out;
thread_info_base = (unsigned long) task->thread_info;
bias = STACK_BIAS;
fp = task->thread_info->ksp + bias;
do {
/* Bogus frame pointer? */
if (fp < (thread_info_base + sizeof(struct thread_info)) ||
fp >= (thread_info_base + THREAD_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;
}
......@@ -187,36 +187,7 @@ do { \
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 thread_info_base; \
struct reg_window *rw; \
unsigned long __ret = 0; \
int count = 0; \
if (!(__TSK) || (__TSK) == current || \
(__TSK)->state == TASK_RUNNING) \
goto __out; \
thread_info_base = (unsigned long) ((__TSK)->thread_info); \
bias = STACK_BIAS; \
fp = (__TSK)->thread_info->ksp + bias; \
do { \
/* Bogus frame pointer? */ \
if (fp < (thread_info_base + sizeof(struct thread_info)) || \
fp >= (thread_info_base + THREAD_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 *task);
#define KSTK_EIP(tsk) ((tsk)->thread_info->kregs->tpc)
#define KSTK_ESP(tsk) ((tsk)->thread_info->kregs->u_regs[UREG_FP])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment