Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83160
b: refs/heads/master
c: c112746
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Feb 5, 2008
1 parent f3fd4e6 commit 0e9c56d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9a3072d13e4b8a6549ecc1db6390a55c7ee2ddf
refs/heads/master: c11274655558e72d8d4a598c0077874c094d97d5
35 changes: 35 additions & 0 deletions trunk/arch/um/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,38 @@ unsigned long arch_align_stack(unsigned long sp)
return sp & ~0xf;
}
#endif

unsigned long get_wchan(struct task_struct *p)
{
unsigned long stack_page, sp, ip;
bool seen_sched = 0;

if ((p == NULL) || (p == current) || (p->state == TASK_RUNNING))
return 0;

stack_page = (unsigned long) task_stack_page(p);
/* Bail if the process has no kernel stack for some reason */
if (stack_page == 0)
return 0;

sp = p->thread.switch_buf->JB_SP;
/*
* Bail if the stack pointer is below the bottom of the kernel
* stack for some reason
*/
if (sp < stack_page)
return 0;

while (sp < stack_page + THREAD_SIZE) {
ip = *((unsigned long *) sp);
if (in_sched_functions(ip))
/* Ignore everything until we're above the scheduler */
seen_sched = 1;
else if (kernel_text_address(ip) && seen_sched)
return ip;

sp += sizeof(unsigned long);
}

return 0;
}
2 changes: 1 addition & 1 deletion trunk/include/asm-um/processor-generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ extern struct cpuinfo_um cpu_data[];


#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
#define get_wchan(p) (0)
extern unsigned long get_wchan(struct task_struct *p);

#endif

0 comments on commit 0e9c56d

Please sign in to comment.