aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-09-01 00:54:14 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-09-01 00:54:14 -0400
commitac6a0cf6716bb46813d0161024c66c2af66e53d1 (patch)
treec7f53b1a04c590032c022549f3186fb9b04f8358 /arch/sh/kernel/traps.c
parente76a0136a3cf1859fbc07f122e42293d22229558 (diff)
parentce3f7cb96e67d6518c7fc7b361a76409c3817d64 (diff)
Merge branch 'master' into sh/smp
Conflicts: arch/sh/mm/cache-sh4.c
Diffstat (limited to 'arch/sh/kernel/traps.c')
-rw-r--r--arch/sh/kernel/traps.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index b3e0067db358..f69bd968fcca 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -5,18 +5,32 @@
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <asm/unwinder.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10#ifdef CONFIG_BUG 11#ifdef CONFIG_BUG
11static void handle_BUG(struct pt_regs *regs) 12void handle_BUG(struct pt_regs *regs)
12{ 13{
14 const struct bug_entry *bug;
15 unsigned long bugaddr = regs->pc;
13 enum bug_trap_type tt; 16 enum bug_trap_type tt;
14 tt = report_bug(regs->pc, regs); 17
18 if (!is_valid_bugaddr(bugaddr))
19 goto invalid;
20
21 bug = find_bug(bugaddr);
22
23 /* Switch unwinders when unwind_stack() is called */
24 if (bug->flags & BUGFLAG_UNWINDER)
25 unwinder_faulted = 1;
26
27 tt = report_bug(bugaddr, regs);
15 if (tt == BUG_TRAP_TYPE_WARN) { 28 if (tt == BUG_TRAP_TYPE_WARN) {
16 regs->pc += instruction_size(regs->pc); 29 regs->pc += instruction_size(bugaddr);
17 return; 30 return;
18 } 31 }
19 32
33invalid:
20 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff); 34 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff);
21} 35}
22 36
@@ -28,8 +42,10 @@ int is_valid_bugaddr(unsigned long addr)
28 return 0; 42 return 0;
29 if (probe_kernel_address((insn_size_t *)addr, opcode)) 43 if (probe_kernel_address((insn_size_t *)addr, opcode))
30 return 0; 44 return 0;
45 if (opcode == TRAPA_BUG_OPCODE)
46 return 1;
31 47
32 return opcode == TRAPA_BUG_OPCODE; 48 return 0;
33} 49}
34#endif 50#endif
35 51