X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=opcodes%2Fm10200-dis.c;h=537ce46ae02d736652c75ca2055c3925469524ee;hb=1224c05de4d662639e9da6bfdc4f89de4cb1de6c;hp=beb1bfa67eb9b89d287bd502fe86dae3915aff11;hpb=01f0fe5e0450edf168c1f612feb93cf588e4e7ea;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/m10200-dis.c b/opcodes/m10200-dis.c index beb1bfa67e..537ce46ae0 100644 --- a/opcodes/m10200-dis.c +++ b/opcodes/m10200-dis.c @@ -1,26 +1,27 @@ /* Disassemble MN10200 instructions. - Copyright 1996, 1997, 1998, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This file is part of the GNU opcodes library. + + This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; either version 3, or (at your option) + any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + It is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include - #include "sysdep.h" -#include "opcode/mn10200.h" -#include "dis-asm.h" +#include +#include "opcode/mn10200.h" +#include "disassemble.h" #include "opintl.h" static void @@ -53,7 +54,7 @@ disassemble (bfd_vma memaddr, mysize = 5; else abort (); - + if (op->format == FMT_2 || op->format == FMT_5) extra_shift = 8; else if (op->format == FMT_3 @@ -69,7 +70,7 @@ disassemble (bfd_vma memaddr, const unsigned char *opindex_ptr; unsigned int nocomma; int paren = 0; - + match = 1; (*info->fprintf_func) (info->stream, "%s\t", op->name); @@ -82,16 +83,18 @@ disassemble (bfd_vma memaddr, operand = &mn10200_operands[*opindex_ptr]; - if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0) + if ((operand->flags & MN10200_OPERAND_DREG) != 0 + || (operand->flags & MN10200_OPERAND_AREG) != 0) + value = ((insn >> (operand->shift + extra_shift)) + & ((1 << operand->bits) - 1)); + else if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0) { value = (insn & 0xffff) << 8; value |= extension; } else - { - value = ((insn >> (operand->shift)) - & ((1L << operand->bits) - 1L)); - } + value = ((insn >> (operand->shift)) + & ((1L << operand->bits) - 1L)); if ((operand->flags & MN10200_OPERAND_SIGNED) != 0) value = ((long)(value << (32 - operand->bits)) @@ -103,20 +106,12 @@ disassemble (bfd_vma memaddr, (*info->fprintf_func) (info->stream, ","); nocomma = 0; - + if ((operand->flags & MN10200_OPERAND_DREG) != 0) - { - value = ((insn >> (operand->shift + extra_shift)) - & ((1 << operand->bits) - 1)); - (*info->fprintf_func) (info->stream, "d%ld", value); - } + (*info->fprintf_func) (info->stream, "d%ld", value); else if ((operand->flags & MN10200_OPERAND_AREG) != 0) - { - value = ((insn >> (operand->shift + extra_shift)) - & ((1 << operand->bits) - 1)); - (*info->fprintf_func) (info->stream, "a%ld", value); - } + (*info->fprintf_func) (info->stream, "a%ld", value); else if ((operand->flags & MN10200_OPERAND_PSW) != 0) (*info->fprintf_func) (info->stream, "psw"); @@ -143,7 +138,7 @@ disassemble (bfd_vma memaddr, else if ((operand->flags & MN10200_OPERAND_MEMADDR) != 0) (*info->print_address_func) (value, info); - else + else (*info->fprintf_func) (info->stream, "%ld", value); } /* All done. */ @@ -156,7 +151,7 @@ disassemble (bfd_vma memaddr, (*info->fprintf_func) (info->stream, _("unknown\t0x%04lx"), insn); } -int +int print_insn_mn10200 (bfd_vma memaddr, struct disassemble_info *info) { int status;