Commit 658b0f92 authored by Murilo Opsfelder Araujo's avatar Murilo Opsfelder Araujo Committed by Michael Ellerman

powerpc/traps: Print unhandled signals in a separate function

Isolate the logic of printing unhandled signals out of _exception_pkey().
No functional change, only code rearrangement.
Signed-off-by: default avatarMurilo Opsfelder Araujo <muriloo@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 8e4bdc69
...@@ -301,26 +301,32 @@ void user_single_step_siginfo(struct task_struct *tsk, ...@@ -301,26 +301,32 @@ void user_single_step_siginfo(struct task_struct *tsk,
info->si_addr = (void __user *)regs->nip; info->si_addr = (void __user *)regs->nip;
} }
static void show_signal_msg(int signr, struct pt_regs *regs, int code,
unsigned long addr)
{
const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \
"at %08lx nip %08lx lr %08lx code %x\n";
const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
"at %016lx nip %016lx lr %016lx code %x\n";
if (show_unhandled_signals && unhandled_signal(current, signr)) {
printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
current->comm, current->pid, signr,
addr, regs->nip, regs->link, code);
}
}
void _exception_pkey(int signr, struct pt_regs *regs, int code, void _exception_pkey(int signr, struct pt_regs *regs, int code,
unsigned long addr, int key) unsigned long addr, int key)
{ {
siginfo_t info; siginfo_t info;
const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \
"at %08lx nip %08lx lr %08lx code %x\n";
const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
"at %016lx nip %016lx lr %016lx code %x\n";
if (!user_mode(regs)) { if (!user_mode(regs)) {
die("Exception in kernel mode", regs, signr); die("Exception in kernel mode", regs, signr);
return; return;
} }
if (show_unhandled_signals && unhandled_signal(current, signr)) { show_signal_msg(signr, regs, code, addr);
printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
current->comm, current->pid, signr,
addr, regs->nip, regs->link, code);
}
if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))
local_irq_enable(); local_irq_enable();
......
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