summaryrefslogtreecommitdiff
path: root/opcodes/s390-dis.c
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2010-09-27 13:32:58 +0000
committerAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2010-09-27 13:32:58 +0000
commit1991fb7248433e02974b607c3c1bc6385b913f87 (patch)
treeb6657580d4366e0123db36564bcb468707ae5269 /opcodes/s390-dis.c
parentfdc255650e561b1218dc7e5b6fb83dd525bd7e75 (diff)
downloadbinutils-redhat-1991fb7248433e02974b607c3c1bc6385b913f87.tar.gz
2010-09-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* s390-dis.c (print_insn_s390): Pick instruction with most specific mask. * s390-opc.c: Add unused bits to the insn mask. * s390-opc.txt: Reorder some instructions to prefer more recent versions. 2010-09-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * gas/s390/esa-g5.d: Adjust serveral instructions. * gas/s390/esa-reloc.d: Likewise. * gas/s390/esa-z990.d: Likewise. * gas/s390/zarch-reloc.d: Likewise. * gas/s390/zarch-z10.d: Likewise. * gas/s390/zarch-z9-ec.d: Likewise. * gas/s390/zarch-z900.d: Likewise. 2010-09-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * ld-s390/tlsbin.dd: bcr 0,%r7 -> nopr %r7. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic.dd: Likewise. * ld-s390/tlspic_64.dd: Likewise.
Diffstat (limited to 'opcodes/s390-dis.c')
-rw-r--r--opcodes/s390-dis.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c
index b9eeb7976b..37ed2e7d88 100644
--- a/opcodes/s390-dis.c
+++ b/opcodes/s390-dis.c
@@ -166,6 +166,8 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
if (status == 0)
{
+ const struct s390_opcode *op;
+
/* Find the first match in the opcode table. */
opcode_end = s390_opcodes + s390_num_opcodes;
for (opcode = s390_opcodes + opc_index[(int) buffer[0]];
@@ -178,6 +180,7 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
/* Check architecture. */
if (!(opcode->modes & current_arch_mask))
continue;
+
/* Check signature of the opcode. */
if ((buffer[1] & opcode->mask[1]) != opcode->opcode[1]
|| (buffer[2] & opcode->mask[2]) != opcode->opcode[2]
@@ -186,6 +189,28 @@ print_insn_s390 (bfd_vma memaddr, struct disassemble_info *info)
|| (buffer[5] & opcode->mask[5]) != opcode->opcode[5])
continue;
+ /* Advance to an opcode with a more specific mask. */
+ for (op = opcode + 1; op < opcode_end; op++)
+ {
+ if ((buffer[0] & op->mask[0]) != op->opcode[0])
+ break;
+
+ if ((buffer[1] & op->mask[1]) != op->opcode[1]
+ || (buffer[2] & op->mask[2]) != op->opcode[2]
+ || (buffer[3] & op->mask[3]) != op->opcode[3]
+ || (buffer[4] & op->mask[4]) != op->opcode[4]
+ || (buffer[5] & op->mask[5]) != op->opcode[5])
+ continue;
+
+ if (((int)opcode->mask[0] + opcode->mask[1] +
+ opcode->mask[2] + opcode->mask[3] +
+ opcode->mask[4] + opcode->mask[5]) <
+ ((int)op->mask[0] + op->mask[1] +
+ op->mask[2] + op->mask[3] +
+ op->mask[4] + op->mask[5]))
+ opcode = op;
+ }
+
/* The instruction is valid. */
if (opcode->operands[0] != 0)
(*info->fprintf_func) (info->stream, "%s\t", opcode->name);