diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-06-07 17:18:25 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-13 07:20:07 -0400 |
commit | 70f12567ac9aca9c2f242ae060d7de245904889e (patch) | |
tree | 6838a6886fbe0c932f50cf5a059ffd798c43ca1c /arch/blackfin/kernel/traps.c | |
parent | 67834fa93d7a4fac9069a07e739110d3916d8cd4 (diff) |
Blackfin: add support for GENERIC_BUG
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel/traps.c')
-rw-r--r-- | arch/blackfin/kernel/traps.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index aa76dfb0226..2405f193224 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 27 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/bug.h> | ||
30 | #include <linux/uaccess.h> | 31 | #include <linux/uaccess.h> |
31 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
32 | #include <linux/module.h> | 33 | #include <linux/module.h> |
@@ -381,6 +382,23 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
381 | /* 0x20 - Reserved, Caught by default */ | 382 | /* 0x20 - Reserved, Caught by default */ |
382 | /* 0x21 - Undefined Instruction, handled here */ | 383 | /* 0x21 - Undefined Instruction, handled here */ |
383 | case VEC_UNDEF_I: | 384 | case VEC_UNDEF_I: |
385 | #ifdef CONFIG_BUG | ||
386 | if (kernel_mode_regs(fp)) { | ||
387 | switch (report_bug(fp->pc, fp)) { | ||
388 | case BUG_TRAP_TYPE_NONE: | ||
389 | break; | ||
390 | case BUG_TRAP_TYPE_WARN: | ||
391 | dump_bfin_trace_buffer(); | ||
392 | fp->pc += 2; | ||
393 | goto traps_done; | ||
394 | case BUG_TRAP_TYPE_BUG: | ||
395 | /* call to panic() will dump trace, and it is | ||
396 | * off at this point, so it won't be clobbered | ||
397 | */ | ||
398 | panic("BUG()"); | ||
399 | } | ||
400 | } | ||
401 | #endif | ||
384 | info.si_code = ILL_ILLOPC; | 402 | info.si_code = ILL_ILLOPC; |
385 | sig = SIGILL; | 403 | sig = SIGILL; |
386 | verbose_printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); | 404 | verbose_printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); |
@@ -792,6 +810,18 @@ void dump_bfin_trace_buffer(void) | |||
792 | } | 810 | } |
793 | EXPORT_SYMBOL(dump_bfin_trace_buffer); | 811 | EXPORT_SYMBOL(dump_bfin_trace_buffer); |
794 | 812 | ||
813 | #ifdef CONFIG_BUG | ||
814 | int is_valid_bugaddr(unsigned long addr) | ||
815 | { | ||
816 | unsigned short opcode; | ||
817 | |||
818 | if (!get_instruction(&opcode, (unsigned short *)addr)) | ||
819 | return 0; | ||
820 | |||
821 | return opcode == BFIN_BUG_OPCODE; | ||
822 | } | ||
823 | #endif | ||
824 | |||
795 | /* | 825 | /* |
796 | * Checks to see if the address pointed to is either a | 826 | * Checks to see if the address pointed to is either a |
797 | * 16-bit CALL instruction, or a 32-bit CALL instruction | 827 | * 16-bit CALL instruction, or a 32-bit CALL instruction |