docbook: fix fatal rapidio yet again (and more to come)
[linux/fpc-iii.git] / arch / sh / kernel / traps.c
bloba3bdc68ef02c75adcdbfaca4b5d61c3218c60521
1 #include <linux/bug.h>
2 #include <linux/io.h>
3 #include <linux/types.h>
4 #include <linux/kdebug.h>
5 #include <linux/signal.h>
6 #include <linux/sched.h>
7 #include <asm/system.h>
9 #ifdef CONFIG_BUG
10 static void handle_BUG(struct pt_regs *regs)
12 enum bug_trap_type tt;
13 tt = report_bug(regs->pc, regs);
14 if (tt == BUG_TRAP_TYPE_WARN) {
15 regs->pc += instruction_size(regs->pc);
16 return;
19 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff);
22 int is_valid_bugaddr(unsigned long addr)
24 return addr >= PAGE_OFFSET;
26 #endif
29 * Generic trap handler.
31 BUILD_TRAP_HANDLER(debug)
33 TRAP_HANDLER_DECL;
35 /* Rewind */
36 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
38 if (notify_die(DIE_TRAP, "debug trap", regs, 0, vec & 0xff,
39 SIGTRAP) == NOTIFY_STOP)
40 return;
42 force_sig(SIGTRAP, current);
46 * Special handler for BUG() traps.
48 BUILD_TRAP_HANDLER(bug)
50 TRAP_HANDLER_DECL;
52 /* Rewind */
53 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
55 if (notify_die(DIE_TRAP, "bug trap", regs, 0, TRAPA_BUG_OPCODE & 0xff,
56 SIGTRAP) == NOTIFY_STOP)
57 return;
59 #ifdef CONFIG_BUG
60 if (__kernel_text_address(instruction_pointer(regs))) {
61 opcode_t insn = *(opcode_t *)instruction_pointer(regs);
62 if (insn == TRAPA_BUG_OPCODE)
63 handle_BUG(regs);
65 #endif
67 force_sig(SIGTRAP, current);