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

From
Michael Ellerman <mpe@ellerman.id.au>
Date
2018-03-26 09:22:22
Reply to
Paul Mackerras, 2017-09-04
Paul Mackerras [off-list ref] writes:
quoted hunk ↗ jump to hunk
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)
quoted hunk ↗ jump to hunk
 			regs->dar =3D ea;
 			break;
 		}
-		if (size < 16)
-			regs->gpr[op->reg] =3D val;
+		if (size < 16) {
+			if (unlikely(cross_endian))
+				val =3D byterev_8(val);
This doesn't build on 32-bit (pmac32_defconfig):

  arch/powerpc/lib/sstep.c: In function =E2=80=98emulate_loadstore=E2=80=99:
  arch/powerpc/lib/sstep.c:2789:11: error: implicit declaration of function=
 =E2=80=98byterev_8=E2=80=99;did you mean =E2=80=98byterev_4=E2=80=99? [-We=
rror=3Dimplicit-function-declaration]
       val =3D byterev_8(val);
             ^~~~~~~~~
             byterev_4

cheers
Thread (2 messages) 2 messages, 2 authors, 2018-03-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help