diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-02-11 07:07:53 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-12 08:21:17 -0500 |
commit | 2d7c11bfc91637e5f9bc5f8c9a82aaffcc0e97aa (patch) | |
tree | 0bb67dae38b1185089b6c9813769689cb79c5ee3 /arch/arm/kernel/process.c | |
parent | 67a94c23bb7338c321ae71aa33f8d398c94e1d0c (diff) |
[ARM] 5382/1: unwind: Reorganise the stacktrace support
This patch changes the walk_stacktrace and its callers for easier
integration of stack unwinding. The arch/arm/kernel/stacktrace.h file is
also moved to arch/arm/include/asm/stacktrace.h.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r-- | arch/arm/kernel/process.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index d3ea6fa89521..af377c73d90b 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <asm/processor.h> | 34 | #include <asm/processor.h> |
35 | #include <asm/system.h> | 35 | #include <asm/system.h> |
36 | #include <asm/thread_notify.h> | 36 | #include <asm/thread_notify.h> |
37 | #include <asm/stacktrace.h> | ||
37 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
38 | 39 | ||
39 | static const char *processor_modes[] = { | 40 | static const char *processor_modes[] = { |
@@ -372,23 +373,21 @@ EXPORT_SYMBOL(kernel_thread); | |||
372 | 373 | ||
373 | unsigned long get_wchan(struct task_struct *p) | 374 | unsigned long get_wchan(struct task_struct *p) |
374 | { | 375 | { |
375 | unsigned long fp, lr; | 376 | struct stackframe frame; |
376 | unsigned long stack_start, stack_end; | ||
377 | int count = 0; | 377 | int count = 0; |
378 | if (!p || p == current || p->state == TASK_RUNNING) | 378 | if (!p || p == current || p->state == TASK_RUNNING) |
379 | return 0; | 379 | return 0; |
380 | 380 | ||
381 | stack_start = (unsigned long)end_of_stack(p); | 381 | frame.fp = thread_saved_fp(p); |
382 | stack_end = (unsigned long)task_stack_page(p) + THREAD_SIZE; | 382 | frame.sp = thread_saved_sp(p); |
383 | 383 | frame.lr = 0; /* recovered from the stack */ | |
384 | fp = thread_saved_fp(p); | 384 | frame.pc = thread_saved_pc(p); |
385 | do { | 385 | do { |
386 | if (fp < stack_start || fp > stack_end) | 386 | int ret = unwind_frame(&frame); |
387 | if (ret < 0) | ||
387 | return 0; | 388 | return 0; |
388 | lr = ((unsigned long *)fp)[-1]; | 389 | if (!in_sched_functions(frame.pc)) |
389 | if (!in_sched_functions(lr)) | 390 | return frame.pc; |
390 | return lr; | ||
391 | fp = *(unsigned long *) (fp - 12); | ||
392 | } while (count ++ < 16); | 391 | } while (count ++ < 16); |
393 | return 0; | 392 | return 0; |
394 | } | 393 | } |