#define module_find_bug(x) NULL
#endif
-static struct bug_entry *find_bug(unsigned long bugaddr)
+struct bug_entry *find_bug(unsigned long bugaddr)
{
struct bug_entry *bug;
return module_find_bug(bugaddr);
}
-int
+static int
check_bug_trap(struct pt_regs *regs)
{
struct bug_entry *bug;
#include <asm/cputable.h>
#include <asm/rtas.h>
#include <asm/sstep.h>
+#include <asm/bug.h>
#include "nonstdio.h"
#include "privinst.h"
scannl();
}
+static void print_bug_trap(struct pt_regs *regs)
+{
+ struct bug_entry *bug;
+ unsigned long addr;
+
+ if (regs->msr & MSR_PR)
+ return; /* not in kernel */
+ addr = regs->nip; /* address of trap instruction */
+ if (addr < PAGE_OFFSET)
+ return;
+ bug = find_bug(regs->nip);
+ if (bug == NULL)
+ return;
+ if (bug->line & BUG_WARNING_TRAP)
+ return;
+
+ printf("kernel BUG in %s at %s:%d!\n",
+ bug->function, bug->file, (unsigned int)bug->line);
+}
+
void excprint(struct pt_regs *fp)
{
unsigned long trap;
printf(" pid = %ld, comm = %s\n",
current->pid, current->comm);
}
+
+ if (trap == 0x700)
+ print_bug_trap(fp);
}
void prregs(struct pt_regs *fp)
const char *function;
};
+struct bug_entry *find_bug(unsigned long bugaddr);
+
/*
* If this bit is set in the line number it means that the trap
* is for WARN_ON rather than BUG or BUG_ON.