15796c8dcSSimon Schubert /* Interface between the opcode library and its callers. 25796c8dcSSimon Schubert 3a45ae5f8SJohn Marino Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 4*ef5ccd6cSJohn Marino 2011, 2012 Free Software Foundation, Inc. 55796c8dcSSimon Schubert 65796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 75796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 8cf7f2e2dSJohn Marino the Free Software Foundation; either version 3, or (at your option) 95796c8dcSSimon Schubert any later version. 105796c8dcSSimon Schubert 115796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 125796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 135796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 145796c8dcSSimon Schubert GNU General Public License for more details. 155796c8dcSSimon Schubert 165796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 175796c8dcSSimon Schubert along with this program; if not, write to the Free Software 185796c8dcSSimon Schubert Foundation, Inc., 51 Franklin Street - Fifth Floor, 195796c8dcSSimon Schubert Boston, MA 02110-1301, USA. 205796c8dcSSimon Schubert 215796c8dcSSimon Schubert Written by Cygnus Support, 1993. 225796c8dcSSimon Schubert 235796c8dcSSimon Schubert The opcode library (libopcodes.a) provides instruction decoders for 245796c8dcSSimon Schubert a large variety of instruction sets, callable with an identical 255796c8dcSSimon Schubert interface, for making instruction-processing programs more independent 265796c8dcSSimon Schubert of the instruction set being processed. */ 275796c8dcSSimon Schubert 285796c8dcSSimon Schubert #ifndef DIS_ASM_H 295796c8dcSSimon Schubert #define DIS_ASM_H 305796c8dcSSimon Schubert 315796c8dcSSimon Schubert #ifdef __cplusplus 325796c8dcSSimon Schubert extern "C" { 335796c8dcSSimon Schubert #endif 345796c8dcSSimon Schubert 355796c8dcSSimon Schubert #include <stdio.h> 365796c8dcSSimon Schubert #include "bfd.h" 375796c8dcSSimon Schubert 38*ef5ccd6cSJohn Marino typedef int (*fprintf_ftype) (void *, const char*, ...) ATTRIBUTE_FPTR_PRINTF_2; 395796c8dcSSimon Schubert 405796c8dcSSimon Schubert enum dis_insn_type 415796c8dcSSimon Schubert { 425796c8dcSSimon Schubert dis_noninsn, /* Not a valid instruction. */ 435796c8dcSSimon Schubert dis_nonbranch, /* Not a branch instruction. */ 445796c8dcSSimon Schubert dis_branch, /* Unconditional branch. */ 455796c8dcSSimon Schubert dis_condbranch, /* Conditional branch. */ 465796c8dcSSimon Schubert dis_jsr, /* Jump to subroutine. */ 475796c8dcSSimon Schubert dis_condjsr, /* Conditional jump to subroutine. */ 485796c8dcSSimon Schubert dis_dref, /* Data reference instruction. */ 495796c8dcSSimon Schubert dis_dref2 /* Two data references in instruction. */ 505796c8dcSSimon Schubert }; 515796c8dcSSimon Schubert 525796c8dcSSimon Schubert /* This struct is passed into the instruction decoding routine, 535796c8dcSSimon Schubert and is passed back out into each callback. The various fields are used 545796c8dcSSimon Schubert for conveying information from your main routine into your callbacks, 555796c8dcSSimon Schubert for passing information into the instruction decoders (such as the 565796c8dcSSimon Schubert addresses of the callback functions), or for passing information 575796c8dcSSimon Schubert back from the instruction decoders to their callers. 585796c8dcSSimon Schubert 595796c8dcSSimon Schubert It must be initialized before it is first passed; this can be done 605796c8dcSSimon Schubert by hand, or using one of the initialization macros below. */ 615796c8dcSSimon Schubert 625796c8dcSSimon Schubert typedef struct disassemble_info 635796c8dcSSimon Schubert { 645796c8dcSSimon Schubert fprintf_ftype fprintf_func; 655796c8dcSSimon Schubert void *stream; 665796c8dcSSimon Schubert void *application_data; 675796c8dcSSimon Schubert 685796c8dcSSimon Schubert /* Target description. We could replace this with a pointer to the bfd, 695796c8dcSSimon Schubert but that would require one. There currently isn't any such requirement 705796c8dcSSimon Schubert so to avoid introducing one we record these explicitly. */ 715796c8dcSSimon Schubert /* The bfd_flavour. This can be bfd_target_unknown_flavour. */ 725796c8dcSSimon Schubert enum bfd_flavour flavour; 735796c8dcSSimon Schubert /* The bfd_arch value. */ 745796c8dcSSimon Schubert enum bfd_architecture arch; 755796c8dcSSimon Schubert /* The bfd_mach value. */ 765796c8dcSSimon Schubert unsigned long mach; 775796c8dcSSimon Schubert /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */ 785796c8dcSSimon Schubert enum bfd_endian endian; 795796c8dcSSimon Schubert /* Endianness of code, for mixed-endian situations such as ARM BE8. */ 805796c8dcSSimon Schubert enum bfd_endian endian_code; 815796c8dcSSimon Schubert /* An arch/mach-specific bitmask of selected instruction subsets, mainly 825796c8dcSSimon Schubert for processors with run-time-switchable instruction sets. The default, 835796c8dcSSimon Schubert zero, means that there is no constraint. CGEN-based opcodes ports 845796c8dcSSimon Schubert may use ISA_foo masks. */ 855796c8dcSSimon Schubert void *insn_sets; 865796c8dcSSimon Schubert 875796c8dcSSimon Schubert /* Some targets need information about the current section to accurately 885796c8dcSSimon Schubert display insns. If this is NULL, the target disassembler function 895796c8dcSSimon Schubert will have to make its best guess. */ 905796c8dcSSimon Schubert asection *section; 915796c8dcSSimon Schubert 925796c8dcSSimon Schubert /* An array of pointers to symbols either at the location being disassembled 935796c8dcSSimon Schubert or at the start of the function being disassembled. The array is sorted 945796c8dcSSimon Schubert so that the first symbol is intended to be the one used. The others are 955796c8dcSSimon Schubert present for any misc. purposes. This is not set reliably, but if it is 965796c8dcSSimon Schubert not NULL, it is correct. */ 975796c8dcSSimon Schubert asymbol **symbols; 985796c8dcSSimon Schubert /* Number of symbols in array. */ 995796c8dcSSimon Schubert int num_symbols; 1005796c8dcSSimon Schubert 1015796c8dcSSimon Schubert /* Symbol table provided for targets that want to look at it. This is 1025796c8dcSSimon Schubert used on Arm to find mapping symbols and determine Arm/Thumb code. */ 1035796c8dcSSimon Schubert asymbol **symtab; 1045796c8dcSSimon Schubert int symtab_pos; 1055796c8dcSSimon Schubert int symtab_size; 1065796c8dcSSimon Schubert 1075796c8dcSSimon Schubert /* For use by the disassembler. 1085796c8dcSSimon Schubert The top 16 bits are reserved for public use (and are documented here). 1095796c8dcSSimon Schubert The bottom 16 bits are for the internal use of the disassembler. */ 1105796c8dcSSimon Schubert unsigned long flags; 1115796c8dcSSimon Schubert /* Set if the disassembler has determined that there are one or more 1125796c8dcSSimon Schubert relocations associated with the instruction being disassembled. */ 1135796c8dcSSimon Schubert #define INSN_HAS_RELOC (1 << 31) 1145796c8dcSSimon Schubert /* Set if the user has requested the disassembly of data as well as code. */ 1155796c8dcSSimon Schubert #define DISASSEMBLE_DATA (1 << 30) 1165796c8dcSSimon Schubert /* Set if the user has specifically set the machine type encoded in the 1175796c8dcSSimon Schubert mach field of this structure. */ 1185796c8dcSSimon Schubert #define USER_SPECIFIED_MACHINE_TYPE (1 << 29) 1195796c8dcSSimon Schubert 1205796c8dcSSimon Schubert /* Use internally by the target specific disassembly code. */ 1215796c8dcSSimon Schubert void *private_data; 1225796c8dcSSimon Schubert 1235796c8dcSSimon Schubert /* Function used to get bytes to disassemble. MEMADDR is the 1245796c8dcSSimon Schubert address of the stuff to be disassembled, MYADDR is the address to 1255796c8dcSSimon Schubert put the bytes in, and LENGTH is the number of bytes to read. 1265796c8dcSSimon Schubert INFO is a pointer to this struct. 1275796c8dcSSimon Schubert Returns an errno value or 0 for success. */ 1285796c8dcSSimon Schubert int (*read_memory_func) 1295796c8dcSSimon Schubert (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, 130cf7f2e2dSJohn Marino struct disassemble_info *dinfo); 1315796c8dcSSimon Schubert 1325796c8dcSSimon Schubert /* Function which should be called if we get an error that we can't 1335796c8dcSSimon Schubert recover from. STATUS is the errno value from read_memory_func and 1345796c8dcSSimon Schubert MEMADDR is the address that we were trying to read. INFO is a 1355796c8dcSSimon Schubert pointer to this struct. */ 1365796c8dcSSimon Schubert void (*memory_error_func) 137cf7f2e2dSJohn Marino (int status, bfd_vma memaddr, struct disassemble_info *dinfo); 1385796c8dcSSimon Schubert 1395796c8dcSSimon Schubert /* Function called to print ADDR. */ 1405796c8dcSSimon Schubert void (*print_address_func) 141cf7f2e2dSJohn Marino (bfd_vma addr, struct disassemble_info *dinfo); 1425796c8dcSSimon Schubert 1435796c8dcSSimon Schubert /* Function called to determine if there is a symbol at the given ADDR. 1445796c8dcSSimon Schubert If there is, the function returns 1, otherwise it returns 0. 1455796c8dcSSimon Schubert This is used by ports which support an overlay manager where 1465796c8dcSSimon Schubert the overlay number is held in the top part of an address. In 1475796c8dcSSimon Schubert some circumstances we want to include the overlay number in the 1485796c8dcSSimon Schubert address, (normally because there is a symbol associated with 1495796c8dcSSimon Schubert that address), but sometimes we want to mask out the overlay bits. */ 1505796c8dcSSimon Schubert int (* symbol_at_address_func) 151cf7f2e2dSJohn Marino (bfd_vma addr, struct disassemble_info *dinfo); 1525796c8dcSSimon Schubert 1535796c8dcSSimon Schubert /* Function called to check if a SYMBOL is can be displayed to the user. 1545796c8dcSSimon Schubert This is used by some ports that want to hide special symbols when 1555796c8dcSSimon Schubert displaying debugging outout. */ 1565796c8dcSSimon Schubert bfd_boolean (* symbol_is_valid) 157cf7f2e2dSJohn Marino (asymbol *, struct disassemble_info *dinfo); 1585796c8dcSSimon Schubert 1595796c8dcSSimon Schubert /* These are for buffer_read_memory. */ 1605796c8dcSSimon Schubert bfd_byte *buffer; 1615796c8dcSSimon Schubert bfd_vma buffer_vma; 1625796c8dcSSimon Schubert unsigned int buffer_length; 1635796c8dcSSimon Schubert 1645796c8dcSSimon Schubert /* This variable may be set by the instruction decoder. It suggests 1655796c8dcSSimon Schubert the number of bytes objdump should display on a single line. If 1665796c8dcSSimon Schubert the instruction decoder sets this, it should always set it to 1675796c8dcSSimon Schubert the same value in order to get reasonable looking output. */ 1685796c8dcSSimon Schubert int bytes_per_line; 1695796c8dcSSimon Schubert 1705796c8dcSSimon Schubert /* The next two variables control the way objdump displays the raw data. */ 1715796c8dcSSimon Schubert /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */ 1725796c8dcSSimon Schubert /* output will look like this: 1735796c8dcSSimon Schubert 00: 00000000 00000000 1745796c8dcSSimon Schubert with the chunks displayed according to "display_endian". */ 1755796c8dcSSimon Schubert int bytes_per_chunk; 1765796c8dcSSimon Schubert enum bfd_endian display_endian; 1775796c8dcSSimon Schubert 1785796c8dcSSimon Schubert /* Number of octets per incremented target address 1795796c8dcSSimon Schubert Normally one, but some DSPs have byte sizes of 16 or 32 bits. */ 1805796c8dcSSimon Schubert unsigned int octets_per_byte; 1815796c8dcSSimon Schubert 1825796c8dcSSimon Schubert /* The number of zeroes we want to see at the end of a section before we 1835796c8dcSSimon Schubert start skipping them. */ 1845796c8dcSSimon Schubert unsigned int skip_zeroes; 1855796c8dcSSimon Schubert 1865796c8dcSSimon Schubert /* The number of zeroes to skip at the end of a section. If the number 1875796c8dcSSimon Schubert of zeroes at the end is between SKIP_ZEROES_AT_END and SKIP_ZEROES, 1885796c8dcSSimon Schubert they will be disassembled. If there are fewer than 1895796c8dcSSimon Schubert SKIP_ZEROES_AT_END, they will be skipped. This is a heuristic 1905796c8dcSSimon Schubert attempt to avoid disassembling zeroes inserted by section 1915796c8dcSSimon Schubert alignment. */ 1925796c8dcSSimon Schubert unsigned int skip_zeroes_at_end; 1935796c8dcSSimon Schubert 1945796c8dcSSimon Schubert /* Whether the disassembler always needs the relocations. */ 1955796c8dcSSimon Schubert bfd_boolean disassembler_needs_relocs; 1965796c8dcSSimon Schubert 1975796c8dcSSimon Schubert /* Results from instruction decoders. Not all decoders yet support 1985796c8dcSSimon Schubert this information. This info is set each time an instruction is 1995796c8dcSSimon Schubert decoded, and is only valid for the last such instruction. 2005796c8dcSSimon Schubert 2015796c8dcSSimon Schubert To determine whether this decoder supports this information, set 2025796c8dcSSimon Schubert insn_info_valid to 0, decode an instruction, then check it. */ 2035796c8dcSSimon Schubert 2045796c8dcSSimon Schubert char insn_info_valid; /* Branch info has been set. */ 2055796c8dcSSimon Schubert char branch_delay_insns; /* How many sequential insn's will run before 2065796c8dcSSimon Schubert a branch takes effect. (0 = normal) */ 2075796c8dcSSimon Schubert char data_size; /* Size of data reference in insn, in bytes */ 2085796c8dcSSimon Schubert enum dis_insn_type insn_type; /* Type of instruction */ 2095796c8dcSSimon Schubert bfd_vma target; /* Target address of branch or dref, if known; 2105796c8dcSSimon Schubert zero if unknown. */ 2115796c8dcSSimon Schubert bfd_vma target2; /* Second target address for dref2 */ 2125796c8dcSSimon Schubert 2135796c8dcSSimon Schubert /* Command line options specific to the target disassembler. */ 2145796c8dcSSimon Schubert char * disassembler_options; 2155796c8dcSSimon Schubert 2165796c8dcSSimon Schubert } disassemble_info; 2175796c8dcSSimon Schubert 2185796c8dcSSimon Schubert 2195796c8dcSSimon Schubert /* Standard disassemblers. Disassemble one instruction at the given 2205796c8dcSSimon Schubert target address. Return number of octets processed. */ 2215796c8dcSSimon Schubert typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *); 2225796c8dcSSimon Schubert 223*ef5ccd6cSJohn Marino extern int print_insn_aarch64 (bfd_vma, disassemble_info *); 2245796c8dcSSimon Schubert extern int print_insn_alpha (bfd_vma, disassemble_info *); 2255796c8dcSSimon Schubert extern int print_insn_avr (bfd_vma, disassemble_info *); 2265796c8dcSSimon Schubert extern int print_insn_bfin (bfd_vma, disassemble_info *); 2275796c8dcSSimon Schubert extern int print_insn_big_arm (bfd_vma, disassemble_info *); 2285796c8dcSSimon Schubert extern int print_insn_big_mips (bfd_vma, disassemble_info *); 229*ef5ccd6cSJohn Marino extern int print_insn_big_nios2 (bfd_vma, disassemble_info *); 2305796c8dcSSimon Schubert extern int print_insn_big_or32 (bfd_vma, disassemble_info *); 2315796c8dcSSimon Schubert extern int print_insn_big_powerpc (bfd_vma, disassemble_info *); 2325796c8dcSSimon Schubert extern int print_insn_big_score (bfd_vma, disassemble_info *); 2335796c8dcSSimon Schubert extern int print_insn_cr16 (bfd_vma, disassemble_info *); 2345796c8dcSSimon Schubert extern int print_insn_crx (bfd_vma, disassemble_info *); 2355796c8dcSSimon Schubert extern int print_insn_d10v (bfd_vma, disassemble_info *); 2365796c8dcSSimon Schubert extern int print_insn_d30v (bfd_vma, disassemble_info *); 2375796c8dcSSimon Schubert extern int print_insn_dlx (bfd_vma, disassemble_info *); 238a45ae5f8SJohn Marino extern int print_insn_epiphany (bfd_vma, disassemble_info *); 2395796c8dcSSimon Schubert extern int print_insn_fr30 (bfd_vma, disassemble_info *); 2405796c8dcSSimon Schubert extern int print_insn_frv (bfd_vma, disassemble_info *); 2415796c8dcSSimon Schubert extern int print_insn_h8300 (bfd_vma, disassemble_info *); 2425796c8dcSSimon Schubert extern int print_insn_h8300h (bfd_vma, disassemble_info *); 2435796c8dcSSimon Schubert extern int print_insn_h8300s (bfd_vma, disassemble_info *); 2445796c8dcSSimon Schubert extern int print_insn_h8500 (bfd_vma, disassemble_info *); 2455796c8dcSSimon Schubert extern int print_insn_hppa (bfd_vma, disassemble_info *); 2465796c8dcSSimon Schubert extern int print_insn_i370 (bfd_vma, disassemble_info *); 2475796c8dcSSimon Schubert extern int print_insn_i386 (bfd_vma, disassemble_info *); 2485796c8dcSSimon Schubert extern int print_insn_i386_att (bfd_vma, disassemble_info *); 2495796c8dcSSimon Schubert extern int print_insn_i386_intel (bfd_vma, disassemble_info *); 2505796c8dcSSimon Schubert extern int print_insn_i860 (bfd_vma, disassemble_info *); 2515796c8dcSSimon Schubert extern int print_insn_i960 (bfd_vma, disassemble_info *); 2525796c8dcSSimon Schubert extern int print_insn_ia64 (bfd_vma, disassemble_info *); 2535796c8dcSSimon Schubert extern int print_insn_ip2k (bfd_vma, disassemble_info *); 2545796c8dcSSimon Schubert extern int print_insn_iq2000 (bfd_vma, disassemble_info *); 2555796c8dcSSimon Schubert extern int print_insn_little_arm (bfd_vma, disassemble_info *); 2565796c8dcSSimon Schubert extern int print_insn_little_mips (bfd_vma, disassemble_info *); 257*ef5ccd6cSJohn Marino extern int print_insn_little_nios2 (bfd_vma, disassemble_info *); 2585796c8dcSSimon Schubert extern int print_insn_little_or32 (bfd_vma, disassemble_info *); 2595796c8dcSSimon Schubert extern int print_insn_little_powerpc (bfd_vma, disassemble_info *); 2605796c8dcSSimon Schubert extern int print_insn_little_score (bfd_vma, disassemble_info *); 2615796c8dcSSimon Schubert extern int print_insn_lm32 (bfd_vma, disassemble_info *); 2625796c8dcSSimon Schubert extern int print_insn_m32c (bfd_vma, disassemble_info *); 2635796c8dcSSimon Schubert extern int print_insn_m32r (bfd_vma, disassemble_info *); 2645796c8dcSSimon Schubert extern int print_insn_m68hc11 (bfd_vma, disassemble_info *); 2655796c8dcSSimon Schubert extern int print_insn_m68hc12 (bfd_vma, disassemble_info *); 266*ef5ccd6cSJohn Marino extern int print_insn_m9s12x (bfd_vma, disassemble_info *); 267*ef5ccd6cSJohn Marino extern int print_insn_m9s12xg (bfd_vma, disassemble_info *); 2685796c8dcSSimon Schubert extern int print_insn_m68k (bfd_vma, disassemble_info *); 2695796c8dcSSimon Schubert extern int print_insn_m88k (bfd_vma, disassemble_info *); 2705796c8dcSSimon Schubert extern int print_insn_mcore (bfd_vma, disassemble_info *); 2715796c8dcSSimon Schubert extern int print_insn_mep (bfd_vma, disassemble_info *); 272*ef5ccd6cSJohn Marino extern int print_insn_metag (bfd_vma, disassemble_info *); 2735796c8dcSSimon Schubert extern int print_insn_microblaze (bfd_vma, disassemble_info *); 2745796c8dcSSimon Schubert extern int print_insn_mmix (bfd_vma, disassemble_info *); 2755796c8dcSSimon Schubert extern int print_insn_mn10200 (bfd_vma, disassemble_info *); 2765796c8dcSSimon Schubert extern int print_insn_mn10300 (bfd_vma, disassemble_info *); 2775796c8dcSSimon Schubert extern int print_insn_moxie (bfd_vma, disassemble_info *); 2785796c8dcSSimon Schubert extern int print_insn_msp430 (bfd_vma, disassemble_info *); 2795796c8dcSSimon Schubert extern int print_insn_mt (bfd_vma, disassemble_info *); 2805796c8dcSSimon Schubert extern int print_insn_ns32k (bfd_vma, disassemble_info *); 2815796c8dcSSimon Schubert extern int print_insn_openrisc (bfd_vma, disassemble_info *); 2825796c8dcSSimon Schubert extern int print_insn_pdp11 (bfd_vma, disassemble_info *); 2835796c8dcSSimon Schubert extern int print_insn_pj (bfd_vma, disassemble_info *); 2845796c8dcSSimon Schubert extern int print_insn_rs6000 (bfd_vma, disassemble_info *); 2855796c8dcSSimon Schubert extern int print_insn_s390 (bfd_vma, disassemble_info *); 2865796c8dcSSimon Schubert extern int print_insn_sh (bfd_vma, disassemble_info *); 2875796c8dcSSimon Schubert extern int print_insn_sh64 (bfd_vma, disassemble_info *); 2885796c8dcSSimon Schubert extern int print_insn_sh64x_media (bfd_vma, disassemble_info *); 2895796c8dcSSimon Schubert extern int print_insn_sparc (bfd_vma, disassemble_info *); 2905796c8dcSSimon Schubert extern int print_insn_spu (bfd_vma, disassemble_info *); 2915796c8dcSSimon Schubert extern int print_insn_tic30 (bfd_vma, disassemble_info *); 2925796c8dcSSimon Schubert extern int print_insn_tic4x (bfd_vma, disassemble_info *); 2935796c8dcSSimon Schubert extern int print_insn_tic54x (bfd_vma, disassemble_info *); 294cf7f2e2dSJohn Marino extern int print_insn_tic6x (bfd_vma, disassemble_info *); 2955796c8dcSSimon Schubert extern int print_insn_tic80 (bfd_vma, disassemble_info *); 296a45ae5f8SJohn Marino extern int print_insn_tilegx (bfd_vma, disassemble_info *); 297a45ae5f8SJohn Marino extern int print_insn_tilepro (bfd_vma, disassemble_info *); 2985796c8dcSSimon Schubert extern int print_insn_v850 (bfd_vma, disassemble_info *); 2995796c8dcSSimon Schubert extern int print_insn_vax (bfd_vma, disassemble_info *); 3005796c8dcSSimon Schubert extern int print_insn_w65 (bfd_vma, disassemble_info *); 3015796c8dcSSimon Schubert extern int print_insn_xc16x (bfd_vma, disassemble_info *); 302*ef5ccd6cSJohn Marino extern int print_insn_xgate (bfd_vma, disassemble_info *); 3035796c8dcSSimon Schubert extern int print_insn_xstormy16 (bfd_vma, disassemble_info *); 3045796c8dcSSimon Schubert extern int print_insn_xtensa (bfd_vma, disassemble_info *); 3055796c8dcSSimon Schubert extern int print_insn_z80 (bfd_vma, disassemble_info *); 3065796c8dcSSimon Schubert extern int print_insn_z8001 (bfd_vma, disassemble_info *); 3075796c8dcSSimon Schubert extern int print_insn_z8002 (bfd_vma, disassemble_info *); 308cf7f2e2dSJohn Marino extern int print_insn_rx (bfd_vma, disassemble_info *); 309a45ae5f8SJohn Marino extern int print_insn_rl78 (bfd_vma, disassemble_info *); 3105796c8dcSSimon Schubert 3115796c8dcSSimon Schubert extern disassembler_ftype arc_get_disassembler (void *); 3125796c8dcSSimon Schubert extern disassembler_ftype cris_get_disassembler (bfd *); 3135796c8dcSSimon Schubert 314*ef5ccd6cSJohn Marino extern void print_aarch64_disassembler_options (FILE *); 3155796c8dcSSimon Schubert extern void print_i386_disassembler_options (FILE *); 3165796c8dcSSimon Schubert extern void print_mips_disassembler_options (FILE *); 3175796c8dcSSimon Schubert extern void print_ppc_disassembler_options (FILE *); 3185796c8dcSSimon Schubert extern void print_arm_disassembler_options (FILE *); 3195796c8dcSSimon Schubert extern void parse_arm_disassembler_option (char *); 3205796c8dcSSimon Schubert extern void print_s390_disassembler_options (FILE *); 3215796c8dcSSimon Schubert extern int get_arm_regname_num_options (void); 3225796c8dcSSimon Schubert extern int set_arm_regname_option (int); 3235796c8dcSSimon Schubert extern int get_arm_regnames (int, const char **, const char **, const char *const **); 324*ef5ccd6cSJohn Marino extern bfd_boolean aarch64_symbol_is_valid (asymbol *, struct disassemble_info *); 3255796c8dcSSimon Schubert extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *); 326*ef5ccd6cSJohn Marino extern void disassemble_init_powerpc (struct disassemble_info *); 3275796c8dcSSimon Schubert 3285796c8dcSSimon Schubert /* Fetch the disassembler for a given BFD, if that support is available. */ 3295796c8dcSSimon Schubert extern disassembler_ftype disassembler (bfd *); 3305796c8dcSSimon Schubert 3315796c8dcSSimon Schubert /* Amend the disassemble_info structure as necessary for the target architecture. 3325796c8dcSSimon Schubert Should only be called after initialising the info->arch field. */ 333cf7f2e2dSJohn Marino extern void disassemble_init_for_target (struct disassemble_info * dinfo); 3345796c8dcSSimon Schubert 3355796c8dcSSimon Schubert /* Document any target specific options available from the disassembler. */ 3365796c8dcSSimon Schubert extern void disassembler_usage (FILE *); 3375796c8dcSSimon Schubert 3385796c8dcSSimon Schubert 3395796c8dcSSimon Schubert /* This block of definitions is for particular callers who read instructions 3405796c8dcSSimon Schubert into a buffer before calling the instruction decoder. */ 3415796c8dcSSimon Schubert 3425796c8dcSSimon Schubert /* Here is a function which callers may wish to use for read_memory_func. 3435796c8dcSSimon Schubert It gets bytes from a buffer. */ 3445796c8dcSSimon Schubert extern int buffer_read_memory 3455796c8dcSSimon Schubert (bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *); 3465796c8dcSSimon Schubert 3475796c8dcSSimon Schubert /* This function goes with buffer_read_memory. 3485796c8dcSSimon Schubert It prints a message using info->fprintf_func and info->stream. */ 3495796c8dcSSimon Schubert extern void perror_memory (int, bfd_vma, struct disassemble_info *); 3505796c8dcSSimon Schubert 3515796c8dcSSimon Schubert 3525796c8dcSSimon Schubert /* Just print the address in hex. This is included for completeness even 3535796c8dcSSimon Schubert though both GDB and objdump provide their own (to print symbolic 3545796c8dcSSimon Schubert addresses). */ 3555796c8dcSSimon Schubert extern void generic_print_address 3565796c8dcSSimon Schubert (bfd_vma, struct disassemble_info *); 3575796c8dcSSimon Schubert 3585796c8dcSSimon Schubert /* Always true. */ 3595796c8dcSSimon Schubert extern int generic_symbol_at_address 3605796c8dcSSimon Schubert (bfd_vma, struct disassemble_info *); 3615796c8dcSSimon Schubert 3625796c8dcSSimon Schubert /* Also always true. */ 3635796c8dcSSimon Schubert extern bfd_boolean generic_symbol_is_valid 3645796c8dcSSimon Schubert (asymbol *, struct disassemble_info *); 3655796c8dcSSimon Schubert 3665796c8dcSSimon Schubert /* Method to initialize a disassemble_info struct. This should be 3675796c8dcSSimon Schubert called by all applications creating such a struct. */ 368cf7f2e2dSJohn Marino extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream, 3695796c8dcSSimon Schubert fprintf_ftype fprintf_func); 3705796c8dcSSimon Schubert 3715796c8dcSSimon Schubert /* For compatibility with existing code. */ 3725796c8dcSSimon Schubert #define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \ 3735796c8dcSSimon Schubert init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC)) 3745796c8dcSSimon Schubert #define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \ 3755796c8dcSSimon Schubert init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC)) 3765796c8dcSSimon Schubert 3775796c8dcSSimon Schubert 3785796c8dcSSimon Schubert #ifdef __cplusplus 3795796c8dcSSimon Schubert } 3805796c8dcSSimon Schubert #endif 3815796c8dcSSimon Schubert 3825796c8dcSSimon Schubert #endif /* ! defined (DIS_ASM_H) */ 383