3 #include <linux/types.h>
4 #include <linux/kdebug.h>
5 #include <asm/system.h>
8 static void handle_BUG(struct pt_regs *regs)
10 enum bug_trap_type tt;
11 tt = report_bug(regs->pc, regs);
12 if (tt == BUG_TRAP_TYPE_WARN) {
13 regs->pc += instruction_size(regs->pc);
17 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff);
20 int is_valid_bugaddr(unsigned long addr)
22 return addr >= PAGE_OFFSET;
27 * Generic trap handler.
29 BUILD_TRAP_HANDLER(debug)
34 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
36 if (notify_die(DIE_TRAP, "debug trap", regs, 0, vec & 0xff,
37 SIGTRAP) == NOTIFY_STOP)
40 force_sig(SIGTRAP, current);
44 * Special handler for BUG() traps.
46 BUILD_TRAP_HANDLER(bug)
51 regs->pc -= instruction_size(ctrl_inw(regs->pc - 4));
53 if (notify_die(DIE_TRAP, "bug trap", regs, 0, TRAPA_BUG_OPCODE & 0xff,
54 SIGTRAP) == NOTIFY_STOP)
58 if (__kernel_text_address(instruction_pointer(regs))) {
59 opcode_t insn = *(opcode_t *)instruction_pointer(regs);
60 if (insn == TRAPA_BUG_OPCODE)
65 force_sig(SIGTRAP, current);