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>
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);
19 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff);
22 int is_valid_bugaddr(unsigned long addr)
24 return addr >= PAGE_OFFSET;
29 * Generic trap handler.
31 BUILD_TRAP_HANDLER(debug)
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)
42 force_sig(SIGTRAP, current);
46 * Special handler for BUG() traps.
48 BUILD_TRAP_HANDLER(bug)
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)
60 if (__kernel_text_address(instruction_pointer(regs))) {
61 opcode_t insn = *(opcode_t *)instruction_pointer(regs);
62 if (insn == TRAPA_BUG_OPCODE)
67 force_sig(SIGTRAP, current);