aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-10-11 10:17:53 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-10-11 10:17:53 -0400
commite40c2ec6761d11043ad9f6352679049dbee836eb (patch)
treeda62908bf995706bb7251e128ef8918210912153
parentd191fe093f4494e0220f11f4ef2068b9581357b5 (diff)
ARM: Dump code/mem oops lines with the appropriate log level
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/kernel/traps.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index e768fb59b674..b551b6504966 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -45,7 +45,7 @@ static int __init user_debug_setup(char *str)
45__setup("user_debug=", user_debug_setup); 45__setup("user_debug=", user_debug_setup);
46#endif 46#endif
47 47
48static void dump_mem(const char *str, unsigned long bottom, unsigned long top); 48static void dump_mem(const char *, const char *, unsigned long, unsigned long);
49 49
50void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) 50void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
51{ 51{
@@ -59,7 +59,7 @@ void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long
59#endif 59#endif
60 60
61 if (in_exception_text(where)) 61 if (in_exception_text(where))
62 dump_mem("Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); 62 dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs));
63} 63}
64 64
65#ifndef CONFIG_ARM_UNWIND 65#ifndef CONFIG_ARM_UNWIND
@@ -81,7 +81,8 @@ static int verify_stack(unsigned long sp)
81/* 81/*
82 * Dump out the contents of some memory nicely... 82 * Dump out the contents of some memory nicely...
83 */ 83 */
84static void dump_mem(const char *str, unsigned long bottom, unsigned long top) 84static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
85 unsigned long top)
85{ 86{
86 unsigned long first; 87 unsigned long first;
87 mm_segment_t fs; 88 mm_segment_t fs;
@@ -95,7 +96,7 @@ static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
95 fs = get_fs(); 96 fs = get_fs();
96 set_fs(KERNEL_DS); 97 set_fs(KERNEL_DS);
97 98
98 printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top); 99 printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top);
99 100
100 for (first = bottom & ~31; first < top; first += 32) { 101 for (first = bottom & ~31; first < top; first += 32) {
101 unsigned long p; 102 unsigned long p;
@@ -113,13 +114,13 @@ static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
113 sprintf(str + i * 9, " ????????"); 114 sprintf(str + i * 9, " ????????");
114 } 115 }
115 } 116 }
116 printk("%04lx:%s\n", first & 0xffff, str); 117 printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
117 } 118 }
118 119
119 set_fs(fs); 120 set_fs(fs);
120} 121}
121 122
122static void dump_instr(struct pt_regs *regs) 123static void dump_instr(const char *lvl, struct pt_regs *regs)
123{ 124{
124 unsigned long addr = instruction_pointer(regs); 125 unsigned long addr = instruction_pointer(regs);
125 const int thumb = thumb_mode(regs); 126 const int thumb = thumb_mode(regs);
@@ -152,7 +153,7 @@ static void dump_instr(struct pt_regs *regs)
152 break; 153 break;
153 } 154 }
154 } 155 }
155 printk("Code: %s\n", str); 156 printk("%sCode: %s\n", lvl, str);
156 157
157 set_fs(fs); 158 set_fs(fs);
158} 159}
@@ -228,18 +229,18 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
228 struct task_struct *tsk = thread->task; 229 struct task_struct *tsk = thread->task;
229 static int die_counter; 230 static int die_counter;
230 231
231 printk("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", 232 printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
232 str, err, ++die_counter); 233 str, err, ++die_counter);
233 print_modules(); 234 print_modules();
234 __show_regs(regs); 235 __show_regs(regs);
235 printk("Process %s (pid: %d, stack limit = 0x%p)\n", 236 printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n",
236 tsk->comm, task_pid_nr(tsk), thread + 1); 237 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1);
237 238
238 if (!user_mode(regs) || in_interrupt()) { 239 if (!user_mode(regs) || in_interrupt()) {
239 dump_mem("Stack: ", regs->ARM_sp, 240 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp,
240 THREAD_SIZE + (unsigned long)task_stack_page(tsk)); 241 THREAD_SIZE + (unsigned long)task_stack_page(tsk));
241 dump_backtrace(regs, tsk); 242 dump_backtrace(regs, tsk);
242 dump_instr(regs); 243 dump_instr(KERN_EMERG, regs);
243 } 244 }
244} 245}
245 246
@@ -353,7 +354,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
353 if (user_debug & UDBG_UNDEFINED) { 354 if (user_debug & UDBG_UNDEFINED) {
354 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", 355 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
355 current->comm, task_pid_nr(current), pc); 356 current->comm, task_pid_nr(current), pc);
356 dump_instr(regs); 357 dump_instr(KERN_INFO, regs);
357 } 358 }
358#endif 359#endif
359 360
@@ -404,7 +405,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
404 if (user_debug & UDBG_SYSCALL) { 405 if (user_debug & UDBG_SYSCALL) {
405 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", 406 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
406 task_pid_nr(current), current->comm, n); 407 task_pid_nr(current), current->comm, n);
407 dump_instr(regs); 408 dump_instr(KERN_ERR, regs);
408 } 409 }
409#endif 410#endif
410 411
@@ -583,7 +584,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
583 if (user_debug & UDBG_SYSCALL) { 584 if (user_debug & UDBG_SYSCALL) {
584 printk("[%d] %s: arm syscall %d\n", 585 printk("[%d] %s: arm syscall %d\n",
585 task_pid_nr(current), current->comm, no); 586 task_pid_nr(current), current->comm, no);
586 dump_instr(regs); 587 dump_instr("", regs);
587 if (user_mode(regs)) { 588 if (user_mode(regs)) {
588 __show_regs(regs); 589 __show_regs(regs);
589 c_backtrace(regs->ARM_fp, processor_mode(regs)); 590 c_backtrace(regs->ARM_fp, processor_mode(regs));
@@ -660,7 +661,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
660 if (user_debug & UDBG_BADABORT) { 661 if (user_debug & UDBG_BADABORT) {
661 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", 662 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
662 task_pid_nr(current), current->comm, code, instr); 663 task_pid_nr(current), current->comm, code, instr);
663 dump_instr(regs); 664 dump_instr(KERN_ERR, regs);
664 show_pte(current->mm, addr); 665 show_pte(current->mm, addr);
665 } 666 }
666#endif 667#endif