Skip to contentSkip to conversation

powerpc: Fix tlbilx opcode

PATCH In review Kumar Gala 2 participants 4 messages Apr 6, 2009 – Apr 7, 2009 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc: Fix tlbilx opcode

The tlbilx opcode was not matching the Power ISA 2.06 arch spec. The old opcode was an early suggested opcode that changed during the 2.06 architecture process.

---
 arch/powerpc/include/asm/ppc-opcode.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/ppc-opcode.h +1 -1
index f4a4db8..640ccbb 100644
@@ -43,7 +43,7 @@
 
 #define PPC_INST_STSWI			0x7c0005aa
 #define PPC_INST_STSWX			0x7c00052a
-#define PPC_INST_TLBILX			0x7c000626
+#define PPC_INST_TLBILX			0x7c000024
 #define PPC_INST_WAIT			0x7c00007c
 
 /* macros to insert fields into opcodes */
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 3 lines · Kumar Gala

The tlbilx opcode was not matching the Power ISA 2.06 arch spec. The old opcode was an early suggested opcode that changed during the 2.06 architecture process.

[snip]

arch/powerpc/include/asm/ppc-opcode.h line 47

Quoted 5 lines

#define PPC_INST_STSWI 0x7c0005aa
#define PPC_INST_STSWX 0x7c00052a

arch/powerpc/include/asm/ppc-opcode.h +1 -1
-#define PPC_INST_TLBILX			0x7c000626
+#define PPC_INST_TLBILX			0x7c000024
 #define PPC_INST_WAIT			0x7c00007c

How do you want to handle the current binutils code that implements tlbilx and its extended mnemonics? Should they be changed to use secondary opcode 18 instead of 787 as per the ISA 2.06 doc?

  {"tlbilx",      X(31,787),      X_MASK,      E500MC,    PPCNONE,        {T, RA0, RB}},
  {"tlbilxlpid",  XTO(31,787,0),  XTO_MASK,    E500MC,    PPCNONE,        {0}},
  {"tlbilxpid",   XTO(31,787,1),  XTO_MASK,    E500MC,    PPCNONE,        {0}},
  {"tlbilxva",    XTO(31,787,3),  XTO_MASK,    E500MC,    PPCNONE,        {RA0, RB}},

If you want to change the tlbilx entry to use 18 rather than 787, let me know whether you want me to make the change or whether you (Edmar?) will handle it.

I'll note the extended mnemonics should be moved before tlbilx so that the disassembler will use them (if appropriate) instead of the base instruction.

Peter

author
#2 lore raw
Quoted 5 lines · Peter Bergner
Quoted 3 lines · Kumar Gala

The tlbilx opcode was not matching the Power ISA 2.06 arch spec. The old opcode was an early suggested opcode that changed during the 2.06 architecture process.

[snip]

Quoted 9 lines
Quoted 5 lines

#define PPC_INST_STSWI 0x7c0005aa
#define PPC_INST_STSWX 0x7c00052a

arch/powerpc/include/asm/ppc-opcode.h +1 -1
-#define PPC_INST_TLBILX			0x7c000626
+#define PPC_INST_TLBILX			0x7c000024

#define PPC_INST_WAIT 0x7c00007c

How do you want to handle the current binutils code that implements tlbilx and its extended mnemonics? Should they be changed to use secondary opcode 18 instead of 787 as per the ISA 2.06 doc?

YES ! :)

Quoted 9 lines

{"tlbilx", X(31,787), X_MASK, E500MC,
PPCNONE, {T, RA0, RB}},
{"tlbilxlpid", XTO(31,787,0), XTO_MASK, E500MC,
PPCNONE, {0}},
{"tlbilxpid", XTO(31,787,1), XTO_MASK, E500MC,
PPCNONE, {0}},
{"tlbilxva", XTO(31,787,3), XTO_MASK, E500MC,
PPCNONE, {RA0, RB}},

Quoted 6 lines

If you want to change the tlbilx entry to use 18 rather than 787, let me know whether you want me to make the change or whether you (Edmar?) will handle it.

I'll note the extended mnemonics should be moved before tlbilx so that the disassembler will use them (if appropriate) instead of the base instruction.

I'll check w/Edmar.

- k

#3 lore raw
Quoted 6 lines · Kumar Gala
Quoted 3 lines · Peter Bergner

