aboutsummaryrefslogtreecommitdiff
path: root/opcodes/ppc-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-05-07 11:35:22 +0930
committerAlan Modra <amodra@gmail.com>2018-05-08 22:28:44 +0930
commitf413a91378902aadbe4e338a6dc8f33f5f7148a0 (patch)
tree07530badfb8696ab6121104e32e5b3e4f9683eae /opcodes/ppc-dis.c
parent7785df4880f3828db8cf1715038127e6b858a670 (diff)
downloadfsf-binutils-gdb-f413a91378902aadbe4e338a6dc8f33f5f7148a0.zip
fsf-binutils-gdb-f413a91378902aadbe4e338a6dc8f33f5f7148a0.tar.gz
fsf-binutils-gdb-f413a91378902aadbe4e338a6dc8f33f5f7148a0.tar.bz2
Correct powerpc spe opcode lookup
Defining SPE2_OPCD_SEGS as 13 discounts the possibility that we'd ever look up spe2_opcd_indices[14..16], which I think is possible. Extend that array to size 16+1, using the macros we use to index the array. Similarly use the index macros for PPC_OPCD_SEGS and VLE_OPCD_SEGS. * ppc-dis.c (PPC_OPCD_SEGS): Define using PPC_OP. (VLE_OPCD_SEGS, SPE2_OPCD_SEGS): Similarly, using macros used to partition opcode space for index lookup.
Diffstat (limited to 'opcodes/ppc-dis.c')
-rw-r--r--opcodes/ppc-dis.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index 0f7d7ba..412aae0 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -367,12 +367,12 @@ powerpc_init_dialect (struct disassemble_info *info)
POWERPC_DIALECT(info) = dialect;
}
-#define PPC_OPCD_SEGS 64
-static unsigned short powerpc_opcd_indices[PPC_OPCD_SEGS+1];
-#define VLE_OPCD_SEGS 32
-static unsigned short vle_opcd_indices[VLE_OPCD_SEGS+1];
-#define SPE2_OPCD_SEGS 13
-static unsigned short spe2_opcd_indices[SPE2_OPCD_SEGS+1];
+#define PPC_OPCD_SEGS (1 + PPC_OP (-1))
+static unsigned short powerpc_opcd_indices[PPC_OPCD_SEGS + 1];
+#define VLE_OPCD_SEGS (1 + VLE_OP_TO_SEG (VLE_OP (-1, 0xffff)))
+static unsigned short vle_opcd_indices[VLE_OPCD_SEGS + 1];
+#define SPE2_OPCD_SEGS (1 + SPE2_XOP_TO_SEG (SPE2_XOP (-1)))
+static unsigned short spe2_opcd_indices[SPE2_OPCD_SEGS + 1];
/* Calculate opcode table indices to speed up disassembly,
and init dialect. */