Subject: Re: [PATCH 2/2] selftests/powerpc: Test unaligned copy and paste

From: Michael Ellerman <[email-masked]>
Date: Thu, 09 Jun 2016 20:50:03 +1000

On Thu, 2016-06-09 at 17:26 +1000, Michael Neuling wrote:
> On Thu, 2016-06-09 at 16:02 +1000, Chris Smart wrote:
> > Test that an ISA 3.0 compliant machine performing an unaligned copy,
> > copy_first, paste or paste_last is sent a SIGBUS.
> 
> It's probably overkill but we could check in the signal handler that the
> sigbus was on the instruction we actually cared about.  ie something like
> this in the sig handler for copy first.
> 
> static void sig_handler(int signr, siginfo_t *info, void *ucontext)
> {
>         ucontext_t *ctx = ucontext;
>         unsigned int *pc = ctx->uc_mcontext.gp_regs[PT_NIP];
 
You're a hard taskmaster.

For it to build on 32-bit BE, you'll need:

    #if defined(__powerpc64__)
    pc = ctx->uc_mcontext.gp_regs[PT_NIP];
    #else
    pc = ctx->uc_mcontext.uc_regs->gregs[PT_NIP]
    #endif

cheers