xref: /dflybsd-src/contrib/gdb-7/include/dis-asm.h (revision 5796c8dc12c637f18a1740c26afd8d40ffa9b719)
1*5796c8dcSSimon Schubert /* Interface between the opcode library and its callers.
2*5796c8dcSSimon Schubert 
3*5796c8dcSSimon Schubert    Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
4*5796c8dcSSimon Schubert    Free Software Foundation, Inc.
5*5796c8dcSSimon Schubert 
6*5796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
7*5796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
8*5796c8dcSSimon Schubert    the Free Software Foundation; either version 2, or (at your option)
9*5796c8dcSSimon Schubert    any later version.
10*5796c8dcSSimon Schubert 
11*5796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
12*5796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*5796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*5796c8dcSSimon Schubert    GNU General Public License for more details.
15*5796c8dcSSimon Schubert 
16*5796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
17*5796c8dcSSimon Schubert    along with this program; if not, write to the Free Software
18*5796c8dcSSimon Schubert    Foundation, Inc., 51 Franklin Street - Fifth Floor,
19*5796c8dcSSimon Schubert    Boston, MA 02110-1301, USA.
20*5796c8dcSSimon Schubert 
21*5796c8dcSSimon Schubert    Written by Cygnus Support, 1993.
22*5796c8dcSSimon Schubert 
23*5796c8dcSSimon Schubert    The opcode library (libopcodes.a) provides instruction decoders for
24*5796c8dcSSimon Schubert    a large variety of instruction sets, callable with an identical
25*5796c8dcSSimon Schubert    interface, for making instruction-processing programs more independent
26*5796c8dcSSimon Schubert    of the instruction set being processed.  */
27*5796c8dcSSimon Schubert 
28*5796c8dcSSimon Schubert #ifndef DIS_ASM_H
29*5796c8dcSSimon Schubert #define DIS_ASM_H
30*5796c8dcSSimon Schubert 
31*5796c8dcSSimon Schubert #ifdef __cplusplus
32*5796c8dcSSimon Schubert extern "C" {
33*5796c8dcSSimon Schubert #endif
34*5796c8dcSSimon Schubert 
35*5796c8dcSSimon Schubert #include <stdio.h>
36*5796c8dcSSimon Schubert #include "bfd.h"
37*5796c8dcSSimon Schubert 
38*5796c8dcSSimon Schubert   typedef int (*fprintf_ftype) (void *, const char*, ...) /*ATTRIBUTE_FPTR_PRINTF_2*/;
39*5796c8dcSSimon Schubert 
40*5796c8dcSSimon Schubert enum dis_insn_type
41*5796c8dcSSimon Schubert {
42*5796c8dcSSimon Schubert   dis_noninsn,			/* Not a valid instruction.  */
43*5796c8dcSSimon Schubert   dis_nonbranch,		/* Not a branch instruction.  */
44*5796c8dcSSimon Schubert   dis_branch,			/* Unconditional branch.  */
45*5796c8dcSSimon Schubert   dis_condbranch,		/* Conditional branch.  */
46*5796c8dcSSimon Schubert   dis_jsr,			/* Jump to subroutine.  */
47*5796c8dcSSimon Schubert   dis_condjsr,			/* Conditional jump to subroutine.  */
48*5796c8dcSSimon Schubert   dis_dref,			/* Data reference instruction.  */
49*5796c8dcSSimon Schubert   dis_dref2			/* Two data references in instruction.  */
50*5796c8dcSSimon Schubert };
51*5796c8dcSSimon Schubert 
52*5796c8dcSSimon Schubert /* This struct is passed into the instruction decoding routine,
53*5796c8dcSSimon Schubert    and is passed back out into each callback.  The various fields are used
54*5796c8dcSSimon Schubert    for conveying information from your main routine into your callbacks,
55*5796c8dcSSimon Schubert    for passing information into the instruction decoders (such as the
56*5796c8dcSSimon Schubert    addresses of the callback functions), or for passing information
57*5796c8dcSSimon Schubert    back from the instruction decoders to their callers.
58*5796c8dcSSimon Schubert 
59*5796c8dcSSimon Schubert    It must be initialized before it is first passed; this can be done
60*5796c8dcSSimon Schubert    by hand, or using one of the initialization macros below.  */
61*5796c8dcSSimon Schubert 
62*5796c8dcSSimon Schubert typedef struct disassemble_info
63*5796c8dcSSimon Schubert {
64*5796c8dcSSimon Schubert   fprintf_ftype fprintf_func;
65*5796c8dcSSimon Schubert   void *stream;
66*5796c8dcSSimon Schubert   void *application_data;
67*5796c8dcSSimon Schubert 
68*5796c8dcSSimon Schubert   /* Target description.  We could replace this with a pointer to the bfd,
69*5796c8dcSSimon Schubert      but that would require one.  There currently isn't any such requirement
70*5796c8dcSSimon Schubert      so to avoid introducing one we record these explicitly.  */
71*5796c8dcSSimon Schubert   /* The bfd_flavour.  This can be bfd_target_unknown_flavour.  */
72*5796c8dcSSimon Schubert   enum bfd_flavour flavour;
73*5796c8dcSSimon Schubert   /* The bfd_arch value.  */
74*5796c8dcSSimon Schubert   enum bfd_architecture arch;
75*5796c8dcSSimon Schubert   /* The bfd_mach value.  */
76*5796c8dcSSimon Schubert   unsigned long mach;
77*5796c8dcSSimon Schubert   /* Endianness (for bi-endian cpus).  Mono-endian cpus can ignore this.  */
78*5796c8dcSSimon Schubert   enum bfd_endian endian;
79*5796c8dcSSimon Schubert   /* Endianness of code, for mixed-endian situations such as ARM BE8.  */
80*5796c8dcSSimon Schubert   enum bfd_endian endian_code;
81*5796c8dcSSimon Schubert   /* An arch/mach-specific bitmask of selected instruction subsets, mainly
82*5796c8dcSSimon Schubert      for processors with run-time-switchable instruction sets.  The default,
83*5796c8dcSSimon Schubert      zero, means that there is no constraint.  CGEN-based opcodes ports
84*5796c8dcSSimon Schubert      may use ISA_foo masks.  */
85*5796c8dcSSimon Schubert   void *insn_sets;
86*5796c8dcSSimon Schubert 
87*5796c8dcSSimon Schubert   /* Some targets need information about the current section to accurately
88*5796c8dcSSimon Schubert      display insns.  If this is NULL, the target disassembler function
89*5796c8dcSSimon Schubert      will have to make its best guess.  */
90*5796c8dcSSimon Schubert   asection *section;
91*5796c8dcSSimon Schubert 
92*5796c8dcSSimon Schubert   /* An array of pointers to symbols either at the location being disassembled
93*5796c8dcSSimon Schubert      or at the start of the function being disassembled.  The array is sorted
94*5796c8dcSSimon Schubert      so that the first symbol is intended to be the one used.  The others are
95*5796c8dcSSimon Schubert      present for any misc. purposes.  This is not set reliably, but if it is
96*5796c8dcSSimon Schubert      not NULL, it is correct.  */
97*5796c8dcSSimon Schubert   asymbol **symbols;
98*5796c8dcSSimon Schubert   /* Number of symbols in array.  */
99*5796c8dcSSimon Schubert   int num_symbols;
100*5796c8dcSSimon Schubert 
101*5796c8dcSSimon Schubert   /* Symbol table provided for targets that want to look at it.  This is
102*5796c8dcSSimon Schubert      used on Arm to find mapping symbols and determine Arm/Thumb code.  */
103*5796c8dcSSimon Schubert   asymbol **symtab;
104*5796c8dcSSimon Schubert   int symtab_pos;
105*5796c8dcSSimon Schubert   int symtab_size;
106*5796c8dcSSimon Schubert 
107*5796c8dcSSimon Schubert   /* For use by the disassembler.
108*5796c8dcSSimon Schubert      The top 16 bits are reserved for public use (and are documented here).
109*5796c8dcSSimon Schubert      The bottom 16 bits are for the internal use of the disassembler.  */
110*5796c8dcSSimon Schubert   unsigned long flags;
111*5796c8dcSSimon Schubert   /* Set if the disassembler has determined that there are one or more
112*5796c8dcSSimon Schubert      relocations associated with the instruction being disassembled.  */
113*5796c8dcSSimon Schubert #define INSN_HAS_RELOC	 (1 << 31)
114*5796c8dcSSimon Schubert   /* Set if the user has requested the disassembly of data as well as code.  */
115*5796c8dcSSimon Schubert #define DISASSEMBLE_DATA (1 << 30)
116*5796c8dcSSimon Schubert   /* Set if the user has specifically set the machine type encoded in the
117*5796c8dcSSimon Schubert      mach field of this structure.  */
118*5796c8dcSSimon Schubert #define USER_SPECIFIED_MACHINE_TYPE (1 << 29)
119*5796c8dcSSimon Schubert 
120*5796c8dcSSimon Schubert   /* Use internally by the target specific disassembly code.  */
121*5796c8dcSSimon Schubert   void *private_data;
122*5796c8dcSSimon Schubert 
123*5796c8dcSSimon Schubert   /* Function used to get bytes to disassemble.  MEMADDR is the
124*5796c8dcSSimon Schubert      address of the stuff to be disassembled, MYADDR is the address to
125*5796c8dcSSimon Schubert      put the bytes in, and LENGTH is the number of bytes to read.
126*5796c8dcSSimon Schubert      INFO is a pointer to this struct.
127*5796c8dcSSimon Schubert      Returns an errno value or 0 for success.  */
128*5796c8dcSSimon Schubert   int (*read_memory_func)
129*5796c8dcSSimon Schubert     (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
130*5796c8dcSSimon Schubert      struct disassemble_info *info);
131*5796c8dcSSimon Schubert 
132*5796c8dcSSimon Schubert   /* Function which should be called if we get an error that we can't
133*5796c8dcSSimon Schubert      recover from.  STATUS is the errno value from read_memory_func and
134*5796c8dcSSimon Schubert      MEMADDR is the address that we were trying to read.  INFO is a
135*5796c8dcSSimon Schubert      pointer to this struct.  */
136*5796c8dcSSimon Schubert   void (*memory_error_func)
137*5796c8dcSSimon Schubert     (int status, bfd_vma memaddr, struct disassemble_info *info);
138*5796c8dcSSimon Schubert 
139*5796c8dcSSimon Schubert   /* Function called to print ADDR.  */
140*5796c8dcSSimon Schubert   void (*print_address_func)
141*5796c8dcSSimon Schubert     (bfd_vma addr, struct disassemble_info *info);
142*5796c8dcSSimon Schubert 
143*5796c8dcSSimon Schubert   /* Function called to determine if there is a symbol at the given ADDR.
144*5796c8dcSSimon Schubert      If there is, the function returns 1, otherwise it returns 0.
145*5796c8dcSSimon Schubert      This is used by ports which support an overlay manager where
146*5796c8dcSSimon Schubert      the overlay number is held in the top part of an address.  In
147*5796c8dcSSimon Schubert      some circumstances we want to include the overlay number in the
148*5796c8dcSSimon Schubert      address, (normally because there is a symbol associated with
149*5796c8dcSSimon Schubert      that address), but sometimes we want to mask out the overlay bits.  */
150*5796c8dcSSimon Schubert   int (* symbol_at_address_func)
151*5796c8dcSSimon Schubert     (bfd_vma addr, struct disassemble_info * info);
152*5796c8dcSSimon Schubert 
153*5796c8dcSSimon Schubert   /* Function called to check if a SYMBOL is can be displayed to the user.
154*5796c8dcSSimon Schubert      This is used by some ports that want to hide special symbols when
155*5796c8dcSSimon Schubert      displaying debugging outout.  */
156*5796c8dcSSimon Schubert   bfd_boolean (* symbol_is_valid)
157*5796c8dcSSimon Schubert     (asymbol *, struct disassemble_info * info);
158*5796c8dcSSimon Schubert 
159*5796c8dcSSimon Schubert   /* These are for buffer_read_memory.  */
160*5796c8dcSSimon Schubert   bfd_byte *buffer;
161*5796c8dcSSimon Schubert   bfd_vma buffer_vma;
162*5796c8dcSSimon Schubert   unsigned int buffer_length;
163*5796c8dcSSimon Schubert 
164*5796c8dcSSimon Schubert   /* This variable may be set by the instruction decoder.  It suggests
165*5796c8dcSSimon Schubert       the number of bytes objdump should display on a single line.  If
166*5796c8dcSSimon Schubert       the instruction decoder sets this, it should always set it to
167*5796c8dcSSimon Schubert       the same value in order to get reasonable looking output.  */
168*5796c8dcSSimon Schubert   int bytes_per_line;
169*5796c8dcSSimon Schubert 
170*5796c8dcSSimon Schubert   /* The next two variables control the way objdump displays the raw data.  */
171*5796c8dcSSimon Schubert   /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
172*5796c8dcSSimon Schubert   /* output will look like this:
173*5796c8dcSSimon Schubert      00:   00000000 00000000
174*5796c8dcSSimon Schubert      with the chunks displayed according to "display_endian". */
175*5796c8dcSSimon Schubert   int bytes_per_chunk;
176*5796c8dcSSimon Schubert   enum bfd_endian display_endian;
177*5796c8dcSSimon Schubert 
178*5796c8dcSSimon Schubert   /* Number of octets per incremented target address
179*5796c8dcSSimon Schubert      Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
180*5796c8dcSSimon Schubert   unsigned int octets_per_byte;
181*5796c8dcSSimon Schubert 
182*5796c8dcSSimon Schubert   /* The number of zeroes we want to see at the end of a section before we
183*5796c8dcSSimon Schubert      start skipping them.  */
184*5796c8dcSSimon Schubert   unsigned int skip_zeroes;
185*5796c8dcSSimon Schubert 
186*5796c8dcSSimon Schubert   /* The number of zeroes to skip at the end of a section.  If the number
187*5796c8dcSSimon Schubert      of zeroes at the end is between SKIP_ZEROES_AT_END and SKIP_ZEROES,
188*5796c8dcSSimon Schubert      they will be disassembled.  If there are fewer than
189*5796c8dcSSimon Schubert      SKIP_ZEROES_AT_END, they will be skipped.  This is a heuristic
190*5796c8dcSSimon Schubert      attempt to avoid disassembling zeroes inserted by section
191*5796c8dcSSimon Schubert      alignment.  */
192*5796c8dcSSimon Schubert   unsigned int skip_zeroes_at_end;
193*5796c8dcSSimon Schubert 
194*5796c8dcSSimon Schubert   /* Whether the disassembler always needs the relocations.  */
195*5796c8dcSSimon Schubert   bfd_boolean disassembler_needs_relocs;
196*5796c8dcSSimon Schubert 
197*5796c8dcSSimon Schubert   /* Results from instruction decoders.  Not all decoders yet support
198*5796c8dcSSimon Schubert      this information.  This info is set each time an instruction is
199*5796c8dcSSimon Schubert      decoded, and is only valid for the last such instruction.
200*5796c8dcSSimon Schubert 
201*5796c8dcSSimon Schubert      To determine whether this decoder supports this information, set
202*5796c8dcSSimon Schubert      insn_info_valid to 0, decode an instruction, then check it.  */
203*5796c8dcSSimon Schubert 
204*5796c8dcSSimon Schubert   char insn_info_valid;		/* Branch info has been set. */
205*5796c8dcSSimon Schubert   char branch_delay_insns;	/* How many sequential insn's will run before
206*5796c8dcSSimon Schubert 				   a branch takes effect.  (0 = normal) */
207*5796c8dcSSimon Schubert   char data_size;		/* Size of data reference in insn, in bytes */
208*5796c8dcSSimon Schubert   enum dis_insn_type insn_type;	/* Type of instruction */
209*5796c8dcSSimon Schubert   bfd_vma target;		/* Target address of branch or dref, if known;
210*5796c8dcSSimon Schubert 				   zero if unknown.  */
211*5796c8dcSSimon Schubert   bfd_vma target2;		/* Second target address for dref2 */
212*5796c8dcSSimon Schubert 
213*5796c8dcSSimon Schubert   /* Command line options specific to the target disassembler.  */
214*5796c8dcSSimon Schubert   char * disassembler_options;
215*5796c8dcSSimon Schubert 
216*5796c8dcSSimon Schubert } disassemble_info;
217*5796c8dcSSimon Schubert 
218*5796c8dcSSimon Schubert 
219*5796c8dcSSimon Schubert /* Standard disassemblers.  Disassemble one instruction at the given
220*5796c8dcSSimon Schubert    target address.  Return number of octets processed.  */
221*5796c8dcSSimon Schubert typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);
222*5796c8dcSSimon Schubert 
223*5796c8dcSSimon Schubert extern int print_insn_alpha		(bfd_vma, disassemble_info *);
224*5796c8dcSSimon Schubert extern int print_insn_avr		(bfd_vma, disassemble_info *);
225*5796c8dcSSimon Schubert extern int print_insn_bfin		(bfd_vma, disassemble_info *);
226*5796c8dcSSimon Schubert extern int print_insn_big_arm		(bfd_vma, disassemble_info *);
227*5796c8dcSSimon Schubert extern int print_insn_big_mips		(bfd_vma, disassemble_info *);
228*5796c8dcSSimon Schubert extern int print_insn_big_or32		(bfd_vma, disassemble_info *);
229*5796c8dcSSimon Schubert extern int print_insn_big_powerpc	(bfd_vma, disassemble_info *);
230*5796c8dcSSimon Schubert extern int print_insn_big_score         (bfd_vma, disassemble_info *);
231*5796c8dcSSimon Schubert extern int print_insn_cr16              (bfd_vma, disassemble_info *);
232*5796c8dcSSimon Schubert extern int print_insn_crx               (bfd_vma, disassemble_info *);
233*5796c8dcSSimon Schubert extern int print_insn_d10v		(bfd_vma, disassemble_info *);
234*5796c8dcSSimon Schubert extern int print_insn_d30v		(bfd_vma, disassemble_info *);
235*5796c8dcSSimon Schubert extern int print_insn_dlx 		(bfd_vma, disassemble_info *);
236*5796c8dcSSimon Schubert extern int print_insn_fr30		(bfd_vma, disassemble_info *);
237*5796c8dcSSimon Schubert extern int print_insn_frv		(bfd_vma, disassemble_info *);
238*5796c8dcSSimon Schubert extern int print_insn_h8300		(bfd_vma, disassemble_info *);
239*5796c8dcSSimon Schubert extern int print_insn_h8300h		(bfd_vma, disassemble_info *);
240*5796c8dcSSimon Schubert extern int print_insn_h8300s		(bfd_vma, disassemble_info *);
241*5796c8dcSSimon Schubert extern int print_insn_h8500		(bfd_vma, disassemble_info *);
242*5796c8dcSSimon Schubert extern int print_insn_hppa		(bfd_vma, disassemble_info *);
243*5796c8dcSSimon Schubert extern int print_insn_i370		(bfd_vma, disassemble_info *);
244*5796c8dcSSimon Schubert extern int print_insn_i386		(bfd_vma, disassemble_info *);
245*5796c8dcSSimon Schubert extern int print_insn_i386_att		(bfd_vma, disassemble_info *);
246*5796c8dcSSimon Schubert extern int print_insn_i386_intel	(bfd_vma, disassemble_info *);
247*5796c8dcSSimon Schubert extern int print_insn_i860		(bfd_vma, disassemble_info *);
248*5796c8dcSSimon Schubert extern int print_insn_i960		(bfd_vma, disassemble_info *);
249*5796c8dcSSimon Schubert extern int print_insn_ia64		(bfd_vma, disassemble_info *);
250*5796c8dcSSimon Schubert extern int print_insn_ip2k		(bfd_vma, disassemble_info *);
251*5796c8dcSSimon Schubert extern int print_insn_iq2000		(bfd_vma, disassemble_info *);
252*5796c8dcSSimon Schubert extern int print_insn_little_arm	(bfd_vma, disassemble_info *);
253*5796c8dcSSimon Schubert extern int print_insn_little_mips	(bfd_vma, disassemble_info *);
254*5796c8dcSSimon Schubert extern int print_insn_little_or32	(bfd_vma, disassemble_info *);
255*5796c8dcSSimon Schubert extern int print_insn_little_powerpc	(bfd_vma, disassemble_info *);
256*5796c8dcSSimon Schubert extern int print_insn_little_score      (bfd_vma, disassemble_info *);
257*5796c8dcSSimon Schubert extern int print_insn_lm32		(bfd_vma, disassemble_info *);
258*5796c8dcSSimon Schubert extern int print_insn_m32c	        (bfd_vma, disassemble_info *);
259*5796c8dcSSimon Schubert extern int print_insn_m32r		(bfd_vma, disassemble_info *);
260*5796c8dcSSimon Schubert extern int print_insn_m68hc11		(bfd_vma, disassemble_info *);
261*5796c8dcSSimon Schubert extern int print_insn_m68hc12		(bfd_vma, disassemble_info *);
262*5796c8dcSSimon Schubert extern int print_insn_m68k		(bfd_vma, disassemble_info *);
263*5796c8dcSSimon Schubert extern int print_insn_m88k		(bfd_vma, disassemble_info *);
264*5796c8dcSSimon Schubert extern int print_insn_maxq_big		(bfd_vma, disassemble_info *);
265*5796c8dcSSimon Schubert extern int print_insn_maxq_little	(bfd_vma, disassemble_info *);
266*5796c8dcSSimon Schubert extern int print_insn_mcore		(bfd_vma, disassemble_info *);
267*5796c8dcSSimon Schubert extern int print_insn_mep		(bfd_vma, disassemble_info *);
268*5796c8dcSSimon Schubert extern int print_insn_microblaze	(bfd_vma, disassemble_info *);
269*5796c8dcSSimon Schubert extern int print_insn_mmix		(bfd_vma, disassemble_info *);
270*5796c8dcSSimon Schubert extern int print_insn_mn10200		(bfd_vma, disassemble_info *);
271*5796c8dcSSimon Schubert extern int print_insn_mn10300		(bfd_vma, disassemble_info *);
272*5796c8dcSSimon Schubert extern int print_insn_moxie		(bfd_vma, disassemble_info *);
273*5796c8dcSSimon Schubert extern int print_insn_msp430		(bfd_vma, disassemble_info *);
274*5796c8dcSSimon Schubert extern int print_insn_mt                (bfd_vma, disassemble_info *);
275*5796c8dcSSimon Schubert extern int print_insn_ns32k		(bfd_vma, disassemble_info *);
276*5796c8dcSSimon Schubert extern int print_insn_openrisc		(bfd_vma, disassemble_info *);
277*5796c8dcSSimon Schubert extern int print_insn_pdp11		(bfd_vma, disassemble_info *);
278*5796c8dcSSimon Schubert extern int print_insn_pj		(bfd_vma, disassemble_info *);
279*5796c8dcSSimon Schubert extern int print_insn_rs6000		(bfd_vma, disassemble_info *);
280*5796c8dcSSimon Schubert extern int print_insn_s390		(bfd_vma, disassemble_info *);
281*5796c8dcSSimon Schubert extern int print_insn_sh		(bfd_vma, disassemble_info *);
282*5796c8dcSSimon Schubert extern int print_insn_sh64		(bfd_vma, disassemble_info *);
283*5796c8dcSSimon Schubert extern int print_insn_sh64x_media	(bfd_vma, disassemble_info *);
284*5796c8dcSSimon Schubert extern int print_insn_sparc		(bfd_vma, disassemble_info *);
285*5796c8dcSSimon Schubert extern int print_insn_spu		(bfd_vma, disassemble_info *);
286*5796c8dcSSimon Schubert extern int print_insn_tic30		(bfd_vma, disassemble_info *);
287*5796c8dcSSimon Schubert extern int print_insn_tic4x		(bfd_vma, disassemble_info *);
288*5796c8dcSSimon Schubert extern int print_insn_tic54x		(bfd_vma, disassemble_info *);
289*5796c8dcSSimon Schubert extern int print_insn_tic80		(bfd_vma, disassemble_info *);
290*5796c8dcSSimon Schubert extern int print_insn_v850		(bfd_vma, disassemble_info *);
291*5796c8dcSSimon Schubert extern int print_insn_vax		(bfd_vma, disassemble_info *);
292*5796c8dcSSimon Schubert extern int print_insn_w65		(bfd_vma, disassemble_info *);
293*5796c8dcSSimon Schubert extern int print_insn_xc16x		(bfd_vma, disassemble_info *);
294*5796c8dcSSimon Schubert extern int print_insn_xstormy16		(bfd_vma, disassemble_info *);
295*5796c8dcSSimon Schubert extern int print_insn_xtensa		(bfd_vma, disassemble_info *);
296*5796c8dcSSimon Schubert extern int print_insn_z80		(bfd_vma, disassemble_info *);
297*5796c8dcSSimon Schubert extern int print_insn_z8001		(bfd_vma, disassemble_info *);
298*5796c8dcSSimon Schubert extern int print_insn_z8002		(bfd_vma, disassemble_info *);
299*5796c8dcSSimon Schubert 
300*5796c8dcSSimon Schubert extern disassembler_ftype arc_get_disassembler (void *);
301*5796c8dcSSimon Schubert extern disassembler_ftype cris_get_disassembler (bfd *);
302*5796c8dcSSimon Schubert 
303*5796c8dcSSimon Schubert extern void print_i386_disassembler_options (FILE *);
304*5796c8dcSSimon Schubert extern void print_mips_disassembler_options (FILE *);
305*5796c8dcSSimon Schubert extern void print_ppc_disassembler_options (FILE *);
306*5796c8dcSSimon Schubert extern void print_arm_disassembler_options (FILE *);
307*5796c8dcSSimon Schubert extern void parse_arm_disassembler_option (char *);
308*5796c8dcSSimon Schubert extern void print_s390_disassembler_options (FILE *);
309*5796c8dcSSimon Schubert extern int  get_arm_regname_num_options (void);
310*5796c8dcSSimon Schubert extern int  set_arm_regname_option (int);
311*5796c8dcSSimon Schubert extern int  get_arm_regnames (int, const char **, const char **, const char *const **);
312*5796c8dcSSimon Schubert extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *);
313*5796c8dcSSimon Schubert 
314*5796c8dcSSimon Schubert /* Fetch the disassembler for a given BFD, if that support is available.  */
315*5796c8dcSSimon Schubert extern disassembler_ftype disassembler (bfd *);
316*5796c8dcSSimon Schubert 
317*5796c8dcSSimon Schubert /* Amend the disassemble_info structure as necessary for the target architecture.
318*5796c8dcSSimon Schubert    Should only be called after initialising the info->arch field.  */
319*5796c8dcSSimon Schubert extern void disassemble_init_for_target (struct disassemble_info * info);
320*5796c8dcSSimon Schubert 
321*5796c8dcSSimon Schubert /* Document any target specific options available from the disassembler.  */
322*5796c8dcSSimon Schubert extern void disassembler_usage (FILE *);
323*5796c8dcSSimon Schubert 
324*5796c8dcSSimon Schubert 
325*5796c8dcSSimon Schubert /* This block of definitions is for particular callers who read instructions
326*5796c8dcSSimon Schubert    into a buffer before calling the instruction decoder.  */
327*5796c8dcSSimon Schubert 
328*5796c8dcSSimon Schubert /* Here is a function which callers may wish to use for read_memory_func.
329*5796c8dcSSimon Schubert    It gets bytes from a buffer.  */
330*5796c8dcSSimon Schubert extern int buffer_read_memory
331*5796c8dcSSimon Schubert   (bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *);
332*5796c8dcSSimon Schubert 
333*5796c8dcSSimon Schubert /* This function goes with buffer_read_memory.
334*5796c8dcSSimon Schubert    It prints a message using info->fprintf_func and info->stream.  */
335*5796c8dcSSimon Schubert extern void perror_memory (int, bfd_vma, struct disassemble_info *);
336*5796c8dcSSimon Schubert 
337*5796c8dcSSimon Schubert 
338*5796c8dcSSimon Schubert /* Just print the address in hex.  This is included for completeness even
339*5796c8dcSSimon Schubert    though both GDB and objdump provide their own (to print symbolic
340*5796c8dcSSimon Schubert    addresses).  */
341*5796c8dcSSimon Schubert extern void generic_print_address
342*5796c8dcSSimon Schubert   (bfd_vma, struct disassemble_info *);
343*5796c8dcSSimon Schubert 
344*5796c8dcSSimon Schubert /* Always true.  */
345*5796c8dcSSimon Schubert extern int generic_symbol_at_address
346*5796c8dcSSimon Schubert   (bfd_vma, struct disassemble_info *);
347*5796c8dcSSimon Schubert 
348*5796c8dcSSimon Schubert /* Also always true.  */
349*5796c8dcSSimon Schubert extern bfd_boolean generic_symbol_is_valid
350*5796c8dcSSimon Schubert   (asymbol *, struct disassemble_info *);
351*5796c8dcSSimon Schubert 
352*5796c8dcSSimon Schubert /* Method to initialize a disassemble_info struct.  This should be
353*5796c8dcSSimon Schubert    called by all applications creating such a struct.  */
354*5796c8dcSSimon Schubert extern void init_disassemble_info (struct disassemble_info *info, void *stream,
355*5796c8dcSSimon Schubert 				   fprintf_ftype fprintf_func);
356*5796c8dcSSimon Schubert 
357*5796c8dcSSimon Schubert /* For compatibility with existing code.  */
358*5796c8dcSSimon Schubert #define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
359*5796c8dcSSimon Schubert   init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC))
360*5796c8dcSSimon Schubert #define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
361*5796c8dcSSimon Schubert   init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC))
362*5796c8dcSSimon Schubert 
363*5796c8dcSSimon Schubert 
364*5796c8dcSSimon Schubert #ifdef __cplusplus
365*5796c8dcSSimon Schubert }
366*5796c8dcSSimon Schubert #endif
367*5796c8dcSSimon Schubert 
368*5796c8dcSSimon Schubert #endif /* ! defined (DIS_ASM_H) */
369