diff options
Diffstat (limited to 'opcodes')
51 files changed, 262 insertions, 180 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index aecf15a..4d1b6c9 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,59 @@ +2012-05-17 Daniel Richard G. <skunk@iskunk.org> + Nick Clifton <nickc@redhat.com> + + PR 14072 + * configure.in: Add check that sysdep.h has been included before + any system header files. + * configure: Regenerate. + * config.in: Regenerate. + * sysdep.h: Generate an error if included before config.h. + * alpha-opc.c: Include sysdep.h before any other header file. + * alpha-dis.c: Likewise. + * avr-dis.c: Likewise. + * cgen-opc.c: Likewise. + * cr16-dis.c: Likewise. + * cris-dis.c: Likewise. + * crx-dis.c: Likewise. + * d10v-dis.c: Likewise. + * d10v-opc.c: Likewise. + * d30v-dis.c: Likewise. + * d30v-opc.c: Likewise. + * h8500-dis.c: Likewise. + * i370-dis.c: Likewise. + * i370-opc.c: Likewise. + * m10200-dis.c: Likewise. + * m10300-dis.c: Likewise. + * micromips-opc.c: Likewise. + * mips-opc.c: Likewise. + * mips61-opc.c: Likewise. + * moxie-dis.c: Likewise. + * or32-opc.c: Likewise. + * pj-dis.c: Likewise. + * ppc-dis.c: Likewise. + * ppc-opc.c: Likewise. + * s390-dis.c: Likewise. + * sh-dis.c: Likewise. + * sh64-dis.c: Likewise. + * sparc-dis.c: Likewise. + * sparc-opc.c: Likewise. + * spu-dis.c: Likewise. + * tic30-dis.c: Likewise. + * tic54x-dis.c: Likewise. + * tic80-dis.c: Likewise. + * tic80-opc.c: Likewise. + * tilegx-dis.c: Likewise. + * tilepro-dis.c: Likewise. + * v850-dis.c: Likewise. + * v850-opc.c: Likewise. + * vax-dis.c: Likewise. + * w65-dis.c: Likewise. + * xgate-dis.c: Likewise. + * xtensa-dis.c: Likewise. + * rl78-decode.opc: Likewise. + * rl78-decode.c: Regenerate. + * rx-decode.opc: Likewise. + * rx-decode.c: Regenerate. + 2012-05-17 Alan Modra <amodra@gmail.com> * ppc_dis.c: Don't include elf/ppc.h. diff --git a/opcodes/alpha-dis.c b/opcodes/alpha-dis.c index 00b552f..df37143 100644 --- a/opcodes/alpha-dis.c +++ b/opcodes/alpha-dis.c @@ -1,5 +1,5 @@ /* alpha-dis.c -- Disassemble Alpha AXP instructions - Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2007 + Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2012 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@tamu.edu>, patterned after the PPC opcode handling written by Ian Lance Taylor. @@ -21,8 +21,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "dis-asm.h" #include "opcode/alpha.h" diff --git a/opcodes/alpha-opc.c b/opcodes/alpha-opc.c index d8c7121..9cf00b0 100644 --- a/opcodes/alpha-opc.c +++ b/opcodes/alpha-opc.c @@ -1,6 +1,6 @@ /* alpha-opc.c -- Alpha AXP opcode list - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, + 2012 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@cygnus.com>, patterned after the PPC opcode handling written by Ian Lance Taylor. @@ -21,8 +21,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/alpha.h" #include "bfd.h" #include "opintl.h" diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c index b895ad5..385b399 100644 --- a/opcodes/avr-dis.c +++ b/opcodes/avr-dis.c @@ -1,5 +1,5 @@ /* Disassemble AVR instructions. - Copyright 1999, 2000, 2002, 2004, 2005, 2006, 2007, 2008 + Copyright 1999, 2000, 2002, 2004, 2005, 2006, 2007, 2008, 2012 Free Software Foundation, Inc. Contributed by Denis Chertykov <denisc@overta.ru> @@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <assert.h> #include "sysdep.h" +#include <assert.h> #include "dis-asm.h" #include "opintl.h" #include "libiberty.h" diff --git a/opcodes/cgen-opc.c b/opcodes/cgen-opc.c index 263eb2c..b0405cc 100644 --- a/opcodes/cgen-opc.c +++ b/opcodes/cgen-opc.c @@ -1,7 +1,7 @@ /* CGEN generic opcode support. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2009 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2009, + 2012 Free Software Foundation, Inc. This file is part of libopcodes. @@ -19,8 +19,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "alloca-conf.h" #include "sysdep.h" +#include "alloca-conf.h" #include <stdio.h> #include "ansidecl.h" #include "libiberty.h" diff --git a/opcodes/config.in b/opcodes/config.in index 4eec821..7b97957 100644 --- a/opcodes/config.in +++ b/opcodes/config.in @@ -1,5 +1,12 @@ /* config.in. Generated from configure.in by autoheader. */ +/* Check that config.h is #included before system headers + (this works only for glibc, but that should be enough). */ +#if defined(__GLIBC__) && !defined(__CONFIG_H__) +# error config.h must be #included before system headers +#endif +#define __CONFIG_H__ 1 + /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS diff --git a/opcodes/configure b/opcodes/configure index 9426e7e..dbfca48 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -11565,6 +11565,9 @@ fi ac_config_headers="$ac_config_headers config.h:config.in" +# PR 14072 + + if test -z "$target" ; then as_fn_error "Unrecognized target system type; please check config.sub." "$LINENO" 5 fi @@ -12468,7 +12471,7 @@ if test x${all_targets} = xfalse ; then bfd_m32r_arch) ta="$ta m32r-asm.lo m32r-desc.lo m32r-dis.lo m32r-ibld.lo m32r-opc.lo m32r-opinst.lo" using_cgen=yes ;; bfd_m68hc11_arch) ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;; bfd_m68hc12_arch) ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;; - bfd_m9s12x_arch) ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;; + bfd_m9s12x_arch) ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;; bfd_m9s12xg_arch) ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;; bfd_m68k_arch) ta="$ta m68k-dis.lo m68k-opc.lo" ;; bfd_m88k_arch) ta="$ta m88k-dis.lo" ;; diff --git a/opcodes/configure.in b/opcodes/configure.in index 9c84816..dadfe4a 100644 --- a/opcodes/configure.in +++ b/opcodes/configure.in @@ -45,6 +45,15 @@ AM_BINUTILS_WARNINGS AC_CONFIG_HEADERS(config.h:config.in) +# PR 14072 +AH_VERBATIM([00_CONFIG_H_CHECK], +[/* Check that config.h is #included before system headers + (this works only for glibc, but that should be enough). */ +#if defined(__GLIBC__) && !defined(__CONFIG_H__) +# error config.h must be #included before system headers +#endif +#define __CONFIG_H__ 1]) + if test -z "$target" ; then AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) fi diff --git a/opcodes/cr16-dis.c b/opcodes/cr16-dis.c index 1fc8c2b..f299fef 100644 --- a/opcodes/cr16-dis.c +++ b/opcodes/cr16-dis.c @@ -18,8 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "dis-asm.h" #include "sysdep.h" +#include "dis-asm.h" #include "opcode/cr16.h" #include "libiberty.h" diff --git a/opcodes/cris-dis.c b/opcodes/cris-dis.c index 01ada9d..64e8e1d 100644 --- a/opcodes/cris-dis.c +++ b/opcodes/cris-dis.c @@ -1,5 +1,5 @@ /* Disassembler code for CRIS. - Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc. Contributed by Axis Communications AB, Lund, Sweden. Written by Hans-Peter Nilsson. @@ -21,8 +21,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "dis-asm.h" #include "sysdep.h" +#include "dis-asm.h" #include "opcode/cris.h" #include "libiberty.h" diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c index 35168bc..710a96e 100644 --- a/opcodes/crx-dis.c +++ b/opcodes/crx-dis.c @@ -20,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "dis-asm.h" #include "sysdep.h" +#include "dis-asm.h" #include "opcode/crx.h" /* String to print when opcode was not matched. */ diff --git a/opcodes/d10v-dis.c b/opcodes/d10v-dis.c index dbedb3d..4e601b7 100644 --- a/opcodes/d10v-dis.c +++ b/opcodes/d10v-dis.c @@ -1,5 +1,5 @@ /* Disassemble D10V instructions. - Copyright 1996, 1997, 1998, 2000, 2001, 2005, 2007 + Copyright 1996, 1997, 1998, 2000, 2001, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,9 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/d10v.h" #include "dis-asm.h" diff --git a/opcodes/d10v-opc.c b/opcodes/d10v-opc.c index f99d66a..8df62cb 100644 --- a/opcodes/d10v-opc.c +++ b/opcodes/d10v-opc.c @@ -1,5 +1,5 @@ /* d10v-opc.c -- D10V opcode list - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2007 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2012 Free Software Foundation, Inc. Written by Martin Hunt, Cygnus Support @@ -20,8 +20,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/d10v.h" diff --git a/opcodes/d30v-dis.c b/opcodes/d30v-dis.c index 5f5d07f..972d367 100644 --- a/opcodes/d30v-dis.c +++ b/opcodes/d30v-dis.c @@ -1,5 +1,5 @@ /* Disassemble D30V instructions. - Copyright 1997, 1998, 2000, 2001, 2005, 2007 + Copyright 1997, 1998, 2000, 2001, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/d30v.h" #include "dis-asm.h" #include "opintl.h" diff --git a/opcodes/d30v-opc.c b/opcodes/d30v-opc.c index 806fb3c..b7e35e5 100644 --- a/opcodes/d30v-opc.c +++ b/opcodes/d30v-opc.c @@ -1,5 +1,6 @@ /* d30v-opc.c -- D30V opcode list - Copyright 1997, 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2005, 2007, 2012 + Free Software Foundation, Inc. Written by Martin Hunt, Cygnus Support This file is part of the GNU opcodes library. @@ -19,8 +20,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/d30v.h" /* This table is sorted. diff --git a/opcodes/h8500-dis.c b/opcodes/h8500-dis.c index 1c9463a..880cc7f 100644 --- a/opcodes/h8500-dis.c +++ b/opcodes/h8500-dis.c @@ -1,5 +1,5 @@ /* Disassemble h8500 instructions. - Copyright 1993, 1998, 2000, 2001, 2002, 2004, 2005, 2007 + Copyright 1993, 1998, 2000, 2001, 2002, 2004, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,12 +19,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stdio.h> #define DISASSEMBLER_TABLE #define DEFINE_TABLE -#include "sysdep.h" #include "h8500-opc.h" #include "dis-asm.h" #include "opintl.h" diff --git a/opcodes/i370-dis.c b/opcodes/i370-dis.c index 98c110b..05a6341 100644 --- a/opcodes/i370-dis.c +++ b/opcodes/i370-dis.c @@ -1,5 +1,6 @@ /* i370-dis.c -- Disassemble Instruction 370 (ESA/390) instructions - Copyright 1994, 2000, 2003, 2005, 2007 Free Software Foundation, Inc. + Copyright 1994, 2000, 2003, 2005, 2007, 2012 + Free Software Foundation, Inc. PowerPC version written by Ian Lance Taylor, Cygnus Support Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org> @@ -20,8 +21,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "dis-asm.h" #include "opcode/i370.h" diff --git a/opcodes/i370-opc.c b/opcodes/i370-opc.c index e684ff4..68a8e01 100644 --- a/opcodes/i370-opc.c +++ b/opcodes/i370-opc.c @@ -1,5 +1,5 @@ /* i370-opc.c -- Instruction 370 (ESA/390) architecture opcode list - Copyright 1994, 1999, 2000, 2001, 2003, 2005, 2007 + Copyright 1994, 1999, 2000, 2001, 2003, 2005, 2007, 2012 Free Software Foundation, Inc. PowerPC version written by Ian Lance Taylor, Cygnus Support Rewritten for i370 ESA/390 support by Linas Vepstas <linas@linas.org> 1998, 1999 @@ -21,8 +21,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/i370.h" /* This file holds the i370 opcode table. The opcode table diff --git a/opcodes/m10200-dis.c b/opcodes/m10200-dis.c index 6c69c00..3d2dd83 100644 --- a/opcodes/m10200-dis.c +++ b/opcodes/m10200-dis.c @@ -1,5 +1,6 @@ /* Disassemble MN10200 instructions. - Copyright 1996, 1997, 1998, 2000, 2005, 2007 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 2000, 2005, 2007, 2012 + Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,9 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/mn10200.h" #include "dis-asm.h" #include "opintl.h" diff --git a/opcodes/m10300-dis.c b/opcodes/m10300-dis.c index 1ed50f1..3445fc2 100644 --- a/opcodes/m10300-dis.c +++ b/opcodes/m10300-dis.c @@ -1,5 +1,5 @@ /* Disassemble MN10300 instructions. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,9 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/mn10300.h" #include "dis-asm.h" #include "opintl.h" diff --git a/opcodes/micromips-opc.c b/opcodes/micromips-opc.c index 251d801..0f18c71 100644 --- a/opcodes/micromips-opc.c +++ b/opcodes/micromips-opc.c @@ -1,5 +1,5 @@ /* micromips-opc.c. microMIPS opcode table. - Copyright 2008 Free Software Foundation, Inc. + Copyright 2008, 2012 Free Software Foundation, Inc. Contributed by Chao-ying Fu, MIPS Technologies, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/mips.h" #define UBD INSN_UNCOND_BRANCH_DELAY diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c index 4083c1a..93238d4 100644 --- a/opcodes/mips-opc.c +++ b/opcodes/mips-opc.c @@ -1,6 +1,7 @@ /* mips-opc.c -- MIPS opcode list. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 - 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 + Free Software Foundation, Inc. Contributed by Ralph Campbell and OSF Commented and modified by Ian Lance Taylor, Cygnus Support Extended for MIPS32 support by Anders Norlander, and by SiByte, Inc. @@ -24,8 +25,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/mips.h" /* Short hand so the lines aren't too long. */ diff --git a/opcodes/mips16-opc.c b/opcodes/mips16-opc.c index f46cf28..01cbcde 100644 --- a/opcodes/mips16-opc.c +++ b/opcodes/mips16-opc.c @@ -1,5 +1,5 @@ /* mips16-opc.c. Mips16 opcode table. - Copyright 1996, 1997, 1998, 2000, 2005, 2006, 2007 + Copyright 1996, 1997, 1998, 2000, 2005, 2006, 2007, 2012 Free Software Foundation, Inc. Contributed by Ian Lance Taylor, Cygnus Support @@ -20,8 +20,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/mips.h" /* This is the opcodes table for the mips16 processor. The format of diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c index 4e67e2c..79ef099 100644 --- a/opcodes/moxie-dis.c +++ b/opcodes/moxie-dis.c @@ -1,5 +1,5 @@ /* Disassemble moxie instructions. - Copyright 2009 + Copyright 2009, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> + #define STATIC_TABLE #define DEFINE_TABLE diff --git a/opcodes/or32-opc.c b/opcodes/or32-opc.c index 94a1ace..df99d56 100644 --- a/opcodes/or32-opc.c +++ b/opcodes/or32-opc.c @@ -1,5 +1,6 @@ /* Table of opcodes for the OpenRISC 1000 ISA. - Copyright 2002, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright 2002, 2004, 2005, 2007, 2008, 2009, 2012 + Free Software Foundation, Inc. Contributed by Damjan Lampret (lampret@opencores.org). This file is part of the GNU opcodes library. @@ -19,18 +20,17 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* We treat all letters the same in encode/decode routines so - we need to assign some characteristics to them like signess etc. */ +#include "sysdep.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #include "safe-ctype.h" #include "ansidecl.h" -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif #include "opcode/or32.h" +/* We treat all letters the same in encode/decode routines so + we need to assign some characteristics to them like signess etc. */ + const struct or32_letter or32_letters[] = { { 'A', NUM_UNSIGNED }, diff --git a/opcodes/pj-dis.c b/opcodes/pj-dis.c index 477f406..7bd868e 100644 --- a/opcodes/pj-dis.c +++ b/opcodes/pj-dis.c @@ -1,5 +1,6 @@ /* pj-dis.c -- Disassemble picoJava instructions. - Copyright 1999, 2000, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2005, 2007, 2012 + Free Software Foundation, Inc. Contributed by Steve Chamberlain, of Transmeta (sac@pobox.com). This file is part of the GNU opcodes library. @@ -19,8 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/pj.h" #include "dis-asm.h" diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c index 4792059..bbf3978 100644 --- a/opcodes/ppc-dis.c +++ b/opcodes/ppc-dis.c @@ -20,8 +20,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "dis-asm.h" #include "elf-bfd.h" #include "elf32-ppc.h" diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c index 693eb96..f92979c 100644 --- a/opcodes/ppc-opc.c +++ b/opcodes/ppc-opc.c @@ -21,8 +21,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/ppc.h" #include "opintl.h" diff --git a/opcodes/rl78-decode.c b/opcodes/rl78-decode.c index cb54bd4..7fb2519 100644 --- a/opcodes/rl78-decode.c +++ b/opcodes/rl78-decode.c @@ -1,10 +1,9 @@ #line 1 "rl78-decode.opc" /* -*- c -*- */ +#include "sysdep.h" #include <stdio.h> #include <stdlib.h> #include <string.h> - -#include "config.h" #include "ansidecl.h" #include "opcode/rl78.h" diff --git a/opcodes/rl78-decode.opc b/opcodes/rl78-decode.opc index 4af2bf3..1fe84a6 100644 --- a/opcodes/rl78-decode.opc +++ b/opcodes/rl78-decode.opc @@ -1,9 +1,8 @@ /* -*- c -*- */ +#include "sysdep.h" #include <stdio.h> #include <stdlib.h> #include <string.h> - -#include "config.h" #include "ansidecl.h" #include "opcode/rl78.h" diff --git a/opcodes/rx-decode.c b/opcodes/rx-decode.c index a98de74..580a26d 100644 --- a/opcodes/rx-decode.c +++ b/opcodes/rx-decode.c @@ -1,10 +1,9 @@ #line 1 "rx-decode.opc" /* -*- c -*- */ +#include "sysdep.h" #include <stdio.h> #include <stdlib.h> #include <string.h> - -#include "config.h" #include "ansidecl.h" #include "opcode/rx.h" diff --git a/opcodes/rx-decode.opc b/opcodes/rx-decode.opc index b28ea8c..27ff5d4 100644 --- a/opcodes/rx-decode.opc +++ b/opcodes/rx-decode.opc @@ -1,9 +1,8 @@ /* -*- c -*- */ +#include "sysdep.h" #include <stdio.h> #include <stdlib.h> #include <string.h> - -#include "config.h" #include "ansidecl.h" #include "opcode/rx.h" diff --git a/opcodes/s390-dis.c b/opcodes/s390-dis.c index 37ed2e7..ef73d85 100644 --- a/opcodes/s390-dis.c +++ b/opcodes/s390-dis.c @@ -1,5 +1,5 @@ /* s390-dis.c -- Disassemble S390 instructions - Copyright 2000, 2001, 2002, 2003, 2005, 2007, 2008 + Copyright 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2012 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). @@ -20,9 +20,9 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stdio.h> #include "ansidecl.h" -#include "sysdep.h" #include "dis-asm.h" #include "opintl.h" #include "opcode/s390.h" diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c index 76d1233..e531558 100644 --- a/opcodes/sh-dis.c +++ b/opcodes/sh-dis.c @@ -1,6 +1,6 @@ /* Disassemble SH instructions. Copyright 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,9 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> + #define STATIC_TABLE #define DEFINE_TABLE diff --git a/opcodes/sh64-dis.c b/opcodes/sh64-dis.c index 60963e7..1480a3d 100644 --- a/opcodes/sh64-dis.c +++ b/opcodes/sh64-dis.c @@ -1,5 +1,6 @@ /* Disassemble SH64 instructions. - Copyright 2000, 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2005, 2007, 2012 + Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,10 +19,9 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stdio.h> - #include "dis-asm.h" -#include "sysdep.h" #include "sh64-opc.h" #include "libiberty.h" /* We need to refer to the ELF header structure. */ diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index b0899a6..73f01d3 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -1,6 +1,6 @@ /* Print SPARC instructions. Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 + 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -20,9 +20,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/sparc.h" #include "dis-asm.h" #include "libiberty.h" diff --git a/opcodes/sparc-opc.c b/opcodes/sparc-opc.c index cf00a89..b2e5344 100644 --- a/opcodes/sparc-opc.c +++ b/opcodes/sparc-opc.c @@ -1,6 +1,6 @@ /* Table of opcodes for the sparc. Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2004, 2005, 2006, 2007, 2008, 2011 + 2000, 2002, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -25,8 +25,8 @@ instruction's name rather than the args. This would make gas faster, pinsn slower, but would mess up some macros a bit. xoxorich. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/sparc.h" /* Some defines to make life easy. */ diff --git a/opcodes/spu-dis.c b/opcodes/spu-dis.c index 3e6a762..717daab 100644 --- a/opcodes/spu-dis.c +++ b/opcodes/spu-dis.c @@ -1,6 +1,6 @@ /* Disassemble SPU instructions - Copyright 2006, 2007 Free Software Foundation, Inc. + Copyright 2006, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "dis-asm.h" #include "opcode/spu.h" diff --git a/opcodes/sysdep.h b/opcodes/sysdep.h index 91c53ca..b09d19e 100644 --- a/opcodes/sysdep.h +++ b/opcodes/sysdep.h @@ -27,6 +27,10 @@ trying to replace often did that. If it can be dropped from this file (check in a non-ANSI environment!), it should be. */ +#ifdef PACKAGE +#error sysdep.h must be included in lieu of config.h +#endif + #include "config.h" #include "ansidecl.h" diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c index c6d0e3e..e2a5e6b 100644 --- a/opcodes/tic30-dis.c +++ b/opcodes/tic30-dis.c @@ -1,5 +1,5 @@ /* Disassembly routines for TMS320C30 architecture - Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009 + Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009, 2012 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) @@ -20,9 +20,9 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <errno.h> #include <math.h> -#include "sysdep.h" #include "dis-asm.h" #include "opcode/tic30.h" diff --git a/opcodes/tic54x-dis.c b/opcodes/tic54x-dis.c index 578af10..ba33d5e 100644 --- a/opcodes/tic54x-dis.c +++ b/opcodes/tic54x-dis.c @@ -1,5 +1,6 @@ /* Disassembly routines for TMS320C54X architecture - Copyright 1999, 2000, 2001, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2005, 2007, 2009, 2012 + Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of the GNU opcodes library. @@ -19,10 +20,10 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <errno.h> #include <math.h> #include <stdlib.h> -#include "sysdep.h" #include "dis-asm.h" #include "opcode/tic54x.h" #include "coff/tic54x.h" diff --git a/opcodes/tic80-dis.c b/opcodes/tic80-dis.c index 3089acc..a2f3ae6 100644 --- a/opcodes/tic80-dis.c +++ b/opcodes/tic80-dis.c @@ -1,5 +1,6 @@ /* Print TI TMS320C80 (MVP) instructions - Copyright 1996, 1997, 1998, 2000, 2005, 2007 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 2000, 2005, 2007, 2012 + Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,9 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/tic80.h" #include "dis-asm.h" diff --git a/opcodes/tic80-opc.c b/opcodes/tic80-opc.c index 70e38ec..b4ac198 100644 --- a/opcodes/tic80-opc.c +++ b/opcodes/tic80-opc.c @@ -1,5 +1,6 @@ /* Opcode table for TI TMS320C80 (MVP). - Copyright 1996, 1997, 2000, 2005, 2007 Free Software Foundation, Inc. + Copyright 1996, 1997, 2000, 2005, 2007, 2012 + Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,8 +19,8 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/tic80.h" /* This file holds various tables for the TMS320C80 (MVP). diff --git a/opcodes/tilegx-dis.c b/opcodes/tilegx-dis.c index 3754756..fb713c1 100644 --- a/opcodes/tilegx-dis.c +++ b/opcodes/tilegx-dis.c @@ -1,5 +1,5 @@ /* tilegx-dis.c. Disassembly routines for the TILE-Gx architecture. - Copyright 2011 Free Software Foundation, Inc. + Copyright 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,12 +18,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stddef.h> #include <assert.h> #include "bfd.h" #include "elf/tilegx.h" #include "elf-bfd.h" -#include "sysdep.h" #include "dis-asm.h" #include "opcode/tilegx.h" diff --git a/opcodes/tilepro-dis.c b/opcodes/tilepro-dis.c index bf9910c..a0a8c9a 100644 --- a/opcodes/tilepro-dis.c +++ b/opcodes/tilepro-dis.c @@ -1,5 +1,5 @@ /* tilepro-dis.c. Disassembly routines for the TILEPro architecture. - Copyright 2011 Free Software Foundation, Inc. + Copyright 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -18,12 +18,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stddef.h> #include <assert.h> #include "bfd.h" #include "elf/tilepro.h" #include "elf-bfd.h" -#include "sysdep.h" #include "dis-asm.h" #include "opcode/tilepro.h" diff --git a/opcodes/v850-dis.c b/opcodes/v850-dis.c index cf0d386..b4e786e 100644 --- a/opcodes/v850-dis.c +++ b/opcodes/v850-dis.c @@ -1,6 +1,6 @@ /* Disassemble V850 instructions. - Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010 - Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010, + 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -20,9 +20,8 @@ MA 02110-1301, USA. */ -#include <stdio.h> - #include "sysdep.h" +#include <stdio.h> #include "opcode/v850.h" #include "dis-asm.h" #include "opintl.h" diff --git a/opcodes/v850-opc.c b/opcodes/v850-opc.c index 4ba20d3..0867d43 100644 --- a/opcodes/v850-opc.c +++ b/opcodes/v850-opc.c @@ -19,8 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> #include "opcode/v850.h" #include "bfd.h" #include "opintl.h" diff --git a/opcodes/vax-dis.c b/opcodes/vax-dis.c index a119f05..818b41a 100644 --- a/opcodes/vax-dis.c +++ b/opcodes/vax-dis.c @@ -1,5 +1,5 @@ /* Print VAX instructions. - Copyright 1995, 1998, 2000, 2001, 2002, 2005, 2007, 2009 + Copyright 1995, 1998, 2000, 2001, 2002, 2005, 2007, 2009, 2012 Free Software Foundation, Inc. Contributed by Pauline Middelink <middelin@polyware.iaf.nl> @@ -20,9 +20,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <setjmp.h> #include <string.h> -#include "sysdep.h" #include "opcode/vax.h" #include "dis-asm.h" diff --git a/opcodes/w65-dis.c b/opcodes/w65-dis.c index 60d9b04..943e432 100644 --- a/opcodes/w65-dis.c +++ b/opcodes/w65-dis.c @@ -1,5 +1,5 @@ /* Disassemble WDC 65816 instructions. - Copyright 1995, 1998, 2000, 2001, 2002, 2005, 2007 + Copyright 1995, 1998, 2000, 2001, 2002, 2005, 2007, 2012 Free Software Foundation, Inc. This file is part of the GNU opcodes library. @@ -19,8 +19,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> #include "sysdep.h" +#include <stdio.h> + #define STATIC_TABLE #define DEFINE_TABLE diff --git a/opcodes/xgate-dis.c b/opcodes/xgate-dis.c index f703055..8c722f5 100644 --- a/opcodes/xgate-dis.c +++ b/opcodes/xgate-dis.c @@ -1,5 +1,5 @@ /* xgate-dis.c -- Freescale XGATE disassembly - Copyright 2009, 2010, 2011 + Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Written by Sean Keys (skeys@ipdatasys.com) @@ -18,11 +18,10 @@ 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. -*/ + MA 02110-1301, USA. */ -#include <assert.h> #include "sysdep.h" +#include <assert.h> #include "dis-asm.h" #include "opintl.h" #include "libiberty.h" @@ -35,34 +34,31 @@ #define XGATE_NINE_SIGNBIT 0x100 #define XGATE_TEN_SIGNBIT 0x200 -/* Structures */ -struct decodeInfo { +/* Structures. */ +struct decodeInfo +{ unsigned int operMask; unsigned int operMasksRegisterBits; struct xgate_opcode *opcodePTR; }; /* Prototypes for local functions. */ -static int -print_insn( bfd_vma, struct disassemble_info *); -static int -read_memory( bfd_vma, bfd_byte*, int, struct disassemble_info *); -static int -ripBits(unsigned int *, int, - struct xgate_opcode *, unsigned int); -int -macro_search(char *, char *); -struct decodeInfo * -find_match(unsigned int raw_code); +static int print_insn (bfd_vma, struct disassemble_info *); +static int read_memory (bfd_vma, bfd_byte*, int, struct disassemble_info *); +static int ripBits (unsigned int *, int, + struct xgate_opcode *, unsigned int); +static int macro_search (char *, char *); +static struct decodeInfo * find_match (unsigned int); -/* statics */ +/* Statics. */ static struct decodeInfo *decodeTable; static int initialized; static char previousOpName[10]; static unsigned int perviousBin; /* Disassemble one instruction at address 'memaddr'. Returns the number - of bytes used by that instruction. */ + of bytes used by that instruction. */ + static int print_insn (bfd_vma memaddr, struct disassemble_info* info) { @@ -82,11 +78,11 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) bfd_vma absAddress; unsigned int operMaskReg = 0; - /* initialize our array of opcode masks and check them against our constant - table */ + /* Initialize our array of opcode masks and check them against our constant + table. */ if (!initialized) { - decodeTable = xmalloc(sizeof(struct decodeInfo) * xgate_num_opcodes); + decodeTable = xmalloc (sizeof (struct decodeInfo) * xgate_num_opcodes); for (i = 0, decodeTablePTR = decodeTable; i < xgate_num_opcodes; i++, decodeTablePTR++, opcodePTR++) { @@ -101,33 +97,35 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) mask |= (*s == '0' || *s == '1'); operandRegisterBits |= (*s == 'r'); } - /* asserting will uncover inconsistencies in our table */ - assert( - (s - opcodePTR->format) == 16 || (s - opcodePTR->format) == 32); - assert(opcodePTR->bin_opcode == bin); + /* Asserting will uncover inconsistencies in our table. */ + assert ((s - opcodePTR->format) == 16 || (s - opcodePTR->format) == 32); + assert (opcodePTR->bin_opcode == bin); + decodeTablePTR->operMask = mask; decodeTablePTR->operMasksRegisterBits = operandRegisterBits; decodeTablePTR->opcodePTR = opcodePTR; } initialized = 1; } - /* read 16 bits */ + + /* Read 16 bits. */ bytesRead += XGATE_TWO_BYTES; - status = read_memory(memaddr, buffer, XGATE_TWO_BYTES, info); + status = read_memory (memaddr, buffer, XGATE_TWO_BYTES, info); if (status == 0) { raw_code = buffer[0]; raw_code <<= 8; raw_code += buffer[1]; - decodePTR = find_match(raw_code); + decodePTR = find_match (raw_code); if (decodePTR) { operMaskReg = decodePTR->operMasksRegisterBits; (*info->fprintf_func)(info->stream, "%s", decodePTR->opcodePTR->name); + /* First we compare the shorthand format of the constraints. If we - still are unable to pinpoint the operands - we analyze the opcodes constraint string. */ + still are unable to pinpoint the operands + we analyze the opcodes constraint string. */ switch (decodePTR->opcodePTR->sh_format) { case XG_R_C: @@ -145,13 +143,13 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) case XG_INH: break; case XG_R_R_R: - if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_TRI)) + if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_TRI)) { (*info->fprintf_func)(info->stream, " R%x, R%x, R%x", (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, (raw_code >> 2) & 0x7); } - else if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_IDR)) + else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDR)) { if (raw_code & 0x01) { @@ -179,19 +177,19 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) } break; case XG_R_R: - if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_DYA_MON)) + if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA_MON)) { - operandOne = ripBits(&operMaskReg, 3, decodePTR->opcodePTR, + operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR, raw_code); - operandTwo = ripBits(&operMaskReg, 3, decodePTR->opcodePTR, + operandTwo = ripBits (&operMaskReg, 3, decodePTR->opcodePTR, raw_code); (*info->fprintf_func)(info->stream, " R%x, R%x", operandOne, operandTwo); } - else if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_DYA)) + else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA)) { - operandOne = ripBits(&operMaskReg, 3, opcodePTR, raw_code); - operandTwo = ripBits(&operMaskReg, 3, opcodePTR, raw_code); + operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code); + operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code); (*info->fprintf_func)(info->stream, " R%x, R%x", operandOne, operandTwo); } @@ -206,20 +204,20 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, raw_code & 0x1f); break; case XG_R: - operandOne = ripBits(&operMaskReg, 3, decodePTR->opcodePTR, + operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR, raw_code); (*info->fprintf_func)(info->stream, " R%x", operandOne); break; case XG_I | XG_PCREL: - if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_REL9)) + if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL9)) { - /* if address is negative handle it accordingly */ + /* If address is negative handle it accordingly. */ if (raw_code & XGATE_NINE_SIGNBIT) { - relAddr = XGATE_NINE_BITS >> 1; /* clip sign bit */ - relAddr = ~relAddr; /* make signed */ - relAddr |= (raw_code & 0xFF) + 1; /* apply our value */ - relAddr <<= 1; /* multiply by two as per processor docs */ + relAddr = XGATE_NINE_BITS >> 1; /* Clip sign bit. */ + relAddr = ~relAddr; /* Make signed. */ + relAddr |= (raw_code & 0xFF) + 1; /* Apply our value. */ + relAddr <<= 1; /* Multiply by two as per processor docs. */ } else { @@ -230,15 +228,15 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) (*info->fprintf_func)(info->stream, " Abs* 0x"); (*info->print_address_func)(memaddr + relAddr, info); } - else if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_REL10)) + else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL10)) { - /* if address is negative handle it accordingly */ + /* If address is negative handle it accordingly. */ if (raw_code & XGATE_TEN_SIGNBIT) { - relAddr = XGATE_TEN_BITS >> 1; /* clip sign bit */ - relAddr = ~relAddr; /* make signed */ - relAddr |= (raw_code & 0x1FF) + 1; /* apply our value */ - relAddr <<= 1; /* multiply by two as per processor docs */ + relAddr = XGATE_TEN_BITS >> 1; /* Clip sign bit. */ + relAddr = ~relAddr; /* Make signed. */ + relAddr |= (raw_code & 0x1FF) + 1; /* Apply our value. */ + relAddr <<= 1; /* Multiply by two as per processor docs. */ } else { @@ -257,14 +255,14 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) } break; case XG_R_I: - if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_IMM4)) + if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM4)) { (*info->fprintf_func)(info->stream, " R%x, #0x%02x", (raw_code >> 8) & 0x7, (raw_code >> 4) & 0xF); } - else if (!strcmp(decodePTR->opcodePTR->constraints, XGATE_OP_IMM8)) + else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM8)) { - if (macro_search(decodePTR->opcodePTR->name, previousOpName) && + if (macro_search (decodePTR->opcodePTR->name, previousOpName) && previousOpName[0]) { absAddress = (0xFF & raw_code) << 8; @@ -276,7 +274,7 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) } else { - strcpy(previousOpName, decodePTR->opcodePTR->name); + strcpy (previousOpName, decodePTR->opcodePTR->name); (*info->fprintf_func)(info->stream, " R%x, #0x%02x", (raw_code >> 8) & 0x7, raw_code & 0xff); } @@ -302,7 +300,7 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) else { (*info->fprintf_func)(info->stream, - " unable to find opcode match #0%x", raw_code); + " unable to find opcode match #0%x", raw_code); } } return bytesRead; @@ -329,45 +327,51 @@ read_memory (bfd_vma memaddr, bfd_byte* buffer, int size, } static int -ripBits(unsigned int *operandBitsRemaining, int numBitsRequested, - struct xgate_opcode *opcodePTR, unsigned int memory) +ripBits (unsigned int *operandBitsRemaining, + int numBitsRequested, + struct xgate_opcode *opcodePTR, + unsigned int memory) { unsigned int currentBit; int operand; int numBitsFound; + for (operand = 0, numBitsFound = 0, currentBit = 1 - << ((opcodePTR->size * 8) - 1); - (numBitsFound < numBitsRequested) && currentBit; currentBit >>= 1) + << ((opcodePTR->size * 8) - 1); + (numBitsFound < numBitsRequested) && currentBit; currentBit >>= 1) { - if(currentBit & *operandBitsRemaining) { - *operandBitsRemaining &= ~(currentBit); /* consume the current bit */ - operand <<= 1; /* make room for our next bit */ - numBitsFound++; - operand |= (currentBit & memory) > 0; - } - } + if (currentBit & *operandBitsRemaining) + { + *operandBitsRemaining &= ~(currentBit); /* Consume the current bit. */ + operand <<= 1; /* Make room for our next bit. */ + numBitsFound++; + operand |= (currentBit & memory) > 0; + } + } return operand; } -int -macro_search(char *currentName, char *lastName) +static int +macro_search (char *currentName, char *lastName) { int i; int length = 0; char *where; + for (i = 0; i < xgate_num_opcodes; i++) { - where = strstr(xgate_opcodes[i].constraints, lastName); + where = strstr (xgate_opcodes[i].constraints, lastName); + if (where) { - length = strlen(where); + length = strlen (where); } if (length) { - where = strstr(xgate_opcodes[i].constraints, currentName); + where = strstr (xgate_opcodes[i].constraints, currentName); if (where) { - length = strlen(where); + length = strlen (where); return 1; } } @@ -375,8 +379,8 @@ macro_search(char *currentName, char *lastName) return 0; } -struct decodeInfo* -find_match(unsigned int raw_code) +static struct decodeInfo * +find_match (unsigned int raw_code) { struct decodeInfo *decodeTablePTR = 0; int i; @@ -387,16 +391,14 @@ find_match(unsigned int raw_code) if ((raw_code & decodeTablePTR->operMask) == decodeTablePTR->opcodePTR->bin_opcode) { - /* make sure we didn't run into a macro or alias */ + /* Make sure we didn't run into a macro or alias. */ if (decodeTablePTR->opcodePTR->cycles_min != 0) { return decodeTablePTR; break; } else - { - continue; - } + continue; } } return 0; diff --git a/opcodes/xtensa-dis.c b/opcodes/xtensa-dis.c index 768d8f3..c21024e 100644 --- a/opcodes/xtensa-dis.c +++ b/opcodes/xtensa-dis.c @@ -1,5 +1,5 @@ /* xtensa-dis.c. Disassembly functions for Xtensa. - Copyright 2003, 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005, 2007, 2012 Free Software Foundation, Inc. Contributed by Bob Wilson at Tensilica, Inc. (bwilson@tensilica.com) This file is part of the GNU opcodes library. @@ -19,6 +19,7 @@ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "sysdep.h" #include <stdlib.h> #include <stdio.h> #include <sys/types.h> @@ -26,7 +27,6 @@ #include "xtensa-isa.h" #include "ansidecl.h" #include "libiberty.h" -#include "sysdep.h" #include "dis-asm.h" #include <setjmp.h> |