Skip to content

Commit 658b0f9

Browse files
mopsfeldermpe
authored andcommitted
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: Murilo Opsfelder Araujo <muriloo@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 8e4bdc6 commit 658b0f9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

arch/powerpc/kernel/traps.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,26 +301,32 @@ void user_single_step_siginfo(struct task_struct *tsk,
301301
info->si_addr = (void __user *)regs->nip;
302302
}
303303

304+
static void show_signal_msg(int signr, struct pt_regs *regs, int code,
305+
unsigned long addr)
306+
{
307+
const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \
308+
"at %08lx nip %08lx lr %08lx code %x\n";
309+
const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
310+
"at %016lx nip %016lx lr %016lx code %x\n";
311+
312+
if (show_unhandled_signals && unhandled_signal(current, signr)) {
313+
printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
314+
current->comm, current->pid, signr,
315+
addr, regs->nip, regs->link, code);
316+
}
317+
}
304318

305319
void _exception_pkey(int signr, struct pt_regs *regs, int code,
306-
unsigned long addr, int key)
320+
unsigned long addr, int key)
307321
{
308322
siginfo_t info;
309-
const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \
310-
"at %08lx nip %08lx lr %08lx code %x\n";
311-
const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
312-
"at %016lx nip %016lx lr %016lx code %x\n";
313323

314324
if (!user_mode(regs)) {
315325
die("Exception in kernel mode", regs, signr);
316326
return;
317327
}
318328

319-
if (show_unhandled_signals && unhandled_signal(current, signr)) {
320-
printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
321-
current->comm, current->pid, signr,
322-
addr, regs->nip, regs->link, code);
323-
}
329+
show_signal_msg(signr, regs, code, addr);
324330

325331
if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))
326332
local_irq_enable();

0 commit comments

Comments
 (0)