diff options
Diffstat (limited to 'arch/avr32/kernel')
| -rw-r--r-- | arch/avr32/kernel/ptrace.c | 4 | ||||
| -rw-r--r-- | arch/avr32/kernel/traps.c | 52 |
2 files changed, 31 insertions, 25 deletions
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c index f2e81cd79002..6f4388f7c20b 100644 --- a/arch/avr32/kernel/ptrace.c +++ b/arch/avr32/kernel/ptrace.c | |||
| @@ -313,7 +313,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs) | |||
| 313 | __mtdr(DBGREG_DC, dc); | 313 | __mtdr(DBGREG_DC, dc); |
| 314 | 314 | ||
| 315 | ti = current_thread_info(); | 315 | ti = current_thread_info(); |
| 316 | ti->flags |= _TIF_BREAKPOINT; | 316 | set_ti_thread_flag(ti, TIF_BREAKPOINT); |
| 317 | 317 | ||
| 318 | /* The TLB miss handlers don't check thread flags */ | 318 | /* The TLB miss handlers don't check thread flags */ |
| 319 | if ((regs->pc >= (unsigned long)&itlb_miss) | 319 | if ((regs->pc >= (unsigned long)&itlb_miss) |
| @@ -328,7 +328,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs) | |||
| 328 | * single step. | 328 | * single step. |
| 329 | */ | 329 | */ |
| 330 | if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR) | 330 | if ((regs->sr & MODE_MASK) != MODE_SUPERVISOR) |
| 331 | ti->flags |= TIF_SINGLE_STEP; | 331 | set_ti_thread_flag(ti, TIF_SINGLE_STEP); |
| 332 | } else { | 332 | } else { |
| 333 | panic("Unable to handle debug trap at pc = %08lx\n", | 333 | panic("Unable to handle debug trap at pc = %08lx\n", |
| 334 | regs->pc); | 334 | regs->pc); |
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index 7e803f4d7a12..adc01a12d154 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c | |||
| @@ -49,39 +49,45 @@ out: | |||
| 49 | return; | 49 | return; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | static inline int valid_stack_ptr(struct thread_info *tinfo, unsigned long p) | ||
| 53 | { | ||
| 54 | return (p > (unsigned long)tinfo) | ||
| 55 | && (p < (unsigned long)tinfo + THREAD_SIZE - 3); | ||
| 56 | } | ||
| 57 | |||
| 52 | #ifdef CONFIG_FRAME_POINTER | 58 | #ifdef CONFIG_FRAME_POINTER |
| 53 | static inline void __show_trace(struct task_struct *tsk, unsigned long *sp, | 59 | static inline void __show_trace(struct task_struct *tsk, unsigned long *sp, |
| 54 | struct pt_regs *regs) | 60 | struct pt_regs *regs) |
| 55 | { | 61 | { |
| 56 | unsigned long __user *fp; | 62 | unsigned long lr, fp; |
| 57 | unsigned long __user *last_fp = NULL; | 63 | struct thread_info *tinfo; |
| 58 | 64 | ||
| 59 | if (regs) { | 65 | tinfo = (struct thread_info *) |
| 60 | fp = (unsigned long __user *)regs->r7; | 66 | ((unsigned long)sp & ~(THREAD_SIZE - 1)); |
| 61 | } else if (tsk == current) { | 67 | |
| 62 | register unsigned long __user *real_fp __asm__("r7"); | 68 | if (regs) |
| 63 | fp = real_fp; | 69 | fp = regs->r7; |
| 64 | } else { | 70 | else if (tsk == current) |
| 65 | fp = (unsigned long __user *)tsk->thread.cpu_context.r7; | 71 | asm("mov %0, r7" : "=r"(fp)); |
| 66 | } | 72 | else |
| 73 | fp = tsk->thread.cpu_context.r7; | ||
| 67 | 74 | ||
| 68 | /* | 75 | /* |
| 69 | * Walk the stack until (a) we get an exception, (b) the frame | 76 | * Walk the stack as long as the frame pointer (a) is within |
| 70 | * pointer becomes zero, or (c) the frame pointer gets stuck | 77 | * the kernel stack of the task, and (b) it doesn't move |
| 71 | * at the same value. | 78 | * downwards. |
| 72 | */ | 79 | */ |
| 73 | while (fp && fp != last_fp) { | 80 | while (valid_stack_ptr(tinfo, fp)) { |
| 74 | unsigned long lr, new_fp = 0; | 81 | unsigned long new_fp; |
| 75 | |||
| 76 | last_fp = fp; | ||
| 77 | if (__get_user(lr, fp)) | ||
| 78 | break; | ||
| 79 | if (fp && __get_user(new_fp, fp + 1)) | ||
| 80 | break; | ||
| 81 | fp = (unsigned long __user *)new_fp; | ||
| 82 | 82 | ||
| 83 | lr = *(unsigned long *)fp; | ||
| 83 | printk(" [<%08lx>] ", lr); | 84 | printk(" [<%08lx>] ", lr); |
| 84 | print_symbol("%s\n", lr); | 85 | print_symbol("%s\n", lr); |
| 86 | |||
| 87 | new_fp = *(unsigned long *)(fp + 4); | ||
| 88 | if (new_fp <= fp) | ||
| 89 | break; | ||
| 90 | fp = new_fp; | ||
| 85 | } | 91 | } |
| 86 | printk("\n"); | 92 | printk("\n"); |
| 87 | } | 93 | } |
