diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 08:18:43 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 08:18:43 -0700 |
commit | 12dce6263d43daeb4e16fa4eb964c1c99fa4fa2e (patch) | |
tree | e70a514e5fec67be191e12eba508db8ced967a4b /arch/mips/kernel/process.c | |
parent | 3f2e05e90e0846c42626e3d272454f26be34a1bc (diff) | |
parent | 04b314b2c3732bb5aa752fdbb3076de16decdab6 (diff) | |
download | kernel-crypto-12dce6263d43daeb4e16fa4eb964c1c99fa4fa2e.tar.gz kernel-crypto-12dce6263d43daeb4e16fa4eb964c1c99fa4fa2e.tar.xz kernel-crypto-12dce6263d43daeb4e16fa4eb964c1c99fa4fa2e.zip |
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
[MIPS] Remove unused galileo-boars header files
[MIPS] Rename SERIAL_PORT_DEFNS for EV64120
[MIPS] Add UART IRQ number for EV64120
[MIPS] Remove excite_flash.c
[MIPS] Update i8259 resources.
[MIPS] Make unwind_stack() can dig into interrupted context
[MIPS] Stacktrace build-fix and improvement
[MIPS] QEMU: Add support for little endian mips
[MIPS] Remove __flush_icache_page
[MIPS] lockdep: update defconfigs
[MIPS] lockdep: Add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
[MIPS] lockdep: fix TRACE_IRQFLAGS_SUPPORT
Diffstat (limited to 'arch/mips/kernel/process.c')
-rw-r--r-- | arch/mips/kernel/process.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 2613a0dd4b8..045d987bc68 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -40,6 +40,7 @@ #include <asm/elf.h> #include <asm/isadep.h> #include <asm/inst.h> +#include <asm/stacktrace.h> #ifdef CONFIG_MIPS_MT_SMTC #include <asm/mipsmtregs.h> extern void smtc_idle_loop_hook(void); @@ -398,7 +399,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk) #ifdef CONFIG_KALLSYMS /* used by show_backtrace() */ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, - unsigned long pc, unsigned long ra) + unsigned long pc, unsigned long *ra) { unsigned long stack_page; struct mips_frame_info info; @@ -406,18 +407,42 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, char namebuf[KSYM_NAME_LEN + 1]; unsigned long size, ofs; int leaf; + extern void ret_from_irq(void); + extern void ret_from_exception(void); stack_page = (unsigned long)task_stack_page(task); if (!stack_page) return 0; + /* + * If we reached the bottom of interrupt context, + * return saved pc in pt_regs. + */ + if (pc == (unsigned long)ret_from_irq || + pc == (unsigned long)ret_from_exception) { + struct pt_regs *regs; + if (*sp >= stack_page && + *sp + sizeof(*regs) <= stack_page + THREAD_SIZE - 32) { + regs = (struct pt_regs *)*sp; + pc = regs->cp0_epc; + if (__kernel_text_address(pc)) { + *sp = regs->regs[29]; + *ra = regs->regs[31]; + return pc; + } + } + return 0; + } if (!kallsyms_lookup(pc, &size, &ofs, &modname, namebuf)) return 0; /* * Return ra if an exception occured at the first instruction */ - if (unlikely(ofs == 0)) - return ra; + if (unlikely(ofs == 0)) { + pc = *ra; + *ra = 0; + return pc; + } info.func = (void *)(pc - ofs); info.func_size = ofs; /* analyze from start to ofs */ @@ -436,11 +461,12 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, * one. In that cases avoid to return always the * same value. */ - pc = pc != ra ? ra : 0; + pc = pc != *ra ? *ra : 0; else pc = ((unsigned long *)(*sp))[info.pc_offset]; *sp += info.frame_size; + *ra = 0; return __kernel_text_address(pc) ? pc : 0; } #endif @@ -453,6 +479,7 @@ unsigned long get_wchan(struct task_struct *task) unsigned long pc = 0; #ifdef CONFIG_KALLSYMS unsigned long sp; + unsigned long ra = 0; #endif if (!task || task == current || task->state == TASK_RUNNING) @@ -466,7 +493,7 @@ unsigned long get_wchan(struct task_struct *task) sp = task->thread.reg29 + schedule_mfi.frame_size; while (in_sched_functions(pc)) - pc = unwind_stack(task, &sp, pc, 0); + pc = unwind_stack(task, &sp, pc, &ra); #endif out: |