From 2d7c11bfc91637e5f9bc5f8c9a82aaffcc0e97aa Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Wed, 11 Feb 2009 13:07:53 +0100 Subject: [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 Signed-off-by: Russell King --- arch/arm/kernel/time.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'arch/arm/kernel/time.c') 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 #include +#include #include /* @@ -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 -- cgit