powerpc: Print instruction when logging unhandled exceptions
Michael Ellerman
mpe at ellerman.id.au
Thu Oct 2 17:14:46 EST 2014
On Thu, 2014-25-09 at 05:05:45 UTC, Anton Blanchard wrote:
> It is often useful to see the instruction that caused an unhandled
> exception.
>
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index 0dc43f9..27e30c8 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -252,9 +252,18 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
> }
>
> if (show_unhandled_signals && unhandled_signal(current, signr)) {
> + u32 __user *nia = (u32 __user *)regs->nip;
> + u32 insn = 0;
> +
> + pagefault_disable();
> + if (!access_ok(VERIFY_READ, nia, sizeof(*nia)) ||
> + __get_user_inatomic(insn, nia))
> + insn = 0xffffffffUL;
> + pagefault_enable();
Can you add a comment explaining that interesting construct?
Looks like we do something similar in the perf callchain code, though without
the access_ok() check?
cheers
More information about the Linuxppc-dev
mailing list