diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-02-11 13:07:53 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-12 13:21:17 +0000 |
commit | 2d7c11bfc91637e5f9bc5f8c9a82aaffcc0e97aa (patch) | |
tree | 0bb67dae38b1185089b6c9813769689cb79c5ee3 /arch/arm/kernel/time.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/time.c')
-rw-r--r-- | arch/arm/kernel/time.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index c68b44aa88d..4cdc4a0bd02 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -33,6 +33,7 @@ #include <asm/leds.h> #include <asm/thread_info.h> +#include <asm/stacktrace.h> #include <asm/mach/time.h> /* @@ -55,14 +56,22 @@ EXPORT_SYMBOL(rtc_lock); #ifdef CONFIG_SMP unsigned long profile_pc(struct pt_regs *regs) { - unsigned long fp, pc = instruction_pointer(regs); + struct stackframe frame; - if (in_lock_functions(pc)) { - fp = regs->ARM_fp; - pc = ((unsigned long *)fp)[-1]; - } + if (!in_lock_functions(regs->ARM_pc)) + return regs->ARM_pc; + + frame.fp = regs->ARM_fp; + frame.sp = regs->ARM_sp; + frame.lr = regs->ARM_lr; + frame.pc = regs->ARM_pc; + do { + int ret = unwind_frame(&frame); + if (ret < 0) + return 0; + } while (in_lock_functions(frame.pc)); - return pc; + return frame.pc; } EXPORT_SYMBOL(profile_pc); #endif |