How do you want to handle the current binutils code that implements tlbilx and its extended mnemonics? Should they be changed to use secondary opcode 18 instead of 787 as per the ISA 2.06 doc?

YES ! :)

The ISA 2.06 documentation states the secondary opcode used by tlbilx and its extended mnemonics is 18 and not 787 which the current code uses. This patch fixes the typo, as well as reordering the extended mnemonics so they are listed in the opcodes table before the base tlbilx insn, so that objdump will attempt to use them before the base insn.

This built and make checks fine, so I committed this as obvious.

Peter

opcodes/
* ppc-opc.c (powerpc_opcodes) <"tlbilxlpid", "tlbilxpid", "tlbilxva", "tlbilx">: Use secondary opcode "18" as per the ISA 2.06 documentation. Reorder entries so the extended mnemonics are listed before tlbilx.

gas/testsuite/
* gas/ppc/e500mc.d: Update to match extended mnemonics.

Index: gas/testsuite/gas/ppc/e500mc.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/e500mc.d,v retrieving revision 1.3

testsuite/gas/ppc/e500mc.d +5 -4
diff -u -p -r1.3 e500mc.d
@@ -50,7 +50,8 @@ Disassembly of section \.text:
   a0:	7c 64 29 fe 	dcbtstep r3,r4,r5
   a4:	7c c7 42 7e 	dcbtep  r6,r7,r8
   a8:	7c 0b 67 fe 	dcbzep  r11,r12
-  ac:	7c 00 06 26 	tlbilx  0,0,r0
-  b0:	7c 20 06 26 	tlbilx  1,0,r0
-  b4:	7c 62 1e 26 	tlbilx  3,r2,r3
-  b8:	7c 64 2e 26 	tlbilx  3,r4,r5
+  ac:	7c 00 00 24 	tlbilxlpid
+  b0:	7c 20 00 24 	tlbilxpid
+  b4:	7c 62 18 24 	tlbilxva r2,r3
+  b8:	7c 64 28 24 	tlbilxva r4,r5
+

Index: opcodes/ppc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.120

ppc-opc.c +5 -4
diff -u -p -r1.120 ppc-opc.c
@@ -3464,6 +3464,11 @@ const struct powerpc_opcode powerpc_opco
 
 {"isellt",	X(31,15),	X_MASK,      PPCISEL,	PPCNONE,	{RT, RA, RB}},
 
+{"tlbilxlpid",	XTO(31,18,0),	XTO_MASK,    E500MC,	PPCNONE,	{0}},
+{"tlbilxpid",	XTO(31,18,1),	XTO_MASK,    E500MC,	PPCNONE,	{0}},
+{"tlbilxva",	XTO(31,18,3),	XTO_MASK,    E500MC,	PPCNONE,	{RA0, RB}},
+{"tlbilx",	X(31,18),	X_MASK,      E500MC,	PPCNONE,	{T, RA0, RB}},
+
 {"mfcr",	XFXM(31,19,0,0), XFXFXM_MASK, POWER4,	PPCNONE,	{RT, FXM4}},
 {"mfcr",	XFXM(31,19,0,0), XRARB_MASK, COM,	POWER4,		{RT}},
 {"mfocrf",	XFXM(31,19,0,1), XFXFXM_MASK, COM,	PPCNONE,	{RT, FXM}},
@@ -4551,10 +4556,6 @@ const struct powerpc_opcode powerpc_opco
 {"lxvw4x",	X(31,780),	XX1_MASK,    PPCVSX,	PPCNONE,	{XT6, RA, RB}},
 
 {"tlbivax",	X(31,786),	XRT_MASK,    BOOKE,	PPCNONE,	{RA, RB}},
-{"tlbilx",	X(31,787),	X_MASK,      E500MC,	PPCNONE,	{T, RA0, RB}},
-{"tlbilxlpid",	XTO(31,787,0),	XTO_MASK,    E500MC,	PPCNONE,	{0}},
-{"tlbilxpid",	XTO(31,787,1),	XTO_MASK,    E500MC,	PPCNONE,	{0}},
-{"tlbilxva",	XTO(31,787,3),	XTO_MASK,    E500MC,	PPCNONE,	{RA0, RB}},
 
 {"lwzcix",	X(31,789),	X_MASK,      POWER6,	PPCNONE,	{RT, RA0, RB}},