diff options
author | Jeff Law <law@redhat.com> | 1999-12-01 10:36:22 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1999-12-01 10:36:22 +0000 |
commit | a9af5e04811eb19756c41a5e287973efd87e7f5a (patch) | |
tree | fdd7213b7921c52adb5e8972659a0cddbebdf9f3 /opcodes/m10300-dis.c | |
parent | 31f8dc8fceba2e10cc6d503cc6280db0504dd7f7 (diff) | |
download | ppe42-binutils-a9af5e04811eb19756c41a5e287973efd87e7f5a.tar.gz ppe42-binutils-a9af5e04811eb19756c41a5e287973efd87e7f5a.zip |
* m10300-opc.c, m10300-dis.c: Add am33 support.
Diffstat (limited to 'opcodes/m10300-dis.c')
-rw-r--r-- | opcodes/m10300-dis.c | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/opcodes/m10300-dis.c b/opcodes/m10300-dis.c index 415bffce37..7d7f74c947 100644 --- a/opcodes/m10300-dis.c +++ b/opcodes/m10300-dis.c @@ -120,6 +120,7 @@ print_insn_mn10300 (memaddr, info) || (insn & 0xfc) == 0x38 || (insn & 0xff) == 0xde || (insn & 0xff) == 0xdf + || (insn & 0xff) == 0xf9 || (insn & 0xff) == 0xcc) { status = (*info->read_memory_func) (memaddr, buffer, 2, info); @@ -142,6 +143,7 @@ print_insn_mn10300 (memaddr, info) /* These are four byte insns. */ else if ((insn & 0xff) == 0xfa + || (insn & 0xff) == 0xf7 || (insn & 0xff) == 0xfb) { status = (*info->read_memory_func) (memaddr, buffer, 4, info); @@ -234,6 +236,14 @@ disassemble (memaddr, info, insn, size) mysize = 4; else if (op->format == FMT_D4) mysize = 6; + else if (op->format == FMT_D6) + mysize = 3; + else if (op->format == FMT_D7 || op->format == FMT_D10) + mysize = 4; + else if (op->format == FMT_D8) + mysize = 6; + else if (op->format == FMT_D9) + mysize = 7; else mysize = 7; @@ -252,6 +262,10 @@ disassemble (memaddr, info, insn, size) || op->format == FMT_S2 || op->format == FMT_S4 || op->format == FMT_S6 || op->format == FMT_D5) extra_shift = 16; + else if (op->format == FMT_D7 + || op->format == FMT_D8 + || op->format == FMT_D9) + extra_shift = 8; else extra_shift = 0; @@ -266,6 +280,11 @@ disassemble (memaddr, info, insn, size) { extension = 0; } + else if (size == 3 + && op->format == FMT_D6) + { + extension = 0; + } else if (size == 3) { insn &= 0xff0000; @@ -286,6 +305,12 @@ disassemble (memaddr, info, insn, size) { extension = 0; } + else if (size == 4 + && (op->format == FMT_D7 + || op->format == FMT_D10)) + { + extension = 0; + } else if (size == 4) { insn &= 0xffff0000; @@ -336,6 +361,25 @@ disassemble (memaddr, info, insn, size) } extension = *(unsigned char *)buffer; } + else if (size == 6 && op->format == FMT_D8) + { + insn &= 0xffffff00; + status = (*info->read_memory_func) (memaddr + 5, buffer, 1, info); + if (status != 0) + { + (*info->memory_error_func) (status, memaddr, info); + return; + } + insn |= *(unsigned char *)buffer; + + status = (*info->read_memory_func) (memaddr + 3, buffer, 2, info); + if (status != 0) + { + (*info->memory_error_func) (status, memaddr, info); + return; + } + extension = bfd_getl16 (buffer); + } else if (size == 6) { unsigned long temp = 0; @@ -351,6 +395,19 @@ disassemble (memaddr, info, insn, size) insn |= (temp >> 16) & 0xffff; extension = temp & 0xffff; } + else if (size == 7 && op->format == FMT_D9) + { + insn &= 0xffffff00; + status = (*info->read_memory_func) (memaddr + 3, buffer, 4, info); + if (status != 0) + { + (*info->memory_error_func) (status, memaddr, info); + return; + } + extension = bfd_getl32 (buffer); + insn |= (extension & 0xff000000) >> 24; + extension &= 0xffffff; + } else if (size == 7 && op->opcode == 0xdd000000) { unsigned long temp = 0; @@ -410,6 +467,10 @@ disassemble (memaddr, info, insn, size) operand = &mn10300_operands[*opindex_ptr]; + /* If this operand is a PLUS (autoincrement), then do not emit + a comma before emitting the plus. */ + if ((operand->flags & MN10300_OPERAND_PLUS) != 0) + nocomma = 1; if ((operand->flags & MN10300_OPERAND_SPLIT) != 0) { @@ -420,6 +481,17 @@ disassemble (memaddr, info, insn, size) temp &= ((1 << (32 - operand->bits)) - 1); value |= temp; } + else if ((operand->flags & MN10300_OPERAND_24BIT) != 0) + { + unsigned long temp; + value = insn & ((1 << operand->bits) - 1); + value <<= (24 - operand->bits); + temp = extension >> operand->shift; + temp &= ((1 << (24 - operand->bits)) - 1); + value |= temp; + if ((operand->flags & MN10300_OPERAND_SIGNED) != 0) + value = ((value & 0xffffff) ^ (~0x7fffff)) + 0x800000; + } else if ((operand->flags & MN10300_OPERAND_EXTENDED) != 0) { value = ((extension >> (operand->shift)) @@ -432,6 +504,8 @@ disassemble (memaddr, info, insn, size) } if ((operand->flags & MN10300_OPERAND_SIGNED) != 0 + /* These are properly extended by the code above. */ + && ((operand->flags & MN10300_OPERAND_24BIT) == 0) ) value = ((long)(value << (32 - operand->bits)) >> (32 - operand->bits)); @@ -466,6 +540,45 @@ disassemble (memaddr, info, insn, size) else if ((operand->flags & MN10300_OPERAND_MDR) != 0) (*info->fprintf_func) (info->stream, "mdr"); + else if ((operand->flags & MN10300_OPERAND_RREG) != 0) + { + value = ((insn >> (operand->shift + extra_shift)) + & ((1 << operand->bits) - 1)); + if (value < 8) + (*info->fprintf_func) (info->stream, "r%d", value); + else if (value < 12) + (*info->fprintf_func) (info->stream, "a%d", value - 8); + else + (*info->fprintf_func) (info->stream, "d%d", value - 12); + } + + else if ((operand->flags & MN10300_OPERAND_XRREG) != 0) + { + value = ((insn >> (operand->shift + extra_shift)) + & ((1 << operand->bits) - 1)); + if (value == 0) + (*info->fprintf_func) (info->stream, "sp", value); + else + (*info->fprintf_func) (info->stream, "xr%d", value); + } + + else if ((operand->flags & MN10300_OPERAND_USP) != 0) + (*info->fprintf_func) (info->stream, "usp"); + + else if ((operand->flags & MN10300_OPERAND_SSP) != 0) + (*info->fprintf_func) (info->stream, "ssp"); + + else if ((operand->flags & MN10300_OPERAND_MSP) != 0) + (*info->fprintf_func) (info->stream, "msp"); + + else if ((operand->flags & MN10300_OPERAND_PC) != 0) + (*info->fprintf_func) (info->stream, "pc"); + + else if ((operand->flags & MN10300_OPERAND_EPSW) != 0) + (*info->fprintf_func) (info->stream, "epsw"); + + else if ((operand->flags & MN10300_OPERAND_PLUS) != 0) + (*info->fprintf_func) (info->stream, "+"); else if ((operand->flags & MN10300_OPERAND_PAREN) != 0) { @@ -528,6 +641,27 @@ disassemble (memaddr, info, insn, size) comma = 1; } + if (value & 0x04) + { + if (comma) + (*info->fprintf_func) (info->stream, ","); + (*info->fprintf_func) (info->stream, "exreg0"); + comma = 1; + } + if (value & 0x02) + { + if (comma) + (*info->fprintf_func) (info->stream, ","); + (*info->fprintf_func) (info->stream, "exreg1"); + comma = 1; + } + if (value & 0x01) + { + if (comma) + (*info->fprintf_func) (info->stream, ","); + (*info->fprintf_func) (info->stream, "exother"); + comma = 1; + } (*info->fprintf_func) (info->stream, "]"); } |