X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=opcodes%2Fh8500-dis.c;h=d19ef7fadd7f256f5d12b291e83f09e3f54bc2c8;hb=ec68b08387d9dbda1a4470de82c12cebc896a614;hp=144c7e41e085ff3f966d4d74c4cfeaa00f31155a;hpb=ed049af3bcb6edc330e449e215ca9622d992cf82;p=deliverable%2Fbinutils-gdb.git diff --git a/opcodes/h8500-dis.c b/opcodes/h8500-dis.c index 144c7e41e0..d19ef7fadd 100644 --- a/opcodes/h8500-dis.c +++ b/opcodes/h8500-dis.c @@ -1,19 +1,23 @@ /* Disassemble h8500 instructions. - Copyright 1993, 1998, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright 1993, 1998, 2000, 2001, 2002, 2004, 2005, 2007 + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ #include @@ -30,8 +34,6 @@ #include -static int fetch_data PARAMS ((struct disassemble_info *, bfd_byte *)); - struct private { /* Points to first byte not fetched. */ @@ -49,9 +51,7 @@ struct private ? 1 : fetch_data ((info), (addr))) static int -fetch_data (info, addr) - struct disassemble_info *info; - bfd_byte *addr; +fetch_data (struct disassemble_info *info, bfd_byte *addr) { int status; struct private *priv = (struct private *) info->private_data; @@ -74,14 +74,11 @@ fetch_data (info, addr) static char *crname[] = { "sr", "ccr", "*", "br", "ep", "dp", "*", "tp" }; int -print_insn_h8500 (addr, info) - bfd_vma addr; - disassemble_info *info; +print_insn_h8500 (bfd_vma addr, disassemble_info *info) { const h8500_opcode_info *opcode; void *stream = info->stream; fprintf_ftype func = info->fprintf_func; - struct private priv; bfd_byte *buffer = priv.the_buffer; @@ -92,21 +89,6 @@ print_insn_h8500 (addr, info) /* Error return. */ return -1; - if (0) - { - static int one; - - if (!one) - { - one = 1; - for (opcode = h8500_table; opcode->name; opcode++) - { - if ((opcode->bytes[0].contents & 0x8) == 0) - printf ("%s\n", opcode->name); - } - } - } - /* Run down the table to find the one which matches. */ for (opcode = h8500_table; opcode->name; opcode++) { @@ -127,9 +109,8 @@ print_insn_h8500 (addr, info) FETCH_DATA (info, buffer + byte + 1); if ((buffer[byte] & opcode->bytes[byte].mask) != (opcode->bytes[byte].contents)) - { - goto next; - } + goto next; + else { /* Extract any info parts. */ @@ -250,7 +231,7 @@ print_insn_h8500 (addr, info) func (stream, "@(0x%x:8 (%d), r%d)", disp & 0xff, disp, rd); break; case FPIND_D8: - func (stream, "@(0x%x:8 (%d), fp)", disp & 0xff, disp, rn); + func (stream, "@(0x%x:8 (%d), fp)", disp & 0xff, disp); break; case CRB: case CRW: @@ -299,6 +280,7 @@ print_insn_h8500 (addr, info) { int i; int nc = 0; + func (stream, "("); for (i = 0; i < 8; i++) { @@ -318,11 +300,11 @@ print_insn_h8500 (addr, info) break; case PCREL16: func (stream, "0x%0x:16", - (pcrel + addr + opcode->length) & 0xffff); + (int)(pcrel + addr + opcode->length) & 0xffff); break; case PCREL8: func (stream, "#0x%0x:8", - ((char) pcrel + addr + opcode->length) & 0xffff); + (int)((char) pcrel + addr + opcode->length) & 0xffff); break; case QIM: func (stream, "#%d:q", qim);