traps.c (a02001086bbfb4da35d1228bebc2f1b442db455f) | traps.c (4ed89f2228061422ce5f62545fd0b6f6648bd2cc) |
---|---|
1/* 2 * linux/arch/arm/kernel/traps.c 3 * 4 * Copyright (C) 1995-2009 Russell King 5 * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 184 unchanged lines hidden (view full) --- 193 fp = thread_saved_fp(tsk); 194 mode = 0x10; 195 } else { 196 asm("mov %0, fp" : "=r" (fp) : : "cc"); 197 mode = 0x10; 198 } 199 200 if (!fp) { | 1/* 2 * linux/arch/arm/kernel/traps.c 3 * 4 * Copyright (C) 1995-2009 Russell King 5 * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 184 unchanged lines hidden (view full) --- 193 fp = thread_saved_fp(tsk); 194 mode = 0x10; 195 } else { 196 asm("mov %0, fp" : "=r" (fp) : : "cc"); 197 mode = 0x10; 198 } 199 200 if (!fp) { |
201 printk("no frame pointer"); | 201 pr_cont("no frame pointer"); |
202 ok = 0; 203 } else if (verify_stack(fp)) { | 202 ok = 0; 203 } else if (verify_stack(fp)) { |
204 printk("invalid frame pointer 0x%08x", fp); | 204 pr_cont("invalid frame pointer 0x%08x", fp); |
205 ok = 0; 206 } else if (fp < (unsigned long)end_of_stack(tsk)) | 205 ok = 0; 206 } else if (fp < (unsigned long)end_of_stack(tsk)) |
207 printk("frame pointer underflow"); 208 printk("\n"); | 207 pr_cont("frame pointer underflow"); 208 pr_cont("\n"); |
209 210 if (ok) 211 c_backtrace(fp, mode); 212} 213#endif 214 215void show_stack(struct task_struct *tsk, unsigned long *sp) 216{ --- 18 unchanged lines hidden (view full) --- 235#endif 236 237static int __die(const char *str, int err, struct pt_regs *regs) 238{ 239 struct task_struct *tsk = current; 240 static int die_counter; 241 int ret; 242 | 209 210 if (ok) 211 c_backtrace(fp, mode); 212} 213#endif 214 215void show_stack(struct task_struct *tsk, unsigned long *sp) 216{ --- 18 unchanged lines hidden (view full) --- 235#endif 236 237static int __die(const char *str, int err, struct pt_regs *regs) 238{ 239 struct task_struct *tsk = current; 240 static int die_counter; 241 int ret; 242 |
243 printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP 244 S_ISA "\n", str, err, ++die_counter); | 243 pr_emerg("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP S_ISA "\n", 244 str, err, ++die_counter); |
245 246 /* trap and error numbers are mostly meaningless on ARM */ 247 ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); 248 if (ret == NOTIFY_STOP) 249 return 1; 250 251 print_modules(); 252 __show_regs(regs); | 245 246 /* trap and error numbers are mostly meaningless on ARM */ 247 ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); 248 if (ret == NOTIFY_STOP) 249 return 1; 250 251 print_modules(); 252 __show_regs(regs); |
253 printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n", 254 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), end_of_stack(tsk)); | 253 pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n", 254 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), end_of_stack(tsk)); |
255 256 if (!user_mode(regs) || in_interrupt()) { 257 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp, 258 THREAD_SIZE + (unsigned long)task_stack_page(tsk)); 259 dump_backtrace(regs, tsk); 260 dump_instr(KERN_EMERG, regs); 261 } 262 --- 178 unchanged lines hidden (view full) --- 441 } 442 443 if (call_undef_hook(regs, instr) == 0) 444 return; 445 446die_sig: 447#ifdef CONFIG_DEBUG_USER 448 if (user_debug & UDBG_UNDEFINED) { | 255 256 if (!user_mode(regs) || in_interrupt()) { 257 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp, 258 THREAD_SIZE + (unsigned long)task_stack_page(tsk)); 259 dump_backtrace(regs, tsk); 260 dump_instr(KERN_EMERG, regs); 261 } 262 --- 178 unchanged lines hidden (view full) --- 441 } 442 443 if (call_undef_hook(regs, instr) == 0) 444 return; 445 446die_sig: 447#ifdef CONFIG_DEBUG_USER 448 if (user_debug & UDBG_UNDEFINED) { |
449 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", | 449 pr_info("%s (%d): undefined instruction: pc=%p\n", |
450 current->comm, task_pid_nr(current), pc); 451 __show_regs(regs); 452 dump_instr(KERN_INFO, regs); 453 } 454#endif 455 456 info.si_signo = SIGILL; 457 info.si_errno = 0; --- 33 unchanged lines hidden (view full) --- 491 * these, then it's extremely serious, and could mean you have buggy hardware. 492 * It never returns, and never tries to sync. We hope that we can at least 493 * dump out some state information... 494 */ 495asmlinkage void bad_mode(struct pt_regs *regs, int reason) 496{ 497 console_verbose(); 498 | 450 current->comm, task_pid_nr(current), pc); 451 __show_regs(regs); 452 dump_instr(KERN_INFO, regs); 453 } 454#endif 455 456 info.si_signo = SIGILL; 457 info.si_errno = 0; --- 33 unchanged lines hidden (view full) --- 491 * these, then it's extremely serious, and could mean you have buggy hardware. 492 * It never returns, and never tries to sync. We hope that we can at least 493 * dump out some state information... 494 */ 495asmlinkage void bad_mode(struct pt_regs *regs, int reason) 496{ 497 console_verbose(); 498 |
499 printk(KERN_CRIT "Bad mode in %s handler detected\n", handler[reason]); | 499 pr_crit("Bad mode in %s handler detected\n", handler[reason]); |
500 501 die("Oops - bad mode", regs, 0); 502 local_irq_disable(); 503 panic("bad mode"); 504} 505 506static int bad_syscall(int n, struct pt_regs *regs) 507{ 508 struct thread_info *thread = current_thread_info(); 509 siginfo_t info; 510 511 if ((current->personality & PER_MASK) != PER_LINUX && 512 thread->exec_domain->handler) { 513 thread->exec_domain->handler(n, regs); 514 return regs->ARM_r0; 515 } 516 517#ifdef CONFIG_DEBUG_USER 518 if (user_debug & UDBG_SYSCALL) { | 500 501 die("Oops - bad mode", regs, 0); 502 local_irq_disable(); 503 panic("bad mode"); 504} 505 506static int bad_syscall(int n, struct pt_regs *regs) 507{ 508 struct thread_info *thread = current_thread_info(); 509 siginfo_t info; 510 511 if ((current->personality & PER_MASK) != PER_LINUX && 512 thread->exec_domain->handler) { 513 thread->exec_domain->handler(n, regs); 514 return regs->ARM_r0; 515 } 516 517#ifdef CONFIG_DEBUG_USER 518 if (user_debug & UDBG_SYSCALL) { |
519 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", | 519 pr_err("[%d] %s: obsolete system call %08x.\n", |
520 task_pid_nr(current), current->comm, n); 521 dump_instr(KERN_ERR, regs); 522 } 523#endif 524 525 info.si_signo = SIGILL; 526 info.si_errno = 0; 527 info.si_code = ILL_ILLTRP; --- 188 unchanged lines hidden (view full) --- 716 break; 717 } 718#ifdef CONFIG_DEBUG_USER 719 /* 720 * experience shows that these seem to indicate that 721 * something catastrophic has happened 722 */ 723 if (user_debug & UDBG_SYSCALL) { | 520 task_pid_nr(current), current->comm, n); 521 dump_instr(KERN_ERR, regs); 522 } 523#endif 524 525 info.si_signo = SIGILL; 526 info.si_errno = 0; 527 info.si_code = ILL_ILLTRP; --- 188 unchanged lines hidden (view full) --- 716 break; 717 } 718#ifdef CONFIG_DEBUG_USER 719 /* 720 * experience shows that these seem to indicate that 721 * something catastrophic has happened 722 */ 723 if (user_debug & UDBG_SYSCALL) { |
724 printk("[%d] %s: arm syscall %d\n", | 724 pr_err("[%d] %s: arm syscall %d\n", |
725 task_pid_nr(current), current->comm, no); 726 dump_instr("", regs); 727 if (user_mode(regs)) { 728 __show_regs(regs); 729 c_backtrace(frame_pointer(regs), processor_mode(regs)); 730 } 731 } 732#endif --- 42 unchanged lines hidden (view full) --- 775} 776 777late_initcall(arm_mrc_hook_init); 778 779#endif 780 781void __bad_xchg(volatile void *ptr, int size) 782{ | 725 task_pid_nr(current), current->comm, no); 726 dump_instr("", regs); 727 if (user_mode(regs)) { 728 __show_regs(regs); 729 c_backtrace(frame_pointer(regs), processor_mode(regs)); 730 } 731 } 732#endif --- 42 unchanged lines hidden (view full) --- 775} 776 777late_initcall(arm_mrc_hook_init); 778 779#endif 780 781void __bad_xchg(volatile void *ptr, int size) 782{ |
783 printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n", 784 __builtin_return_address(0), ptr, size); | 783 pr_err("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n", 784 __builtin_return_address(0), ptr, size); |
785 BUG(); 786} 787EXPORT_SYMBOL(__bad_xchg); 788 789/* 790 * A data abort trap was taken, but we did not handle the instruction. 791 * Try to abort the user program, or panic if it was the kernel. 792 */ 793asmlinkage void 794baddataabort(int code, unsigned long instr, struct pt_regs *regs) 795{ 796 unsigned long addr = instruction_pointer(regs); 797 siginfo_t info; 798 799#ifdef CONFIG_DEBUG_USER 800 if (user_debug & UDBG_BADABORT) { | 785 BUG(); 786} 787EXPORT_SYMBOL(__bad_xchg); 788 789/* 790 * A data abort trap was taken, but we did not handle the instruction. 791 * Try to abort the user program, or panic if it was the kernel. 792 */ 793asmlinkage void 794baddataabort(int code, unsigned long instr, struct pt_regs *regs) 795{ 796 unsigned long addr = instruction_pointer(regs); 797 siginfo_t info; 798 799#ifdef CONFIG_DEBUG_USER 800 if (user_debug & UDBG_BADABORT) { |
801 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", 802 task_pid_nr(current), current->comm, code, instr); | 801 pr_err("[%d] %s: bad data abort: code %d instr 0x%08lx\n", 802 task_pid_nr(current), current->comm, code, instr); |
803 dump_instr(KERN_ERR, regs); 804 show_pte(current->mm, addr); 805 } 806#endif 807 808 info.si_signo = SIGILL; 809 info.si_errno = 0; 810 info.si_code = ILL_ILLOPC; 811 info.si_addr = (void __user *)addr; 812 813 arm_notify_die("unknown data abort code", regs, &info, instr, 0); 814} 815 816void __readwrite_bug(const char *fn) 817{ | 803 dump_instr(KERN_ERR, regs); 804 show_pte(current->mm, addr); 805 } 806#endif 807 808 info.si_signo = SIGILL; 809 info.si_errno = 0; 810 info.si_code = ILL_ILLOPC; 811 info.si_addr = (void __user *)addr; 812 813 arm_notify_die("unknown data abort code", regs, &info, instr, 0); 814} 815 816void __readwrite_bug(const char *fn) 817{ |
818 printk("%s called, but not implemented\n", fn); | 818 pr_err("%s called, but not implemented\n", fn); |
819 BUG(); 820} 821EXPORT_SYMBOL(__readwrite_bug); 822 823void __pte_error(const char *file, int line, pte_t pte) 824{ | 819 BUG(); 820} 821EXPORT_SYMBOL(__readwrite_bug); 822 823void __pte_error(const char *file, int line, pte_t pte) 824{ |
825 printk("%s:%d: bad pte %08llx.\n", file, line, (long long)pte_val(pte)); | 825 pr_err("%s:%d: bad pte %08llx.\n", file, line, (long long)pte_val(pte)); |
826} 827 828void __pmd_error(const char *file, int line, pmd_t pmd) 829{ | 826} 827 828void __pmd_error(const char *file, int line, pmd_t pmd) 829{ |
830 printk("%s:%d: bad pmd %08llx.\n", file, line, (long long)pmd_val(pmd)); | 830 pr_err("%s:%d: bad pmd %08llx.\n", file, line, (long long)pmd_val(pmd)); |
831} 832 833void __pgd_error(const char *file, int line, pgd_t pgd) 834{ | 831} 832 833void __pgd_error(const char *file, int line, pgd_t pgd) 834{ |
835 printk("%s:%d: bad pgd %08llx.\n", file, line, (long long)pgd_val(pgd)); | 835 pr_err("%s:%d: bad pgd %08llx.\n", file, line, (long long)pgd_val(pgd)); |
836} 837 838asmlinkage void __div0(void) 839{ | 836} 837 838asmlinkage void __div0(void) 839{ |
840 printk("Division by zero in kernel.\n"); | 840 pr_err("Division by zero in kernel.\n"); |
841 dump_stack(); 842} 843EXPORT_SYMBOL(__div0); 844 845void abort(void) 846{ 847 BUG(); 848 --- 70 unchanged lines hidden --- | 841 dump_stack(); 842} 843EXPORT_SYMBOL(__div0); 844 845void abort(void) 846{ 847 BUG(); 848 --- 70 unchanged lines hidden --- |