aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/traps.c')
-rw-r--r--arch/sh/kernel/traps.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index a87e58a9e38..72246bc0688 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -6,9 +6,80 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <linux/hardirq.h> 8#include <linux/hardirq.h>
9#include <linux/kernel.h>
10#include <linux/kexec.h>
11#include <linux/module.h>
9#include <asm/unwinder.h> 12#include <asm/unwinder.h>
10#include <asm/traps.h> 13#include <asm/traps.h>
11 14
15static DEFINE_SPINLOCK(die_lock);
16
17void die(const char *str, struct pt_regs *regs, long err)
18{
19 static int die_counter;
20
21 oops_enter();
22
23 spin_lock_irq(&die_lock);
24 console_verbose();
25 bust_spinlocks(1);
26
27 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
28 print_modules();
29 show_regs(regs);
30
31 printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
32 task_pid_nr(current), task_stack_page(current) + 1);
33
34 if (!user_mode(regs) || in_interrupt())
35 dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
36 (unsigned long)task_stack_page(current));
37
38 notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV);
39
40 bust_spinlocks(0);
41 add_taint(TAINT_DIE);
42 spin_unlock_irq(&die_lock);
43 oops_exit();
44
45 if (kexec_should_crash(current))
46 crash_kexec(regs);
47
48 if (in_interrupt())
49 panic("Fatal exception in interrupt");
50
51 if (panic_on_oops)
52 panic("Fatal exception");
53
54 do_exit(SIGSEGV);
55}
56
57void die_if_kernel(const char *str, struct pt_regs *regs, long err)
58{
59 if (!user_mode(regs))
60 die(str, regs, err);
61}
62
63/*
64 * try and fix up kernelspace address errors
65 * - userspace errors just cause EFAULT to be returned, resulting in SEGV
66 * - kernel/userspace interfaces cause a jump to an appropriate handler
67 * - other kernel errors are bad
68 */
69void die_if_no_fixup(const char *str, struct pt_regs *regs, long err)
70{
71 if (!user_mode(regs)) {
72 const struct exception_table_entry *fixup;
73 fixup = search_exception_tables(regs->pc);
74 if (fixup) {
75 regs->pc = fixup->fixup;
76 return;
77 }
78
79 die(str, regs, err);
80 }
81}
82
12#ifdef CONFIG_GENERIC_BUG 83#ifdef CONFIG_GENERIC_BUG
13static void handle_BUG(struct pt_regs *regs) 84static void handle_BUG(struct pt_regs *regs)
14{ 85{