aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/traps.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-05-19 06:32:07 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-05-19 06:32:07 -0400
commit9a33fc217d2248838d52f8ef214b1909073f3eb4 (patch)
tree7f8c76824f1a555b69802f91ed9be00558cbf47a /arch/sh/kernel/traps.c
parentbfd3c7a728fbe642f79f99482a6c01158c675545 (diff)
sh: Make is_valid_bugaddr() more intelligent on nommu.
Currently is_valid_bugaddr() is true for anything >= PAGE_OFFSET, which happens to be 0 on nommu configurations. Make this a bit smarter by just reading in the opcode and comparing it against the trap type that we already know. Follows the logic from avr32. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/traps.c')
-rw-r--r--arch/sh/kernel/traps.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index a3bdc68ef02c..438f1ebcc453 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -4,6 +4,7 @@
4#include <linux/kdebug.h> 4#include <linux/kdebug.h>
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 <asm/system.h> 8#include <asm/system.h>
8 9
9#ifdef CONFIG_BUG 10#ifdef CONFIG_BUG
@@ -21,7 +22,14 @@ static void handle_BUG(struct pt_regs *regs)
21 22
22int is_valid_bugaddr(unsigned long addr) 23int is_valid_bugaddr(unsigned long addr)
23{ 24{
24 return addr >= PAGE_OFFSET; 25 unsigned short opcode;
26
27 if (addr < PAGE_OFFSET)
28 return 0;
29 if (probe_kernel_address((u16 *)addr, opcode))
30 return 0;
31
32 return opcode == TRAPA_BUG_OPCODE;
25} 33}
26#endif 34#endif
27 35