Commit 0a862485 authored by Helge Deller's avatar Helge Deller

parisc: Show trap name in kernel crash

Show the real trap name when the kernel crashes.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent e3b6a028
...@@ -11,6 +11,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs, ...@@ -11,6 +11,7 @@ void parisc_terminate(char *msg, struct pt_regs *regs,
void die_if_kernel(char *str, struct pt_regs *regs, long err); void die_if_kernel(char *str, struct pt_regs *regs, long err);
/* mm/fault.c */ /* mm/fault.c */
const char *trap_name(unsigned long code);
void do_page_fault(struct pt_regs *regs, unsigned long code, void do_page_fault(struct pt_regs *regs, unsigned long code,
unsigned long address); unsigned long address);
#endif #endif
......
...@@ -458,8 +458,8 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o ...@@ -458,8 +458,8 @@ void parisc_terminate(char *msg, struct pt_regs *regs, int code, unsigned long o
} }
printk("\n"); printk("\n");
printk(KERN_CRIT "%s: Code=%d regs=%p (Addr=" RFMT ")\n", pr_crit("%s: Code=%d (%s) regs=%p (Addr=" RFMT ")\n",
msg, code, regs, offset); msg, code, trap_name(code), regs, offset);
show_regs(regs); show_regs(regs);
spin_unlock(&terminate_lock); spin_unlock(&terminate_lock);
......
...@@ -204,6 +204,16 @@ static const char * const trap_description[] = { ...@@ -204,6 +204,16 @@ static const char * const trap_description[] = {
[28] "Unaligned data reference trap", [28] "Unaligned data reference trap",
}; };
const char *trap_name(unsigned long code)
{
const char *t = NULL;
if (code < ARRAY_SIZE(trap_description))
t = trap_description[code];
return t ? t : "Unknown trap";
}
/* /*
* Print out info about fatal segfaults, if the show_unhandled_signals * Print out info about fatal segfaults, if the show_unhandled_signals
* sysctl is set: * sysctl is set:
...@@ -213,8 +223,6 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, ...@@ -213,8 +223,6 @@ show_signal_msg(struct pt_regs *regs, unsigned long code,
unsigned long address, struct task_struct *tsk, unsigned long address, struct task_struct *tsk,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
const char *trap_name = NULL;
if (!unhandled_signal(tsk, SIGSEGV)) if (!unhandled_signal(tsk, SIGSEGV))
return; return;
...@@ -226,10 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code, ...@@ -226,10 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code,
tsk->comm, code, address); tsk->comm, code, address);
print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
if (code < ARRAY_SIZE(trap_description)) pr_cont(" trap #%lu: %s%c", code, trap_name(code),
trap_name = trap_description[code];
pr_warn(KERN_CONT " trap #%lu: %s%c", code,
trap_name ? trap_name : "unknown",
vma ? ',':'\n'); vma ? ',':'\n');
if (vma) if (vma)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment