[PATCH] powerpc: Implement cross-endian emulation of larx and stcx instructions

Michael Ellerman mpe at ellerman.id.au
Mon Mar 26 20:22:17 AEDT 2018


Paul Mackerras <paulus at ozlabs.org> writes:
> diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
> index fb9f58b..0590417 100644
> --- a/arch/powerpc/lib/sstep.c
> +++ b/arch/powerpc/lib/sstep.c
> @@ -2755,8 +2761,11 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
>  			regs->dar = ea;
>  			break;
>  		}
> -		if (size < 16)
> -			regs->gpr[op->reg] = val;
> +		if (size < 16) {
> +			if (unlikely(cross_endian))
> +				val = byterev_8(val);

This doesn't build on 32-bit (pmac32_defconfig):

  arch/powerpc/lib/sstep.c: In function ‘emulate_loadstore’:
  arch/powerpc/lib/sstep.c:2789:11: error: implicit declaration of function ‘byterev_8’;did you mean ‘byterev_4’? [-Werror=implicit-function-declaration]
       val = byterev_8(val);
             ^~~~~~~~~
             byterev_4

cheers



More information about the Linuxppc-dev mailing list