Search
lxdream.org :: lxdream/src/xlat/disasm/dis-asm.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/disasm/dis-asm.h
changeset 1265:7c6c5d26fd2e
prev1264:74ad81710528
author nkeynes
date Tue Mar 06 12:42:33 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Merge ARM disassembler from binutils 2.22
file annotate diff log raw
1.1 --- a/src/xlat/disasm/dis-asm.h Tue Mar 06 12:19:08 2012 +1000
1.2 +++ b/src/xlat/disasm/dis-asm.h Tue Mar 06 12:42:33 2012 +1000
1.3 @@ -1,11 +1,11 @@
1.4 /* Interface between the opcode library and its callers.
1.5
1.6 - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
1.7 - Free Software Foundation, Inc.
1.8 -
1.9 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010,
1.10 + 2011 Free Software Foundation, Inc.
1.11 +
1.12 This program is free software; you can redistribute it and/or modify
1.13 it under the terms of the GNU General Public License as published by
1.14 - the Free Software Foundation; either version 2, or (at your option)
1.15 + the Free Software Foundation; either version 3, or (at your option)
1.16 any later version.
1.17
1.18 This program is distributed in the hope that it will be useful,
1.19 @@ -15,9 +15,9 @@
1.20
1.21 You should have received a copy of the GNU General Public License
1.22 along with this program; if not, write to the Free Software
1.23 - Foundation, Inc., 59 Temple Place - Suite 330,
1.24 - Boston, MA 02111-1307, USA.
1.25 -
1.26 + Foundation, Inc., 51 Franklin Street - Fifth Floor,
1.27 + Boston, MA 02110-1301, USA.
1.28 +
1.29 Written by Cygnus Support, 1993.
1.30
1.31 The opcode library (libopcodes.a) provides instruction decoders for
1.32 @@ -35,20 +35,21 @@
1.33 #include <stdio.h>
1.34 #include "xlat/disasm/bfd.h"
1.35
1.36 -typedef int (*fprintf_ftype) (void *, const char*, ...);
1.37 + typedef int (*fprintf_ftype) (void *, const char*, ...) /*ATTRIBUTE_FPTR_PRINTF_2*/;
1.38
1.39 -enum dis_insn_type {
1.40 - dis_noninsn, /* Not a valid instruction */
1.41 - dis_nonbranch, /* Not a branch instruction */
1.42 - dis_branch, /* Unconditional branch */
1.43 - dis_condbranch, /* Conditional branch */
1.44 - dis_jsr, /* Jump to subroutine */
1.45 - dis_condjsr, /* Conditional jump to subroutine */
1.46 - dis_dref, /* Data reference instruction */
1.47 - dis_dref2 /* Two data references in instruction */
1.48 +enum dis_insn_type
1.49 +{
1.50 + dis_noninsn, /* Not a valid instruction. */
1.51 + dis_nonbranch, /* Not a branch instruction. */
1.52 + dis_branch, /* Unconditional branch. */
1.53 + dis_condbranch, /* Conditional branch. */
1.54 + dis_jsr, /* Jump to subroutine. */
1.55 + dis_condjsr, /* Conditional jump to subroutine. */
1.56 + dis_dref, /* Data reference instruction. */
1.57 + dis_dref2 /* Two data references in instruction. */
1.58 };
1.59
1.60 -/* This struct is passed into the instruction decoding routine,
1.61 +/* This struct is passed into the instruction decoding routine,
1.62 and is passed back out into each callback. The various fields are used
1.63 for conveying information from your main routine into your callbacks,
1.64 for passing information into the instruction decoders (such as the
1.65 @@ -58,7 +59,8 @@
1.66 It must be initialized before it is first passed; this can be done
1.67 by hand, or using one of the initialization macros below. */
1.68
1.69 -typedef struct disassemble_info {
1.70 +typedef struct disassemble_info
1.71 +{
1.72 fprintf_ftype fprintf_func;
1.73 void *stream;
1.74 void *application_data;
1.75 @@ -74,11 +76,13 @@
1.76 unsigned long mach;
1.77 /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */
1.78 enum bfd_endian endian;
1.79 + /* Endianness of code, for mixed-endian situations such as ARM BE8. */
1.80 + enum bfd_endian endian_code;
1.81 /* An arch/mach-specific bitmask of selected instruction subsets, mainly
1.82 for processors with run-time-switchable instruction sets. The default,
1.83 zero, means that there is no constraint. CGEN-based opcodes ports
1.84 may use ISA_foo masks. */
1.85 - unsigned long insn_sets;
1.86 + void *insn_sets;
1.87
1.88 /* Some targets need information about the current section to accurately
1.89 display insns. If this is NULL, the target disassembler function
1.90 @@ -94,11 +98,26 @@
1.91 /* Number of symbols in array. */
1.92 int num_symbols;
1.93
1.94 + /* Symbol table provided for targets that want to look at it. This is
1.95 + used on Arm to find mapping symbols and determine Arm/Thumb code. */
1.96 + asymbol **symtab;
1.97 + int symtab_pos;
1.98 + int symtab_size;
1.99 +
1.100 /* For use by the disassembler.
1.101 The top 16 bits are reserved for public use (and are documented here).
1.102 The bottom 16 bits are for the internal use of the disassembler. */
1.103 unsigned long flags;
1.104 -#define INSN_HAS_RELOC 0x80000000
1.105 + /* Set if the disassembler has determined that there are one or more
1.106 + relocations associated with the instruction being disassembled. */
1.107 +#define INSN_HAS_RELOC (1 << 31)
1.108 + /* Set if the user has requested the disassembly of data as well as code. */
1.109 +#define DISASSEMBLE_DATA (1 << 30)
1.110 + /* Set if the user has specifically set the machine type encoded in the
1.111 + mach field of this structure. */
1.112 +#define USER_SPECIFIED_MACHINE_TYPE (1 << 29)
1.113 +
1.114 + /* Use internally by the target specific disassembly code. */
1.115 void *private_data;
1.116
1.117 /* Function used to get bytes to disassemble. MEMADDR is the
1.118 @@ -108,18 +127,18 @@
1.119 Returns an errno value or 0 for success. */
1.120 int (*read_memory_func)
1.121 (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
1.122 - struct disassemble_info *info);
1.123 + struct disassemble_info *dinfo);
1.124
1.125 /* Function which should be called if we get an error that we can't
1.126 recover from. STATUS is the errno value from read_memory_func and
1.127 MEMADDR is the address that we were trying to read. INFO is a
1.128 pointer to this struct. */
1.129 void (*memory_error_func)
1.130 - (int status, bfd_vma memaddr, struct disassemble_info *info);
1.131 + (int status, bfd_vma memaddr, struct disassemble_info *dinfo);
1.132
1.133 /* Function called to print ADDR. */
1.134 void (*print_address_func)
1.135 - (bfd_vma addr, struct disassemble_info *info);
1.136 + (bfd_vma addr, struct disassemble_info *dinfo);
1.137
1.138 /* Function called to determine if there is a symbol at the given ADDR.
1.139 If there is, the function returns 1, otherwise it returns 0.
1.140 @@ -129,14 +148,14 @@
1.141 address, (normally because there is a symbol associated with
1.142 that address), but sometimes we want to mask out the overlay bits. */
1.143 int (* symbol_at_address_func)
1.144 - (bfd_vma addr, struct disassemble_info * info);
1.145 + (bfd_vma addr, struct disassemble_info *dinfo);
1.146
1.147 /* Function called to check if a SYMBOL is can be displayed to the user.
1.148 This is used by some ports that want to hide special symbols when
1.149 displaying debugging outout. */
1.150 bfd_boolean (* symbol_is_valid)
1.151 - (asymbol *, struct disassemble_info * info);
1.152 -
1.153 + (asymbol *, struct disassemble_info *dinfo);
1.154 +
1.155 /* These are for buffer_read_memory. */
1.156 bfd_byte *buffer;
1.157 bfd_vma buffer_vma;
1.158 @@ -156,7 +175,7 @@
1.159 int bytes_per_chunk;
1.160 enum bfd_endian display_endian;
1.161
1.162 - /* Number of octets per incremented target address
1.163 + /* Number of octets per incremented target address
1.164 Normally one, but some DSPs have byte sizes of 16 or 32 bits. */
1.165 unsigned int octets_per_byte;
1.166
1.167 @@ -172,6 +191,9 @@
1.168 alignment. */
1.169 unsigned int skip_zeroes_at_end;
1.170
1.171 + /* Whether the disassembler always needs the relocations. */
1.172 + bfd_boolean disassembler_needs_relocs;
1.173 +
1.174 /* Results from instruction decoders. Not all decoders yet support
1.175 this information. This info is set each time an instruction is
1.176 decoded, and is only valid for the last such instruction.
1.177 @@ -198,82 +220,97 @@
1.178 target address. Return number of octets processed. */
1.179 typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);
1.180
1.181 +extern int print_insn_alpha (bfd_vma, disassemble_info *);
1.182 +extern int print_insn_avr (bfd_vma, disassemble_info *);
1.183 +extern int print_insn_bfin (bfd_vma, disassemble_info *);
1.184 +extern int print_insn_big_arm (bfd_vma, disassemble_info *);
1.185 extern int print_insn_big_mips (bfd_vma, disassemble_info *);
1.186 -extern int print_insn_little_mips (bfd_vma, disassemble_info *);
1.187 -extern int print_insn_i386 (bfd_vma, disassemble_info *);
1.188 -extern int print_insn_i386_att (bfd_vma, disassemble_info *);
1.189 -extern int print_insn_i386_intel (bfd_vma, disassemble_info *);
1.190 -extern int print_insn_ia64 (bfd_vma, disassemble_info *);
1.191 -extern int print_insn_i370 (bfd_vma, disassemble_info *);
1.192 -extern int print_insn_m68hc11 (bfd_vma, disassemble_info *);
1.193 -extern int print_insn_m68hc12 (bfd_vma, disassemble_info *);
1.194 -extern int print_insn_m68k (bfd_vma, disassemble_info *);
1.195 -extern int print_insn_z8001 (bfd_vma, disassemble_info *);
1.196 -extern int print_insn_z8002 (bfd_vma, disassemble_info *);
1.197 +extern int print_insn_big_or32 (bfd_vma, disassemble_info *);
1.198 +extern int print_insn_big_powerpc (bfd_vma, disassemble_info *);
1.199 +extern int print_insn_big_score (bfd_vma, disassemble_info *);
1.200 +extern int print_insn_cr16 (bfd_vma, disassemble_info *);
1.201 +extern int print_insn_crx (bfd_vma, disassemble_info *);
1.202 +extern int print_insn_d10v (bfd_vma, disassemble_info *);
1.203 +extern int print_insn_d30v (bfd_vma, disassemble_info *);
1.204 +extern int print_insn_dlx (bfd_vma, disassemble_info *);
1.205 +extern int print_insn_fr30 (bfd_vma, disassemble_info *);
1.206 +extern int print_insn_frv (bfd_vma, disassemble_info *);
1.207 extern int print_insn_h8300 (bfd_vma, disassemble_info *);
1.208 extern int print_insn_h8300h (bfd_vma, disassemble_info *);
1.209 extern int print_insn_h8300s (bfd_vma, disassemble_info *);
1.210 extern int print_insn_h8500 (bfd_vma, disassemble_info *);
1.211 -extern int print_insn_alpha (bfd_vma, disassemble_info *);
1.212 -extern int print_insn_big_arm (bfd_vma, disassemble_info *);
1.213 -extern int print_insn_little_arm (bfd_vma, disassemble_info *);
1.214 -extern int print_insn_sparc (bfd_vma, disassemble_info *);
1.215 -extern int print_insn_big_a29k (bfd_vma, disassemble_info *);
1.216 -extern int print_insn_little_a29k (bfd_vma, disassemble_info *);
1.217 -extern int print_insn_avr (bfd_vma, disassemble_info *);
1.218 -extern int print_insn_d10v (bfd_vma, disassemble_info *);
1.219 -extern int print_insn_d30v (bfd_vma, disassemble_info *);
1.220 -extern int print_insn_dlx (bfd_vma, disassemble_info *);
1.221 -extern int print_insn_fr30 (bfd_vma, disassemble_info *);
1.222 extern int print_insn_hppa (bfd_vma, disassemble_info *);
1.223 +extern int print_insn_i370 (bfd_vma, disassemble_info *);
1.224 +extern int print_insn_i386 (bfd_vma, disassemble_info *);
1.225 +extern int print_insn_i386_att (bfd_vma, disassemble_info *);
1.226 +extern int print_insn_i386_intel (bfd_vma, disassemble_info *);
1.227 extern int print_insn_i860 (bfd_vma, disassemble_info *);
1.228 extern int print_insn_i960 (bfd_vma, disassemble_info *);
1.229 +extern int print_insn_ia64 (bfd_vma, disassemble_info *);
1.230 extern int print_insn_ip2k (bfd_vma, disassemble_info *);
1.231 +extern int print_insn_iq2000 (bfd_vma, disassemble_info *);
1.232 +extern int print_insn_little_arm (bfd_vma, disassemble_info *);
1.233 +extern int print_insn_little_mips (bfd_vma, disassemble_info *);
1.234 +extern int print_insn_little_or32 (bfd_vma, disassemble_info *);
1.235 +extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
1.236 +extern int print_insn_little_score (bfd_vma, disassemble_info *);
1.237 +extern int print_insn_lm32 (bfd_vma, disassemble_info *);
1.238 +extern int print_insn_m32c (bfd_vma, disassemble_info *);
1.239 extern int print_insn_m32r (bfd_vma, disassemble_info *);
1.240 +extern int print_insn_m68hc11 (bfd_vma, disassemble_info *);
1.241 +extern int print_insn_m68hc12 (bfd_vma, disassemble_info *);
1.242 +extern int print_insn_m68k (bfd_vma, disassemble_info *);
1.243 extern int print_insn_m88k (bfd_vma, disassemble_info *);
1.244 -extern int print_insn_maxq_little (bfd_vma, disassemble_info *);
1.245 -extern int print_insn_maxq_big (bfd_vma, disassemble_info *);
1.246 extern int print_insn_mcore (bfd_vma, disassemble_info *);
1.247 +extern int print_insn_mep (bfd_vma, disassemble_info *);
1.248 +extern int print_insn_microblaze (bfd_vma, disassemble_info *);
1.249 extern int print_insn_mmix (bfd_vma, disassemble_info *);
1.250 extern int print_insn_mn10200 (bfd_vma, disassemble_info *);
1.251 extern int print_insn_mn10300 (bfd_vma, disassemble_info *);
1.252 +extern int print_insn_moxie (bfd_vma, disassemble_info *);
1.253 extern int print_insn_msp430 (bfd_vma, disassemble_info *);
1.254 +extern int print_insn_mt (bfd_vma, disassemble_info *);
1.255 extern int print_insn_ns32k (bfd_vma, disassemble_info *);
1.256 -extern int print_insn_crx (bfd_vma, disassemble_info *);
1.257 extern int print_insn_openrisc (bfd_vma, disassemble_info *);
1.258 -extern int print_insn_big_or32 (bfd_vma, disassemble_info *);
1.259 -extern int print_insn_little_or32 (bfd_vma, disassemble_info *);
1.260 extern int print_insn_pdp11 (bfd_vma, disassemble_info *);
1.261 extern int print_insn_pj (bfd_vma, disassemble_info *);
1.262 -extern int print_insn_big_powerpc (bfd_vma, disassemble_info *);
1.263 -extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
1.264 extern int print_insn_rs6000 (bfd_vma, disassemble_info *);
1.265 -extern int print_insn_s390 (bfd_vma, disassemble_info *);
1.266 +extern int print_insn_s390 (bfd_vma, disassemble_info *);
1.267 extern int print_insn_sh (bfd_vma, disassemble_info *);
1.268 +extern int print_insn_sh64 (bfd_vma, disassemble_info *);
1.269 +extern int print_insn_sh64x_media (bfd_vma, disassemble_info *);
1.270 +extern int print_insn_sparc (bfd_vma, disassemble_info *);
1.271 +extern int print_insn_spu (bfd_vma, disassemble_info *);
1.272 extern int print_insn_tic30 (bfd_vma, disassemble_info *);
1.273 extern int print_insn_tic4x (bfd_vma, disassemble_info *);
1.274 extern int print_insn_tic54x (bfd_vma, disassemble_info *);
1.275 +extern int print_insn_tic6x (bfd_vma, disassemble_info *);
1.276 extern int print_insn_tic80 (bfd_vma, disassemble_info *);
1.277 +extern int print_insn_tilegx (bfd_vma, disassemble_info *);
1.278 +extern int print_insn_tilepro (bfd_vma, disassemble_info *);
1.279 extern int print_insn_v850 (bfd_vma, disassemble_info *);
1.280 extern int print_insn_vax (bfd_vma, disassemble_info *);
1.281 extern int print_insn_w65 (bfd_vma, disassemble_info *);
1.282 +extern int print_insn_xc16x (bfd_vma, disassemble_info *);
1.283 extern int print_insn_xstormy16 (bfd_vma, disassemble_info *);
1.284 extern int print_insn_xtensa (bfd_vma, disassemble_info *);
1.285 -extern int print_insn_sh64 (bfd_vma, disassemble_info *);
1.286 -extern int print_insn_sh64x_media (bfd_vma, disassemble_info *);
1.287 -extern int print_insn_frv (bfd_vma, disassemble_info *);
1.288 -extern int print_insn_iq2000 (bfd_vma, disassemble_info *);
1.289 +extern int print_insn_z80 (bfd_vma, disassemble_info *);
1.290 +extern int print_insn_z8001 (bfd_vma, disassemble_info *);
1.291 +extern int print_insn_z8002 (bfd_vma, disassemble_info *);
1.292 +extern int print_insn_rx (bfd_vma, disassemble_info *);
1.293
1.294 extern disassembler_ftype arc_get_disassembler (void *);
1.295 extern disassembler_ftype cris_get_disassembler (bfd *);
1.296
1.297 +extern void print_i386_disassembler_options (FILE *);
1.298 extern void print_mips_disassembler_options (FILE *);
1.299 extern void print_ppc_disassembler_options (FILE *);
1.300 extern void print_arm_disassembler_options (FILE *);
1.301 extern void parse_arm_disassembler_option (char *);
1.302 -extern int get_arm_regname_num_options (void);
1.303 -extern int set_arm_regname_option (int);
1.304 -extern int get_arm_regnames (int, const char **, const char **, const char ***);
1.305 +extern void print_s390_disassembler_options (FILE *);
1.306 +extern int get_arm_regname_num_options (void);
1.307 +extern int set_arm_regname_option (int);
1.308 +extern int get_arm_regnames (int, const char **, const char **, const char *const **);
1.309 extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *);
1.310
1.311 /* Fetch the disassembler for a given BFD, if that support is available. */
1.312 @@ -281,7 +318,7 @@
1.313
1.314 /* Amend the disassemble_info structure as necessary for the target architecture.
1.315 Should only be called after initialising the info->arch field. */
1.316 -extern void disassemble_init_for_target (struct disassemble_info * info);
1.317 +extern void disassemble_init_for_target (struct disassemble_info * dinfo);
1.318
1.319 /* Document any target specific options available from the disassembler. */
1.320 extern void disassembler_usage (FILE *);
1.321 @@ -310,13 +347,13 @@
1.322 extern int generic_symbol_at_address
1.323 (bfd_vma, struct disassemble_info *);
1.324
1.325 -/* Also always true. */
1.326 +/* Also always true. */
1.327 extern bfd_boolean generic_symbol_is_valid
1.328 (asymbol *, struct disassemble_info *);
1.329 -
1.330 +
1.331 /* Method to initialize a disassemble_info struct. This should be
1.332 called by all applications creating such a struct. */
1.333 -extern void init_disassemble_info (struct disassemble_info *info, void *stream,
1.334 +extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream,
1.335 fprintf_ftype fprintf_func);
1.336
1.337 /* For compatibility with existing code. */
.