diff options
author | Paul Mundt | 2008-05-19 19:32:07 +0900 |
---|---|---|
committer | Paul Mundt | 2008-05-19 19:32:07 +0900 |
commit | 9a33fc217d2248838d52f8ef214b1909073f3eb4 (patch) | |
tree | 7f8c76824f1a555b69802f91ed9be00558cbf47a | |
parent | bfd3c7a728fbe642f79f99482a6c01158c675545 (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>
-rw-r--r-- | arch/sh/kernel/traps.c | 10 |
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 @@ #include <linux/kdebug.h> #include <linux/signal.h> #include <linux/sched.h> +#include <linux/uaccess.h> #include <asm/system.h> #ifdef CONFIG_BUG @@ -21,7 +22,14 @@ static void handle_BUG(struct pt_regs *regs) int is_valid_bugaddr(unsigned long addr) { - return addr >= PAGE_OFFSET; + unsigned short opcode; + + if (addr < PAGE_OFFSET) + return 0; + if (probe_kernel_address((u16 *)addr, opcode)) + return 0; + + return opcode == TRAPA_BUG_OPCODE; } #endif |