From f497f3ae7c8672d274d8af95811019cd826d38ca Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 20 Nov 1996 17:36:31 +0000 Subject: [PATCH] * mn10300-dis.c (print_insn_mn10300): Fix fetch of last byte in 7 byte insns. (disassemble): Handle SPLIT and EXTENDED operands. --- opcodes/ChangeLog | 6 ++++++ opcodes/mn10300-dis.c | 25 +++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index fd30222115a..f937a1a85f6 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +Wed Nov 20 10:37:13 1996 Jeffrey A Law (law@cygnus.com) + + * mn10300-dis.c (print_insn_mn10300): Fix fetch of last byte + in 7 byte insns. + (disassemble): Handle SPLIT and EXTENDED operands. + Tue Nov 19 13:33:01 1996 Jeffrey A Law (law@cygnus.com) * mn10300-dis.c: Rough cut at printing some operands. diff --git a/opcodes/mn10300-dis.c b/opcodes/mn10300-dis.c index 6c1b4d2ff36..4edd61417d9 100644 --- a/opcodes/mn10300-dis.c +++ b/opcodes/mn10300-dis.c @@ -221,10 +221,10 @@ print_insn_mn10300 (memaddr, info) } extension = bfd_getb16 (buffer); extension <<= 8; - status = (*info->read_memory_func) (memaddr + 7, buffer, 1, info); + status = (*info->read_memory_func) (memaddr + 6, buffer, 1, info); if (status != 0) { - (*info->memory_error_func) (status, memaddr + 7, info); + (*info->memory_error_func) (status, memaddr + 6, info); return -1; } extension |= *(unsigned char *)buffer; @@ -298,8 +298,25 @@ disassemble (memaddr, info, insn, extension, size) operand = &mn10300_operands[*opindex_ptr]; - value = ((insn >> (operand->shift)) - & ((1 << operand->bits) - 1)); + if ((operand->flags & MN10300_OPERAND_SPLIT) != 0) + { + unsigned long temp; + value = insn & ((1 << operand->bits) - 1); + value <<= (32 - operand->bits); + temp = extension >> operand->shift; + temp &= ((1 << 32 - operand->bits) - 1); + value |= temp; + } + else if ((operand->flags & MN10300_OPERAND_EXTENDED) != 0) + { + value = ((extension >> (operand->shift)) + & ((1 << operand->bits) - 1)); + } + else + { + value = ((insn >> (operand->shift)) + & ((1 << operand->bits) - 1)); + } if ((operand->flags & MN10300_OPERAND_SIGNED) != 0) value = ((long)(value << (32 - operand->bits)) -- 2.30.2