This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] opcodes/nfp: Fix disassembly of crc[] with swapped operands.
- From: "Francois H. Theron" <francois dot theron at netronome dot com>
- To: binutils at sourceware dot org
- Date: Thu, 1 Nov 2018 17:57:23 +0200
- Subject: [PATCH] opcodes/nfp: Fix disassembly of crc[] with swapped operands.
The decoding of the CRC operation in alu instructions was using bits
from the instruction word directly, instead of srcA which would be
different if the swap bit was set.
Signed-off-by: Francois H. Theron <francois.theron@netronome.com>
---
binutils/ChangeLog | 4 +++
binutils/testsuite/binutils-all/nfp/test1.d | 32 +++++++++++++++---
.../binutils-all/nfp/test1_nfp6000.nffw | Bin 9880 -> 10128 bytes
opcodes/ChangeLog | 4 +++
opcodes/nfp-dis.c | 12 +++----
5 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e3bbbc3a84..3b5df7867c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-01 Francois H. Theron <francois.theron@netronome.com>
+
+ * testsuite/binutils-all/nfp/test1.d: Test for swapped operand crc[].
+
2018-10-18 Nick Clifton <nickc@redhat.com>
* doc/binutils.texi (readelf): Document alternatives to the
diff --git a/binutils/testsuite/binutils-all/nfp/test1.d b/binutils/testsuite/binutils-all/nfp/test1.d
index 3915ed1357..d52d6f48e0 100644
--- a/binutils/testsuite/binutils-all/nfp/test1.d
+++ b/binutils/testsuite/binutils-all/nfp/test1.d
@@ -484,8 +484,20 @@ Disassembly of section \.text\.i32\.me0:
ee0: 000000f0000c0300 \.476 nop
ee8: 000000f0000c0300 \.477 nop
ef0: 000000f0000c0300 \.478 nop
- ef8: 000220e000020000 \.479 ctx_arb\[bpt\]
- f00: 000420e000010000 \.480 ctx_arb\[kill\]
+ ef8: 000060a900301340 \.479 crc_be\[crc_ccitt, gprA_3, gprB_4\]
+ f00: 000000f0000c0300 \.480 nop
+ f08: 000e20b9403d0004 \.481 crc_be\[crc_ccitt, gprB_3, gprA_4\]
+ f10: 000000f0000c0300 \.482 nop
+ f18: 000400a900301348 \.483 crc_le\[crc_ccitt, gprA_3, gprB_4\]
+ f20: 000000f0000c0300 \.484 nop
+ f28: 000400b9403d2004 \.485 crc_le\[crc_ccitt, gprB_3, gprA_4\]
+ f30: 000000f0000c0300 \.486 nop
+ f38: 0002e0b900301348 \.487 crc_le\[crc_ccitt, gprB_3, gprB_4\]
+ f40: 000000f0000c0300 \.488 nop
+ f48: 0002e0a9403d2004 \.489 crc_le\[crc_ccitt, gprA_3, gprA_4\]
+ f50: 000000f0000c0300 \.490 nop
+ f58: 000220e000020000 \.491 ctx_arb\[bpt\]
+ f60: 000420e000010000 \.492 ctx_arb\[kill\]
Disassembly of section \.text\.i33\.me9:
@@ -969,5 +981,17 @@ Disassembly of section \.text\.i33\.me9:
ee0: 000000f0000c0300 \.476 nop
ee8: 000000f0000c0300 \.477 nop
ef0: 000000f0000c0300 \.478 nop
- ef8: 000220e000020000 \.479 ctx_arb\[bpt\]
- f00: 000420e000010000 \.480 ctx_arb\[kill\]
+ ef8: 000060a900301340 \.479 crc_be\[crc_ccitt, gprA_3, gprB_4\]
+ f00: 000000f0000c0300 \.480 nop
+ f08: 000e20b9403d0004 \.481 crc_be\[crc_ccitt, gprB_3, gprA_4\]
+ f10: 000000f0000c0300 \.482 nop
+ f18: 000400a900301348 \.483 crc_le\[crc_ccitt, gprA_3, gprB_4\]
+ f20: 000000f0000c0300 \.484 nop
+ f28: 000400b9403d2004 \.485 crc_le\[crc_ccitt, gprB_3, gprA_4\]
+ f30: 000000f0000c0300 \.486 nop
+ f38: 0002e0b900301348 \.487 crc_le\[crc_ccitt, gprB_3, gprB_4\]
+ f40: 000000f0000c0300 \.488 nop
+ f48: 0002e0a9403d2004 \.489 crc_le\[crc_ccitt, gprA_3, gprA_4\]
+ f50: 000000f0000c0300 \.490 nop
+ f58: 000220e000020000 \.491 ctx_arb\[bpt\]
+ f60: 000420e000010000 \.492 ctx_arb\[kill\]
diff --git a/binutils/testsuite/binutils-all/nfp/test1_nfp6000.nffw b/binutils/testsuite/binutils-all/nfp/test1_nfp6000.nffw
index 869a6b2dd328552334645bcda9467bc2d58f014f..6978b03d6b2131a25feef64f16d55bb8fb1f2de0 100644
GIT binary patch
delta 368
zcmbQ?JHda00wZI}WJN}E&Iim4V30965y<lphVd3Mnlo)sntY4Vj_HE(WGN;)rVq-K
zqkz-_)ycD%9wmo>6f!a}__+lz%on;H9g?4)lbn&5nP;VtmzI;FV5V20o03|VnxmkR
zRGJACFgCX^)a3F@%uTgY;0jAED$dLYsx{C9LM|t;3cu3aq|_py7#GA5lh+Gv+#JE;
z!58izY{0NG0VvAM!|(w}u`t*=>{Q@`^F2WFKvB570#F`_50c;cfC)u@<pZY4^A)8w
QZxs4YGYdA)SNzEW0ENa?S^xk5
delta 132
zcmbQ>Kf`x}0wbfrWJN}E&K1lIV8Ags5y;yh1mi7aG-ukOIQbT%9n%e^$x=*qOh1$+
zM**o5DwAh1J<?VHDP&||@N)}baPm%%%1g^hQ83f1&`n7#OU+TxNGi<)3K*MMm}qXk
X&-{~bvxP7R|6~hc!Oa_$?y~>@Tk<1n
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 82fbc75723..9bf5931fd8 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-01 Francois H. Theron <francois.theron@netronome.com>
+
+ * nfp-dis.c: Fix crc[] disassembly if operands are swapped.
+
2018-10-22 John Darrington <john@darrington.wattle.id.au>
* s12z-dis.c (decode_possible_symbol): Add fallback case.
diff --git a/opcodes/nfp-dis.c b/opcodes/nfp-dis.c
index 03139ec65e..38390a9798 100644
--- a/opcodes/nfp-dis.c
+++ b/opcodes/nfp-dis.c
@@ -1325,8 +1325,8 @@ nfp_me27_28_print_alu (uint64_t instr, unsigned int pred_cc,
case 18:
do_close_bracket = 0;
dinfo->fprintf_func (dinfo->stream, "crc_%s[",
- _BTST (instr, 3) ? "le" : "be");
- if (!nfp_me27_28_crc_op[_BF (instr, 7, 5)])
+ _BTST (srcA, 3) ? "le" : "be");
+ if (!nfp_me27_28_crc_op[_BF (srcA, 7, 5)])
{
dinfo->fprintf_func (dinfo->stream, _(", <invalid CRC operator>, "));
err = TRUE;
@@ -1334,7 +1334,7 @@ nfp_me27_28_print_alu (uint64_t instr, unsigned int pred_cc,
else
{
dinfo->fprintf_func (dinfo->stream, "%s, ",
- nfp_me27_28_crc_op[_BF (instr, 7, 5)]);
+ nfp_me27_28_crc_op[_BF (srcA, 7, 5)]);
}
/* Dest operand. */
@@ -1351,10 +1351,10 @@ nfp_me27_28_print_alu (uint64_t instr, unsigned int pred_cc,
num_ctx, src_lmext, dinfo);
dinfo->fprintf_func (dinfo->stream, "]");
- if (_BF (instr, 2, 0))
+ if (_BF (srcA, 2, 0))
dinfo->fprintf_func (dinfo->stream, ", %s",
- nfp_me27_28_crc_bytes[_BF (instr, 2, 0)]);
- if (_BTST (instr, 4))
+ nfp_me27_28_crc_bytes[_BF (srcA, 2, 0)]);
+ if (_BTST (srcA, 4))
dinfo->fprintf_func (dinfo->stream, ", bit_swap");
break;