/*THE FOLLOWING IS EXTRACTED FROM THE SOURCE */
+
+/*:init.c*/
+/* bfd_init
+
+This routine must be called before any other bfd function to initialize
+magical internal data structures.
+*/
+
+ void EXFUN(bfd_init,(void));
+
+/*
+*/
+
/*:opncls.c*/
/* *i bfd_openr
Opens the file supplied (using @code{fopen}) with the target supplied, it
/*
*/
-/*:archures.c*/
-/* bfd_architecture
-This enum gives the object file's CPU
-architecture, in a global sense. E.g. what processor family does it
-belong to? There is another field, which indicates what processor
-within the family is in use. The machine gives a number which
-distingushes different versions of the architecture, containing for
-example 2 and 3 for Intel i960 KA and i960 KB, and 68020 and 68030 for
-Motorola 68020 and 68030.
-*/
-
-enum bfd_architecture
-{
- bfd_arch_unknown, /* File arch not known */
- bfd_arch_obscure, /* Arch known, not one of these */
- bfd_arch_m68k, /* Motorola 68xxx */
- bfd_arch_vax, /* DEC Vax */
- bfd_arch_i960, /* Intel 960 */
- /* The order of the following is important.
- lower number indicates a machine type that
- only accepts a subset of the instructions
- available to machines with higher numbers.
- The exception is the "ca", which is
- incompatible with all other machines except
- "core". */
-
-#define bfd_mach_i960_core 1
-#define bfd_mach_i960_ka_sa 2
-#define bfd_mach_i960_kb_sb 3
-#define bfd_mach_i960_mc 4
-#define bfd_mach_i960_xa 5
-#define bfd_mach_i960_ca 6
-
- bfd_arch_a29k, /* AMD 29000 */
- bfd_arch_sparc, /* SPARC */
- bfd_arch_mips, /* MIPS Rxxxx */
- bfd_arch_i386, /* Intel 386 */
- bfd_arch_ns32k, /* National Semiconductor 32xxx */
- bfd_arch_tahoe, /* CCI/Harris Tahoe */
- bfd_arch_i860, /* Intel 860 */
- bfd_arch_romp, /* IBM ROMP RS/6000 */
- bfd_arch_alliant, /* Alliant */
- bfd_arch_convex, /* Convex */
- bfd_arch_m88k, /* Motorola 88xxx */
- bfd_arch_pyramid, /* Pyramid Technology */
- bfd_arch_h8_300, /* Hitachi H8/300 */
- bfd_arch_last
- };
-
-/*
-stuff
-
- bfd_prinable_arch_mach
-Return a printable string representing the architecture and machine
-type. The result is only good until the next call to
-@code{bfd_printable_arch_mach}.
-*/
- PROTO(CONST char *,bfd_printable_arch_mach,
- (enum bfd_architecture arch, unsigned long machine));
-
-/*
-
-*i bfd_scan_arch_mach
-Scan a string and attempt to turn it into an archive and machine type combination.
-*/
- PROTO(boolean, bfd_scan_arch_mach,
- (CONST char *, enum bfd_architecture *, unsigned long *));
-
-/*
-
-*i bfd_arch_compatible
-This routine is used to determine whether two BFDs' architectures and machine types are
-compatible. It calculates the lowest common denominator between the
-two architectures and machine types implied by the BFDs and sets the
-objects pointed at by @var{archp} and @var{machine} if non NULL.
-
-This routine returns @code{true} if the BFDs are of compatible type,
-otherwise @code{false}.
-*/
- PROTO(boolean, bfd_arch_compatible,
- (bfd *abfd,
- bfd *bbfd,
- enum bfd_architecture *archp,
- unsigned long *machinep));
-
-/*
-
- bfd_set_arch_mach
-Set atch mach
-*/
-#define bfd_set_arch_mach(abfd, arch, mach) \
- BFD_SEND (abfd, _bfd_set_arch_mach,\
- (abfd, arch, mach))
/*:libbfd.c*/
/* *i bfd_put_size
*/
-/*:syms.c*/
-/* @subsection typedef asymbol
-An @code{asymbol} has the form:
+
+/*:archures.c*/
+/* bfd_architecture
+This enum gives the object file's CPU
+architecture, in a global sense. E.g. what processor family does it
+belong to? There is another field, which indicates what processor
+within the family is in use. The machine gives a number which
+distingushes different versions of the architecture, containing for
+example 2 and 3 for Intel i960 KA and i960 KB, and 68020 and 68030 for
+Motorola 68020 and 68030.
*/
-typedef struct symbol_cache_entry
+enum bfd_architecture
{
-/* A pointer to the BFD which owns the symbol. This information is
-necessary so that a back end can work out what additional (invisible to
-the application writer) information is carried with the symbol.
-*/
+ bfd_arch_unknown, /* File arch not known */
+ bfd_arch_obscure, /* Arch known, not one of these */
+ bfd_arch_m68k, /* Motorola 68xxx */
+ bfd_arch_vax, /* DEC Vax */
+ bfd_arch_i960, /* Intel 960 */
+ /* The order of the following is important.
+ lower number indicates a machine type that
+ only accepts a subset of the instructions
+ available to machines with higher numbers.
+ The exception is the "ca", which is
+ incompatible with all other machines except
+ "core". */
- struct _bfd *the_bfd;
+#define bfd_mach_i960_core 1
+#define bfd_mach_i960_ka_sa 2
+#define bfd_mach_i960_kb_sb 3
+#define bfd_mach_i960_mc 4
+#define bfd_mach_i960_xa 5
+#define bfd_mach_i960_ca 6
+
+ bfd_arch_a29k, /* AMD 29000 */
+ bfd_arch_sparc, /* SPARC */
+ bfd_arch_mips, /* MIPS Rxxxx */
+ bfd_arch_i386, /* Intel 386 */
+ bfd_arch_ns32k, /* National Semiconductor 32xxx */
+ bfd_arch_tahoe, /* CCI/Harris Tahoe */
+ bfd_arch_i860, /* Intel 860 */
+ bfd_arch_romp, /* IBM ROMP RS/6000 */
+ bfd_arch_alliant, /* Alliant */
+ bfd_arch_convex, /* Convex */
+ bfd_arch_m88k, /* Motorola 88xxx */
+ bfd_arch_pyramid, /* Pyramid Technology */
+ bfd_arch_h8300, /* Hitachi H8/300 */
+ bfd_arch_last
+ };
/*
-The text of the symbol. The name is left alone, and not copied - the
-application may not alter it.
+stuff
+
+ bfd_arch_info_struct
+This structure contains information on architectures.
*/
+typedef int bfd_reloc_code_enum_type;
- CONST char *name;
+typedef struct bfd_arch_info_struct
+{
+ int bits_per_word;
+ int bits_per_address;
+ int bits_per_byte;
+ enum bfd_architecture arch;
+ long mach;
+ char *arch_name;
+ CONST char *printable_name;
+/* true if this is the default machine for the architecture */
+ boolean the_default;
+ CONST struct bfd_arch_info_struct * EXFUN((*compatible),(CONST struct bfd_arch_info_struct *a,
+ CONST struct bfd_arch_info_struct *b));
+
+
+ boolean EXFUN((*scan),(CONST struct bfd_arch_info_struct *,CONST char *));
+ unsigned int EXFUN((*disassemble),(bfd_vma addr, CONST char *data,
+ PTR stream));
+ CONST struct reloc_howto_struct *EXFUN((*reloc_type_lookup), (bfd_reloc_code_enum_type code));
+
+ struct bfd_arch_info_struct *next;
+
+} bfd_arch_info_struct_type;
+
+/*
+ bfd_printable_arch_mach
+Return a printable string representing the architecture and machine
+type.
-/*
-The value of the symbol.
+NB. The use of this routine is depreciated.
*/
- symvalue value;
+ PROTO(CONST char *,bfd_printable_arch_mach,
+ (enum bfd_architecture arch, unsigned long machine));
/*
-Attributes of a symbol:
-*/
-#define BSF_NO_FLAGS 0x00
+ bfd_printable_name
-/*
-The symbol has local scope; @code{static} in @code{C}. The value is
-the offset into the section of the data.
+Return a printable string representing the architecture and machine
+from the pointer to the arch info structure
*/
-#define BSF_LOCAL 0x01
+ CONST char *EXFUN(bfd_printable_name,(bfd *abfd));
/*
-The symbol has global scope; initialized data in @code{C}. The value
-is the offset into the section of the data.
+
+*i bfd_scan_arch
+This routine is provided with a string and tries to work out if bfd
+supports any cpu which could be described with the name provided. The
+routine returns a pointer to an arch_info structure if a machine is
+found, otherwise NULL.
*/
-#define BSF_GLOBAL 0x02
+ bfd_arch_info_struct_type *EXFUN(bfd_scan_arch,(CONST char *));
/*
-Obsolete
+
+ bfd_arch_get_compatible
+This routine is used to determine whether two BFDs' architectures and
+machine types are compatible. It calculates the lowest common
+denominator between the two architectures and machine types implied by
+the BFDs and returns a pointer to an arch_info structure describing
+the compatible machine.
*/
-#define BSF_IMPORT 0x04
+ CONST bfd_arch_info_struct_type *EXFUN(bfd_arch_get_compatible,
+ (CONST bfd *abfd,
+ CONST bfd *bbfd));
/*
-The symbol has global scope, and is exported. The value is the offset
-into the section of the data.
+
+ bfd_set_arch_info
*/
-#define BSF_EXPORT 0x08
+ void EXFUN(bfd_set_arch_info,(bfd *, bfd_arch_info_struct_type *));
/*
-The symbol is undefined. @code{extern} in @code{C}. The value has no meaning.
+
+ bfd_get_arch
+
+Returns the enumerated type which describes the supplied bfd's
+architecture
*/
-#define BSF_UNDEFINED 0x10
+ enum bfd_architecture EXFUN(bfd_get_arch, (bfd *abfd));
/*
-The symbol is common, initialized to zero; default in @code{C}. The
-value is the size of the object in bytes.
+
+ bfd_get_mach
+
+Returns the long type which describes the supplied bfd's
+machine
*/
-#define BSF_FORT_COMM 0x20
+ unsigned long EXFUN(bfd_get_mach, (bfd *abfd));
/*
-A normal @code{C} symbol would be one of:
-@code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or @code{BSF_EXPORT|BSD_GLOBAL}
-The symbol is a debugging record. The value has an arbitary meaning.
+ bfd_arch_bits_per_byte
+
+Returns the number of bits in one of the architectures bytes
*/
-#define BSF_DEBUGGING 0x40
+ unsigned int EXFUN(bfd_arch_bits_per_byte, (bfd *abfd));
/*
-The symbol has no section attached, any value is the actual value and
-is not a relative offset to a section.
+
+ bfd_arch_bits_per_address
+
+Returns the number of bits in one of the architectures addresses
*/
-#define BSF_ABSOLUTE 0x80
+ unsigned int EXFUN(bfd_arch_bits_per_address, (bfd *abfd));
/*
-Used by the linker
+
+ bfd_get_arch_info
*/
-#define BSF_KEEP 0x10000
-#define BSF_KEEP_G 0x80000
+ bfd_arch_info_struct_type * EXFUN(bfd_get_arch_info,(bfd *));
/*
-Unused
*/
-#define BSF_WEAK 0x100000
-#define BSF_CTOR 0x200000
-#define BSF_FAKE 0x400000
-/*
-The symbol used to be a common symbol, but now it is allocated.
+/*:howto.c*/
+/* bfd_reloc_code_enum_type
*/
-#define BSF_OLD_COMMON 0x800000
+typedef enum
+{
/*
-The default value for common data.
+16 bits wide, simple reloc
*/
-#define BFD_FORT_COMM_DEFAULT_VALUE 0
+ BFD_RELOC_16,
/*
-In some files the type of a symbol sometimes alters its location
-in an output file - ie in coff a @code{ISFCN} symbol which is also @code{C_EXT}
-symbol appears where it was declared and not at the end of a section.
-This bit is set by the target BFD part to convey this information.
+8 bits wide, but used to form an address like 0xffnn
*/
-#define BSF_NOT_AT_END 0x40000
+ BFD_RELOC_8_FFnn,
/*
-Signal that the symbol is the label of constructor section.
+8 bits wide, simple
*/
-#define BSF_CONSTRUCTOR 0x1000000
+ BFD_RELOC_8,
/*
-Signal that the symbol is a warning symbol. If the symbol is a warning
-symbol, then the value field (I know this is tacky) will point to the
-asymbol which when referenced will cause the warning.
+8 bits wide, pc relative
*/
-#define BSF_WARNING 0x2000000
+ BFD_RELOC_8_PCREL
+ } bfd_reloc_code_enum_real_type;
/*
-Signal that the symbol is indirect. The value of the symbol is a
-pointer to an undefined asymbol which contains the name to use
-instead.
+
+ bfd_reloc_type_lookup
+This routine returns a pointer to a howto struct which when invoked,
+will perform the supplied relocation on data from the architecture
+noted.
+
+[Note] This function will go away.
*/
-#define BSF_INDIRECT 0x4000000
+ PROTO(struct reloc_howto_struct *,
+ bfd_reloc_type_lookup,
+ (enum bfd_architecture arch, bfd_reloc_code_enum_type code));
/*
*/
- flagword flags;
+/*:reloc.c*/
+/* bfd_perform_relocation
+The relocation routine returns as a status an enumerated type:
+*/
-/*
-A pointer to the section to which this symbol is relative, or 0 if the
-symbol is absolute or undefined. Note that it is not sufficient to set
-this location to 0 to mark a symbol as absolute - the flag
-@code{BSF_ABSOLUTE} must be set also.
+typedef enum bfd_reloc_status {
+/* No errors detected
*/
- struct sec *section;
+ bfd_reloc_ok,
/*
-Back end special data. This is being phased out in favour of making
-this a union.
+The relocation was performed, but there was an overflow.
*/
- PTR udata;
-} asymbol;
+ bfd_reloc_overflow,
/*
-
- get_symtab_upper_bound
-Returns the number of bytes required in a vector of pointers to
-@code{asymbols} for all the symbols in the supplied BFD, including a
-terminal NULL pointer. If there are no symbols in the BFD, then 0 is
-returned.
+The address to relocate was not within the section supplied
*/
-#define get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
-/*
+ bfd_reloc_outofrange,
- bfd_canonicalize_symtab
-Supplied a BFD and a pointer to an uninitialized vector of pointers.
-This reads in the symbols from the BFD, and fills in the table with
-pointers to the symbols, and a trailing NULL. The routine returns the
-actual number of symbol pointers not including the NULL.
+/*
+Used by special functions
*/
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab,\
- (abfd, location))
+ bfd_reloc_continue,
/*
- bfd_set_symtab
-Provided a table of pointers to to symbols and a count, writes to the
-output BFD the symbols when closed.
+Unused
*/
- PROTO(boolean, bfd_set_symtab, (bfd *, asymbol **, unsigned int ));
+ bfd_reloc_notsupported,
/*
+Unsupported relocation size requested.
+*/
- bfd_print_symbol_vandf
-Prints the value and flags of the symbol supplied to the stream file.
+ bfd_reloc_other,
+
+/*
+The symbol to relocate against was undefined.
*/
- PROTO(void, bfd_print_symbol_vandf, (PTR file, asymbol *symbol));
+ bfd_reloc_undefined,
/*
+The relocation was performed, but may not be ok - presently generated
+only when linking i960 coff files with i960 b.out symbols.
+*/
- bfd_make_empty_symbol
-This function creates a new @code{asymbol} structure for the BFD, and
-returns a pointer to it.
+ bfd_reloc_dangerous
+ }
+ bfd_reloc_status_enum_type;
-This routine is necessary, since each back end has private information
-surrounding the @code{asymbol}. Building your own @code{asymbol} and
-pointing to it will not create the private information, and will cause
-problems later on.
+/*
*/
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-/*:bfd.c*/
-/* @section @code{typedef bfd}
+typedef struct reloc_cache_entry
+{
-A BFD is has type @code{bfd}; objects of this type are the cornerstone
-of any application using @code{libbfd}. References though the BFD and
-to data in the BFD give the entire BFD functionality.
+/*
+A pointer into the canonical table of pointers
+*/
-Here is the struct used to define the type @code{bfd}. This contains
-the major data about the file, and contains pointers to the rest of
-the data.
+ struct symbol_cache_entry **sym_ptr_ptr;
+
+/*
+offset in section
*/
-struct _bfd
-{
-/* The filename the application opened the BFD with.
+ rawdata_offset address;
+
+/*
+addend for relocation value
*/
- CONST char *filename;
+ bfd_vma addend;
/*
-A pointer to the target jump table.
+if sym is null this is the section
*/
- struct bfd_target *xvec;
+ struct sec *section;
+
+/*
+Pointer to how to perform the required relocation
+*/
+
+ CONST struct reloc_howto_struct *howto;
+} arelent;
/*
-To avoid dragging too many header files into every file that
-includes @file{bfd.h}, IOSTREAM has been declared as a "char *", and MTIME
-as a "long". Their correct types, to which they are cast when used,
-are "FILE *" and "time_t".
+ reloc_howto_type
+The @code{reloc_howto_type} is a structure which contains all the
+information that BFD needs to know to tie up a back end's data.
+*/
-The iostream is the result of an fopen on the filename.
+typedef CONST struct reloc_howto_struct
+{
+/* The type field has mainly a documetary use - the back end can to what
+it wants with it, though the normally the back end's external idea of
+what a reloc number would be would be stored in this field. For
+example, the a PC relative word relocation in a coff environment would
+have the type 023 - because that's what the outside world calls a
+R_PCRWORD reloc.
*/
- char *iostream;
+ unsigned int type;
/*
-Is the file being cached @xref{File Caching}.
+The value the final relocation is shifted right by. This drops
+unwanted data from the relocation.
*/
- boolean cacheable;
+ unsigned int rightshift;
/*
-Marks whether there was a default target specified when the BFD was
-opened. This is used to select what matching algorithm to use to chose
-the back end.
+The size of the item to be relocated - 0, is one byte, 1 is 2 bytes, 3
+is four bytes.
*/
- boolean target_defaulted;
+ unsigned int size;
/*
-The caching routines use these to maintain a least-recently-used list of
-BFDs (@pxref{File Caching}).
+Now obsolete
*/
- struct _bfd *lru_prev, *lru_next;
+ unsigned int bitsize;
/*
-When a file is closed by the caching routines, BFD retains state
-information on the file here:
+Notes that the relocation is relative to the location in the data
+section of the addend. The relocation function will subtract from the
+relocation value the address of the location being relocated.
*/
- file_ptr where;
+ boolean pc_relative;
/*
-and here:
+Now obsolete
*/
- boolean opened_once;
+ unsigned int bitpos;
/*
+Now obsolete
*/
- boolean mtime_set;
-/* File modified time
+
+ boolean absolute;
+
+/*
+Causes the relocation routine to return an error if overflow is
+detected when relocating.
*/
- long mtime;
+ boolean complain_on_overflow;
/*
-Reserved for an unimplemented file locking extension.
+If this field is non null, then the supplied function is called rather
+than the normal function. This allows really strange relocation
+methods to be accomodated (eg, i960 callj instructions).
*/
-int ifd;
+ bfd_reloc_status_enum_type (*special_function)();
/*
-The format which belongs to the BFD.
+The textual name of the relocation type.
*/
- bfd_format format;
+ char *name;
/*
-The direction the BFD was opened with
+When performing a partial link, some formats must modify the
+relocations rather than the data - this flag signals this.
*/
- enum bfd_direction {no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3} direction;
+ boolean partial_inplace;
/*
-Format_specific flags
+The src_mask is used to select what parts of the read in data are to
+be used in the relocation sum. Eg, if this was an 8 bit bit of data
+which we read and relocated, this would be 0x000000ff. When we have
+relocs which have an addend, such as sun4 extended relocs, the value
+in the offset part of a relocating field is garbage so we never use
+it. In this case the mask would be 0x00000000.
*/
- flagword flags;
+ bfd_word src_mask;
+/* The dst_mask is what parts of the instruction are replaced into the
+instruction. In most cases src_mask == dst_mask, except in the above
+special case, where dst_mask would be 0x000000ff, and src_mask would
+be 0x00000000.
+*/
+
+ bfd_word dst_mask;
/*
-Currently my_archive is tested before adding origin to anything. I
-believe that this can become always an add of origin, with origin set
-to 0 for non archive files.
+When some formats create PC relative instructions, they leave the
+value of the pc of the place being relocated in the offset slot of the
+instruction, so that a PC relative relocation can be made just by
+adding in an ordinary offset (eg sun3 a.out). Some formats leave the
+displacement part of an instruction empty (eg m88k bcs), this flag
+signals the fact.
*/
- file_ptr origin;
+ boolean pcrel_offset;
+} reloc_howto_type;
/*
-Remember when output has begun, to stop strange things happening.
+
+ HOWTO
+The HOWTO define is horrible and will go away.
*/
+#define HOWTO(C, R,S,B, P, BI, ABS, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
+ {(unsigned)C,R,S,B, P, BI, ABS,O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
- boolean output_has_begun;
+/*
+And will be replaced with the totally magic way. But for the moment,
+we are compatible, so do it this way..
+*/
+
+#define NEWHOWTO( FUNCTION, NAME,SIZE,REL) HOWTO(0,0,SIZE,0,REL,0,false,false,FUNCTION, NAME,false,0,0,false)
/*
-Pointer to linked list of sections
+Helper routine to turn a symbol into a relocation value.
*/
- struct sec *sections;
+
+#define HOWTO_PREPARE(relocation, symbol) \
+ { \
+ if (symbol != (asymbol *)NULL) { \
+ if (symbol->flags & BSF_FORT_COMM) { \
+ relocation = 0; \
+ } \
+ else { \
+ relocation = symbol->value; \
+ } \
+ } \
+ if (symbol->section != (asection *)NULL) { \
+ relocation += symbol->section->output_section->vma + \
+ symbol->section->output_offset; \
+ } \
+}
/*
-The number of sections
+ reloc_chain
*/
+typedef unsigned char bfd_byte;
- unsigned int section_count;
+typedef struct relent_chain {
+ arelent relent;
+ struct relent_chain *next;
+} arelent_chain;
+
+/*
+
+If an output_bfd is supplied to this function the generated image
+will be relocatable, the relocations are copied to the output file
+after they have been changed to reflect the new state of the world.
+There are two ways of reflecting the results of partial linkage in an
+output file; by modifying the output data in place, and by modifying
+the relocation record. Some native formats (eg basic a.out and basic
+coff) have no way of specifying an addend in the relocation type, so
+the addend has to go in the output data. This is no big deal since in
+these formats the output data slot will always be big enough for the
+addend. Complex reloc types with addends were invented to solve just
+this problem.
+*/
+ PROTO(bfd_reloc_status_enum_type,
+ bfd_perform_relocation,
+ (bfd * abfd,
+ arelent *reloc_entry,
+ PTR data,
+ asection *input_section,
+ bfd *output_bfd));
/*
-Stuff only useful for object files:
-The start address.
*/
- bfd_vma start_address;
-/* Used for input and output
+/*:syms.c*/
+/* @subsection typedef asymbol
+An @code{asymbol} has the form:
*/
- unsigned int symcount;
-/* Symbol table for output BFD
+typedef struct symbol_cache_entry
+{
+/* A pointer to the BFD which owns the symbol. This information is
+necessary so that a back end can work out what additional (invisible to
+the application writer) information is carried with the symbol.
*/
- struct symbol_cache_entry **outsymbols;
+ struct _bfd *the_bfd;
/*
-Architecture of object machine, eg m68k
+The text of the symbol. The name is left alone, and not copied - the
+application may not alter it.
*/
- enum bfd_architecture obj_arch;
+ CONST char *name;
/*
-Particular machine within arch, e.g. 68010
+The value of the symbol.
*/
- unsigned long obj_machine;
+ symvalue value;
/*
-Stuff only useful for archives:
+Attributes of a symbol:
*/
- PTR arelt_data;
- struct _bfd *my_archive;
- struct _bfd *next;
- struct _bfd *archive_head;
- boolean has_armap;
+#define BSF_NO_FLAGS 0x00
/*
-Used by the back end to hold private data.
+The symbol has local scope; @code{static} in @code{C}. The value is
+the offset into the section of the data.
*/
- PTR tdata;
+#define BSF_LOCAL 0x01
/*
-Used by the application to hold private data
+The symbol has global scope; initialized data in @code{C}. The value
+is the offset into the section of the data.
*/
- PTR usrdata;
+#define BSF_GLOBAL 0x02
/*
-Where all the allocated stuff under this BFD goes (@pxref{Memory Usage}).
+Obsolete
*/
- struct obstack memory;
-};
+#define BSF_IMPORT 0x04
/*
+The symbol has global scope, and is exported. The value is the offset
+into the section of the data.
+*/
- bfd_set_start_address
+#define BSF_EXPORT 0x08
-Marks the entry point of an output BFD. Returns @code{true} on
-success, @code{false} otherwise.
+/*
+The symbol is undefined. @code{extern} in @code{C}. The value has no meaning.
*/
- PROTO(boolean, bfd_set_start_address,(bfd *, bfd_vma));
+#define BSF_UNDEFINED 0x10
/*
+The symbol is common, initialized to zero; default in @code{C}. The
+value is the size of the object in bytes.
+*/
- bfd_get_mtime
+#define BSF_FORT_COMM 0x20
-Return cached file modification time (e.g. as read from archive header
-for archive members, or from file system if we have been called
-before); else determine modify time, cache it, and return it.
+/*
+A normal @code{C} symbol would be one of:
+@code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or @code{BSF_EXPORT|BSD_GLOBAL}
+
+The symbol is a debugging record. The value has an arbitary meaning.
*/
- PROTO(long, bfd_get_mtime, (bfd *));
+#define BSF_DEBUGGING 0x40
/*
+The symbol has no section attached, any value is the actual value and
+is not a relative offset to a section.
+*/
- stuff
+#define BSF_ABSOLUTE 0x80
+
+/*
+Used by the linker
*/
+#define BSF_KEEP 0x10000
+#define BSF_KEEP_G 0x80000
-#define bfd_sizeof_headers(abfd, reloc) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+/*
+Unused
+*/
-#define bfd_find_nearest_line(abfd, section, symbols, offset, filename_ptr, func, line_ptr) \
- BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section, symbols, offset, filename_ptr, func, line_ptr))
+#define BSF_WEAK 0x100000
+#define BSF_CTOR 0x200000
+#define BSF_FAKE 0x400000
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+/*
+The symbol used to be a common symbol, but now it is allocated.
+*/
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+#define BSF_OLD_COMMON 0x800000
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+/*
+The default value for common data.
+*/
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+#define BFD_FORT_COMM_DEFAULT_VALUE 0
-#define bfd_coff_swap_aux_in(a,e,t,c,i) \
- BFD_SEND (a, _bfd_coff_swap_aux_in, (a,e,t,c,i))
+/*
+In some files the type of a symbol sometimes alters its location
+in an output file - ie in coff a @code{ISFCN} symbol which is also @code{C_EXT}
+symbol appears where it was declared and not at the end of a section.
+This bit is set by the target BFD part to convey this information.
+*/
-#define bfd_coff_swap_sym_in(a,e,i) \
- BFD_SEND (a, _bfd_coff_swap_sym_in, (a,e,i))
+#define BSF_NOT_AT_END 0x40000
-#define bfd_coff_swap_lineno_in(a,e,i) \
- BFD_SEND ( a, _bfd_coff_swap_lineno_in, (a,e,i))
+/*
+Signal that the symbol is the label of constructor section.
+*/
+
+#define BSF_CONSTRUCTOR 0x1000000
/*
+Signal that the symbol is a warning symbol. If the symbol is a warning
+symbol, then the value field (I know this is tacky) will point to the
+asymbol which when referenced will cause the warning.
*/
-/*:archive.c*/
-/* bfd_get_next_mapent
-What this does
+#define BSF_WARNING 0x2000000
+
+/*
+Signal that the symbol is indirect. The value of the symbol is a
+pointer to an undefined asymbol which contains the name to use
+instead.
*/
- PROTO(symindex, bfd_get_next_mapent, (bfd *, symindex, carsym **));
+
+#define BSF_INDIRECT 0x4000000
/*
+*/
+ flagword flags;
- bfd_set_archive_head
+/*
+A pointer to the section to which this symbol is relative, or 0 if the
+symbol is absolute or undefined. Note that it is not sufficient to set
+this location to 0 to mark a symbol as absolute - the flag
+@code{BSF_ABSOLUTE} must be set also.
+*/
-Used whilst processing archives. Sets the head of the chain of BFDs
-contained in an archive to @var{new_head}. (see chapter on archives)
+ struct sec *section;
+
+/*
+Back end special data. This is being phased out in favour of making
+this a union.
*/
- PROTO(boolean, bfd_set_archive_head, (bfd *output, bfd *new_head));
+ PTR udata;
+} asymbol;
/*
- bfd_get_elt_at_index
-Return the sub bfd contained within the archive at archive index n.
+ get_symtab_upper_bound
+Returns the number of bytes required in a vector of pointers to
+@code{asymbols} for all the symbols in the supplied BFD, including a
+terminal NULL pointer. If there are no symbols in the BFD, then 0 is
+returned.
*/
-
- PROTO(bfd *, bfd_get_elt_at_index, (bfd *, int));
+#define get_symtab_upper_bound(abfd) \
+ BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
/*
- bfd_openr_next_archived_file
-Initially provided a BFD containing an archive and NULL, opens a BFD
-on the first contained element and returns that. Subsequent calls to
-bfd_openr_next_archived_file should pass the archive and the previous
-return value to return a created BFD to the next contained element.
-NULL is returned when there are no more.
+ bfd_canonicalize_symtab
+Supplied a BFD and a pointer to an uninitialized vector of pointers.
+This reads in the symbols from the BFD, and fills in the table with
+pointers to the symbols, and a trailing NULL. The routine returns the
+actual number of symbol pointers not including the NULL.
*/
- PROTO(bfd*, bfd_openr_next_archived_file,
- (bfd *archive, bfd *previous));
+#define bfd_canonicalize_symtab(abfd, location) \
+ BFD_SEND (abfd, _bfd_canonicalize_symtab,\
+ (abfd, location))
/*
+ bfd_set_symtab
+Provided a table of pointers to to symbols and a count, writes to the
+output BFD the symbols when closed.
*/
+ PROTO(boolean, bfd_set_symtab, (bfd *, asymbol **, unsigned int ));
-/*:core.c*/
-/* bfd_core_file_failing_command
-Returns a read-only string explaining what program was running when
-it failed and produced the core file being read
+/*
+
+ bfd_print_symbol_vandf
+Prints the value and flags of the symbol supplied to the stream file.
*/
- PROTO(CONST char *, bfd_core_file_failing_command, (bfd *));
+ PROTO(void, bfd_print_symbol_vandf, (PTR file, asymbol *symbol));
/*
- bfd_core_file_failing_signal
-Returns the signal number which caused the core dump which generated
-the file the BFD is attached to.
+ bfd_make_empty_symbol
+This function creates a new @code{asymbol} structure for the BFD, and
+returns a pointer to it.
+
+This routine is necessary, since each back end has private information
+surrounding the @code{asymbol}. Building your own @code{asymbol} and
+pointing to it will not create the private information, and will cause
+problems later on.
*/
+#define bfd_make_empty_symbol(abfd) \
+ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
- PROTO(int, bfd_core_file_failing_signal, (bfd *));
+/*:bfd.c*/
+/* @section @code{typedef bfd}
-/*
+A BFD is has type @code{bfd}; objects of this type are the cornerstone
+of any application using @code{libbfd}. References though the BFD and
+to data in the BFD give the entire BFD functionality.
- core_file_matches_executable_p
-Returns @code{true} if the core file attached to @var{core_bfd} was
-generated by a run of the executable file attached to @var{exec_bfd},
-or else @code{false}.
+Here is the struct used to define the type @code{bfd}. This contains
+the major data about the file, and contains pointers to the rest of
+the data.
*/
- PROTO(boolean, core_file_matches_executable_p,
- (bfd *core_bfd, bfd *exec_bfd));
+
+struct _bfd
+{
+/* The filename the application opened the BFD with.
+*/
+
+ CONST char *filename;
/*
+A pointer to the target jump table.
*/
-/*:reloc.c*/
-/* bfd_perform_relocation
-The relocation routine returns as a status an enumerated type:
+ struct bfd_target *xvec;
+
+/*
+
+To avoid dragging too many header files into every file that
+includes @file{bfd.h}, IOSTREAM has been declared as a "char *", and MTIME
+as a "long". Their correct types, to which they are cast when used,
+are "FILE *" and "time_t".
+
+The iostream is the result of an fopen on the filename.
*/
-typedef enum bfd_reloc_status {
-/* No errors detected
+ char *iostream;
+
+/*
+Is the file being cached @xref{File Caching}.
*/
- bfd_reloc_ok,
+ boolean cacheable;
/*
-The relocation was performed, but there was an overflow.
+Marks whether there was a default target specified when the BFD was
+opened. This is used to select what matching algorithm to use to chose
+the back end.
*/
- bfd_reloc_overflow,
+ boolean target_defaulted;
/*
-The address to relocate was not within the section supplied
+The caching routines use these to maintain a least-recently-used list of
+BFDs (@pxref{File Caching}).
*/
- bfd_reloc_outofrange,
+ struct _bfd *lru_prev, *lru_next;
/*
-Used by special functions
+When a file is closed by the caching routines, BFD retains state
+information on the file here:
*/
- bfd_reloc_continue,
+ file_ptr where;
/*
-Unused
+and here:
*/
- bfd_reloc_notsupported,
+ boolean opened_once;
/*
-Unsupported relocation size requested.
+*/
+ boolean mtime_set;
+/* File modified time
*/
- bfd_reloc_other,
+ long mtime;
/*
-The symbol to relocate against was undefined.
+Reserved for an unimplemented file locking extension.
*/
- bfd_reloc_undefined,
+int ifd;
/*
-The relocation was performed, but may not be ok - presently generated
-only when linking i960 coff files with i960 b.out symbols.
+The format which belongs to the BFD.
*/
- bfd_reloc_dangerous
- }
- bfd_reloc_status_enum_type;
+ bfd_format format;
/*
+The direction the BFD was opened with
*/
-typedef struct reloc_cache_entry
-{
+ enum bfd_direction {no_direction = 0,
+ read_direction = 1,
+ write_direction = 2,
+ both_direction = 3} direction;
/*
-A pointer into the canonical table of pointers
+Format_specific flags
*/
- struct symbol_cache_entry **sym_ptr_ptr;
+ flagword flags;
/*
-offset in section
+Currently my_archive is tested before adding origin to anything. I
+believe that this can become always an add of origin, with origin set
+to 0 for non archive files.
*/
- rawdata_offset address;
+ file_ptr origin;
/*
-addend for relocation value
+Remember when output has begun, to stop strange things happening.
*/
- bfd_vma addend;
+ boolean output_has_begun;
/*
-if sym is null this is the section
+Pointer to linked list of sections
*/
- struct sec *section;
+ struct sec *sections;
/*
-Pointer to how to perform the required relocation
+The number of sections
*/
- CONST struct reloc_howto_struct *howto;
-} arelent;
+ unsigned int section_count;
/*
+Stuff only useful for object files:
+The start address.
+*/
- reloc_howto_type
-The @code{reloc_howto_type} is a structure which contains all the
-information that BFD needs to know to tie up a back end's data.
+ bfd_vma start_address;
+/* Used for input and output
*/
-typedef CONST struct reloc_howto_struct
-{
-/* The type field has mainly a documetary use - the back end can to what
-it wants with it, though the normally the back end's external idea of
-what a reloc number would be would be stored in this field. For
-example, the a PC relative word relocation in a coff environment would
-have the type 023 - because that's what the outside world calls a
-R_PCRWORD reloc.
+ unsigned int symcount;
+/* Symbol table for output BFD
*/
- unsigned int type;
+ struct symbol_cache_entry **outsymbols;
/*
-The value the final relocation is shifted right by. This drops
-unwanted data from the relocation.
+Pointer to structure which contains architecture information
*/
- unsigned int rightshift;
+ struct bfd_arch_info_struct *arch_info;
/*
-The size of the item to be relocated - 0, is one byte, 1 is 2 bytes, 3
-is four bytes.
+Stuff only useful for archives:
*/
- unsigned int size;
+ PTR arelt_data;
+ struct _bfd *my_archive;
+ struct _bfd *next;
+ struct _bfd *archive_head;
+ boolean has_armap;
/*
-Now obsolete
+Used by the back end to hold private data.
*/
- unsigned int bitsize;
+ PTR tdata;
/*
-Notes that the relocation is relative to the location in the data
-section of the addend. The relocation function will subtract from the
-relocation value the address of the location being relocated.
+Used by the application to hold private data
*/
- boolean pc_relative;
+ PTR usrdata;
/*
-Now obsolete
+Where all the allocated stuff under this BFD goes (@pxref{Memory Usage}).
*/
- unsigned int bitpos;
+ struct obstack memory;
+};
/*
-Now obsolete
+
+ bfd_set_start_address
+
+Marks the entry point of an output BFD. Returns @code{true} on
+success, @code{false} otherwise.
*/
- boolean absolute;
+ PROTO(boolean, bfd_set_start_address,(bfd *, bfd_vma));
/*
-Causes the relocation routine to return an error if overflow is
-detected when relocating.
+
+ bfd_get_mtime
+
+Return cached file modification time (e.g. as read from archive header
+for archive members, or from file system if we have been called
+before); else determine modify time, cache it, and return it.
*/
- boolean complain_on_overflow;
+ PROTO(long, bfd_get_mtime, (bfd *));
/*
-If this field is non null, then the supplied function is called rather
-than the normal function. This allows really strange relocation
-methods to be accomodated (eg, i960 callj instructions).
+
+ stuff
*/
- bfd_reloc_status_enum_type (*special_function)();
+
+#define bfd_sizeof_headers(abfd, reloc) \
+ BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+
+#define bfd_find_nearest_line(abfd, section, symbols, offset, filename_ptr, func, line_ptr) \
+ BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, section, symbols, offset, filename_ptr, func, line_ptr))
+
+#define bfd_debug_info_start(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+
+#define bfd_debug_info_end(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+
+#define bfd_debug_info_accumulate(abfd, section) \
+ BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+
+#define bfd_stat_arch_elt(abfd, stat) \
+ BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+
+#define bfd_coff_swap_aux_in(a,e,t,c,i) \
+ BFD_SEND (a, _bfd_coff_swap_aux_in, (a,e,t,c,i))
+
+#define bfd_coff_swap_sym_in(a,e,i) \
+ BFD_SEND (a, _bfd_coff_swap_sym_in, (a,e,i))
+
+#define bfd_coff_swap_lineno_in(a,e,i) \
+ BFD_SEND ( a, _bfd_coff_swap_lineno_in, (a,e,i))
+
+#define bfd_set_arch_mach(abfd, arch, mach)\
+ BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
/*
-The textual name of the relocation type.
*/
- char *name;
+/*:archive.c*/
+/* bfd_get_next_mapent
+What this does
+*/
+ PROTO(symindex, bfd_get_next_mapent, (bfd *, symindex, carsym **));
/*
-When performing a partial link, some formats must modify the
-relocations rather than the data - this flag signals this.
+
+ bfd_set_archive_head
+
+Used whilst processing archives. Sets the head of the chain of BFDs
+contained in an archive to @var{new_head}. (see chapter on archives)
*/
- boolean partial_inplace;
+ PROTO(boolean, bfd_set_archive_head, (bfd *output, bfd *new_head));
/*
-The src_mask is used to select what parts of the read in data are to
-be used in the relocation sum. Eg, if this was an 8 bit bit of data
-which we read and relocated, this would be 0x000000ff. When we have
-relocs which have an addend, such as sun4 extended relocs, the value
-in the offset part of a relocating field is garbage so we never use
-it. In this case the mask would be 0x00000000.
-*/
- bfd_word src_mask;
-/* The dst_mask is what parts of the instruction are replaced into the
-instruction. In most cases src_mask == dst_mask, except in the above
-special case, where dst_mask would be 0x000000ff, and src_mask would
-be 0x00000000.
+ bfd_get_elt_at_index
+Return the sub bfd contained within the archive at archive index n.
*/
- bfd_word dst_mask;
+ PROTO(bfd *, bfd_get_elt_at_index, (bfd *, int));
/*
-When some formats create PC relative instructions, they leave the
-value of the pc of the place being relocated in the offset slot of the
-instruction, so that a PC relative relocation can be made just by
-adding in an ordinary offset (eg sun3 a.out). Some formats leave the
-displacement part of an instruction empty (eg m88k bcs), this flag
-signals the fact.
+
+ bfd_openr_next_archived_file
+Initially provided a BFD containing an archive and NULL, opens a BFD
+on the first contained element and returns that. Subsequent calls to
+bfd_openr_next_archived_file should pass the archive and the previous
+return value to return a created BFD to the next contained element.
+NULL is returned when there are no more.
*/
- boolean pcrel_offset;
-} reloc_howto_type;
+ PROTO(bfd*, bfd_openr_next_archived_file,
+ (bfd *archive, bfd *previous));
/*
+*/
- HOWTO
-The HOWTO define is horrible and will go away.
+
+/*:core.c*/
+/* bfd_core_file_failing_command
+Returns a read-only string explaining what program was running when
+it failed and produced the core file being read
*/
-#define HOWTO(C, R,S,B, P, BI, ABS, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
- {(unsigned)C,R,S,B, P, BI, ABS,O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
+
+ PROTO(CONST char *, bfd_core_file_failing_command, (bfd *));
/*
- reloc_chain
+ bfd_core_file_failing_signal
+Returns the signal number which caused the core dump which generated
+the file the BFD is attached to.
*/
-typedef unsigned char bfd_byte;
-typedef struct relent_chain {
- arelent relent;
- struct relent_chain *next;
-} arelent_chain;
+ PROTO(int, bfd_core_file_failing_signal, (bfd *));
/*
-If an output_bfd is supplied to this function the generated image
-will be relocatable, the relocations are copied to the output file
-after they have been changed to reflect the new state of the world.
-There are two ways of reflecting the results of partial linkage in an
-output file; by modifying the output data in place, and by modifying
-the relocation record. Some native formats (eg basic a.out and basic
-coff) have no way of specifying an addend in the relocation type, so
-the addend has to go in the output data. This is no big deal since in
-these formats the output data slot will always be big enough for the
-addend. Complex reloc types with addends were invented to solve just
-this problem.
+ core_file_matches_executable_p
+Returns @code{true} if the core file attached to @var{core_bfd} was
+generated by a run of the executable file attached to @var{exec_bfd},
+or else @code{false}.
*/
- PROTO(bfd_reloc_status_enum_type,
- bfd_perform_relocation,
- (bfd * abfd,
- arelent *reloc_entry,
- PTR data,
- asection *input_section,
- bfd *output_bfd));
+ PROTO(boolean, core_file_matches_executable_p,
+ (bfd *core_bfd, bfd *exec_bfd));
/*
*/
*/
#endif
+
+
+
+
+
struct code {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
op_enum_type nib[9];
} ;
BITOP(n, RS8, name, op00, op01, op10,op11, op20,op21)
#define BRANCH(name, op) \
-{ 2, 1, 1,name,{DISP8,E}, { 0x4, op, DISP8,IGNORE,E }}
+{ 2, 1, 1,name,{DISP8,E}, { Hex4, op, DISP8,IGNORE,E }}
#define TWOOP(name, op1, op2,op3) \
{ 2, 2, 2, name, {IMM8, RD8,E}, { op1, RD8, IMM8,IGNORE,E}},\
{ 2, 1, 1, name, {RS8, E}, { op1, op2, 0, RS8, E}}
#define UNOP3(name, op1, op2, op3) \
-{ 2, 1, 1, name , {RS8, E}, {op1, op2, op3, RS8, E}}
+{2, 1, 1, name , {RS8, E}, {op1, op2, op3, RS8, E}}
#define WTWOP(name, op1, op2) \
{2, 2, 1, name, {RS16, RD16, E}, { op1, op2, RS16, RD16, E}}
=
{
- TWOOP("add.b", 0x8, 0x0,0x8),
- WTWOP("add.w", 0x0, 0x9),
- { 2, 2, 1, "adds", {KBIT,RD16|B30, E},{0x0, 0xb, KBIT, RD16|B30, E}},
- TWOOP("addx", 0x9,0x0,0xe),
- TWOOP("and", 0xe,0x1,0x6),
- { 2, 2, 1, "andc", {IMM8, CCR, E}, { 0x0, 0x6, IMM8,IGNORE, E}},
- BITOP(3,IMM3|B30, "band", 0x7, 0x6, 0x7, 0xc, 0x7, 0xe),
- BRANCH("bra", 0x0),
- BRANCH("bt", 0x0),
- BRANCH("brn", 0x1),
- BRANCH("bf", 0x1),
- BRANCH("bhi", 0x2),
- BRANCH("bls", 0x3),
- BRANCH("bcc", 0x4),
- BRANCH("bhs", 0x4),
- BRANCH("bcs", 0x5),
- BRANCH("blo", 0x5),
- BRANCH("bne", 0x6),
- BRANCH("beq", 0x7),
- BRANCH("bvc", 0x8),
- BRANCH("bvs", 0x9),
- BRANCH("bpl", 0xa),
- BRANCH("bmi", 0xb),
- BRANCH("bge", 0xc),
- BRANCH("blt", 0xd),
- BRANCH("bgt", 0xe),
- BRANCH("ble", 0xf),
- EBITOP(6,IMM3|B30,"bclr", 0x6, 0x2, 0x7, 0xd, 0x7, 0xf),
- BITOP(3,IMM3|B31,"biand", 0x7, 0x6, 0x7, 0xc, 0x7, 0xe),
- BITOP(3,IMM3|B31, "bild", 0x7, 0x7,0x7, 0xc, 0x7, 0xe),
- BITOP(3,IMM3|B31, "bior", 0x7, 0x4,0x7, 0xc, 0x7, 0xe),
- BITOP(3,IMM3|B31, "bist", 0x6, 0x7,0x7, 0xd, 0x7, 0xe),
- BITOP(3,IMM3|B31, "bixor", 0x7, 0x5,0x7, 0xc, 0x7, 0xe),
- BITOP(3,IMM3|B30, "bld", 0x7, 0x7,0x7, 0xc, 0x7, 0xe),
- EBITOP(6,IMM3|B30,"bnot", 0x6, 0x1, 0x7, 0xd, 0x7, 0xf),
- BITOP(3,IMM3|B30,"bor", 0x7, 0x4,0x7, 0xc, 0x7, 0xe),
- EBITOP(6,IMM3|B30,"bset", 0x6, 0x0,0x7, 0xd, 0x7, 0xf),
- { 2, 1, 1, "bsr",{DISP8, E},{ 0x5, 0x5, DISP8,IGNORE, E}},
- BITOP(3,IMM3|B30, "bst", 0x6, 0x7,0x7, 0xd, 0x7, 0xf),
- EBITOP(6,IMM3|B30, "btst", 0x6, 0x3,0x7, 0xc, 0x7, 0xe),
- BITOP(3,IMM3|B30, "bxor", 0x7,0x5,0x7, 0xc, 0x7, 0xe),
- TWOOP( "cmp.b",0xa, 0x1, 0xc),
- WTWOP( "cmp.w",0x1,0xd),
- UNOP( "daa",0x0, 0xf),
- UNOP( "das",0x1, 0xf),
- UNOP( "dec",0x1, 0xa),
- { 2, 2, 1, "divxu",{RS8, RD16|B30, E}, { 0x5, 0x1, RS8, RD16|B30, E}},
- { 4, 0, 1, "eepmov",{ E}, {0x7, 0xb, 0x5, 0xc, 0x5, 0x9, 0x8, 0xf,E}},
- UNOP( "inc", 0x0, 0xa),
- { 2, 1, 3, "jmp",{RSIND|B30, E}, {0x5, 0x9, RSIND|B30, 0x0, E}},
- { 4, 1, 3, "jmp",{ABS16SRC, E}, {0x5, 0xa, 0x0, 0x0, ABS16SRC, IGNORE,IGNORE,IGNORE,E}},
- { 2, 1, 3, "jmp",{MEMIND, E}, {0x5, 0xb, MEMIND,IGNORE, E}},
- { 2, 1, 3, "jsr",{RSIND|B30, E}, {0x5, 0xd, RSIND|B30, 0x0, E}},
- { 4, 1, 3, "jsr",{ABS16SRC, E}, {0x5, 0xe, 0x0, 0x0, ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
- { 2, 1, 3, "jsr",{MEMIND, E}, {0x5, 0xf, MEMIND, IGNORE,E}},
- { 2, 2, 2, "ldc", {IMM8, CCR, E}, { 0x0, 0x7, IMM8,IGNORE, E}},
- { 2, 2, 2, "ldc", {RS8, CCR, E}, { 0x0, 0x3, 0x0, RS8, E}},
-
- { 2, 2,13, "mov.b", {RS8, RD8, E}, { 0x0, 0xc, RS8, RD8, E}},
- { 2, 2,13, "mov.b", {IMM8, RD8, E}, { 0xf, RD8, IMM8,IGNORE, E}},
- { 2, 2,13, "mov.b", {RSIND|B30,RD8, E}, { 0x6, 0x8, RSIND|B30, RD8, E}},
- { 4, 2,13, "mov.b", {DISPSRC,RD8, E}, { 0x6, 0xe, DISPREG|B30, RD8, DISPSRC, IGNORE, IGNORE, IGNORE, E}} ,
- { 2, 2,13, "mov.b", {RSINC|B30, RD8, E}, { 0x6, 0xc, RSINC|B30, RD8, E}},
-
- { 4, 2,13, "mov.b", {ABS16SRC, RD8, E}, { 0x6, 0xa, 0x0, RD8,ABS16SRC, IGNORE,IGNORE,IGNORE,E}},
- { 2, 2,13, "mov.b", {ABS8SRC, RD8, E}, { 0x2, RD8, ABS8SRC,IGNORE, E}},
- { 2, 2,13, "mov.b", {RS8, RDIND|B30, E}, { 0x6, 0x8, RDIND|B31, RS8, E}},
- { 4, 2,13, "mov.b", {RS8, DISPDST, E}, { 0x6, 0xe, DISPREG|B31, RS8,DISPDST, IGNORE, IGNORE, IGNORE, E}},
- { 2, 2,13, "mov.b", {RS8, RDDEC|B30, E}, { 0x6, 0xc, RDDEC|B30, RS8, E}},
+ TWOOP("add.b", Hex8, Hex0,Hex8),
+ WTWOP("add.w", Hex0, Hex9),
+ { 2, 2, 1, "adds", {KBIT,RD16|B30, E},{Hex0, HexB, KBIT, RD16|B30, E}},
+ TWOOP("addx", Hex9,Hex0,HexE),
+ TWOOP("and", HexE,Hex1,Hex6),
+ { 2, 2, 1, "andc", {IMM8, CCR, E}, { Hex0, Hex6, IMM8,IGNORE, E}},
+ BITOP(3,IMM3|B30, "band", Hex7, Hex6, Hex7, HexC, Hex7, HexE),
+ BRANCH("bra", Hex0),
+ BRANCH("bt", Hex0),
+ BRANCH("brn", Hex1),
+ BRANCH("bf", Hex1),
+ BRANCH("bhi", Hex2),
+ BRANCH("bls", Hex3),
+ BRANCH("bcc", Hex4),
+ BRANCH("bhs", Hex4),
+ BRANCH("bcs", Hex5),
+ BRANCH("blo", Hex5),
+ BRANCH("bne", Hex6),
+ BRANCH("beq", Hex7),
+ BRANCH("bvc", Hex8),
+ BRANCH("bvs", Hex9),
+ BRANCH("bpl", HexA),
+ BRANCH("bmi", HexB),
+ BRANCH("bge", HexC),
+ BRANCH("blt", HexD),
+ BRANCH("bgt", HexE),
+ BRANCH("ble", HexF),
+ EBITOP(6,IMM3|B30,"bclr", Hex6, Hex2, Hex7, HexD, Hex7, HexF),
+ BITOP(3,IMM3|B31,"biand", Hex7, Hex6, Hex7, HexC, Hex7, HexE),
+ BITOP(3,IMM3|B31, "bild", Hex7, Hex7,Hex7, HexC, Hex7, HexE),
+ BITOP(3,IMM3|B31, "bior", Hex7, Hex4,Hex7, HexC, Hex7, HexE),
+ BITOP(3,IMM3|B31, "bist", Hex6, Hex7,Hex7, HexD, Hex7, HexE),
+ BITOP(3,IMM3|B31, "bixor", Hex7, Hex5,Hex7, HexC, Hex7, HexE),
+ BITOP(3,IMM3|B30, "bld", Hex7, Hex7,Hex7, HexC, Hex7, HexE),
+ EBITOP(6,IMM3|B30,"bnot", Hex6, Hex1, Hex7, HexD, Hex7, HexF),
+ BITOP(3,IMM3|B30,"bor", Hex7, Hex4,Hex7, HexC, Hex7, HexE),
+ EBITOP(6,IMM3|B30,"bset", Hex6, Hex0,Hex7, HexD, Hex7, HexF),
+ { 2, 1, 1, "bsr",{DISP8, E},{ Hex5, Hex5, DISP8,IGNORE, E}},
+ BITOP(3,IMM3|B30, "bst", Hex6, Hex7,Hex7, HexD, Hex7, HexF),
+ EBITOP(6,IMM3|B30, "btst", Hex6, Hex3,Hex7, HexC, Hex7, HexE),
+ BITOP(3,IMM3|B30, "bxor", Hex7,Hex5,Hex7, HexC, Hex7, HexE),
+ TWOOP( "cmp.b",HexA, Hex1, HexC),
+ WTWOP( "cmp.w",Hex1,HexD),
+ UNOP( "daa",Hex0, HexF),
+ UNOP( "das",Hex1, HexF),
+ UNOP( "dec",Hex1, HexA),
+ { 2, 2, 1, "divxu",{RS8, RD16|B30, E}, { Hex5, Hex1, RS8, RD16|B30, E}},
+ { 4, 0, 1, "eepmov",{ E}, {Hex7, HexB, Hex5, HexC, Hex5, Hex9, Hex8, HexF,E}},
+ UNOP( "inc", Hex0, HexA),
+ { 2, 1, 3, "jmp",{RSIND|B30, E}, {Hex5, Hex9, RSIND|B30, Hex0, E}},
+ { 4, 1, 3, "jmp",{ABS16SRC, E}, {Hex5, HexA, Hex0, Hex0, ABS16SRC, IGNORE,IGNORE,IGNORE,E}},
+ { 2, 1, 3, "jmp",{MEMIND, E}, {Hex5, HexB, MEMIND,IGNORE, E}},
+ { 2, 1, 3, "jsr",{RSIND|B30, E}, {Hex5, HexD, RSIND|B30, Hex0, E}},
+ { 4, 1, 3, "jsr",{ABS16SRC, E}, {Hex5, HexE, Hex0, Hex0, ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
+ { 2, 1, 3, "jsr",{MEMIND, E}, {Hex5, HexF, MEMIND, IGNORE,E}},
+ { 2, 2, 2, "ldc", {IMM8, CCR, E}, { Hex0, Hex7, IMM8,IGNORE, E}},
+ { 2, 2, 2, "ldc", {RS8, CCR, E}, { Hex0, Hex3, Hex0, RS8, E}},
+
+ { 2, 2,13, "mov.b", {RS8, RD8, E}, { Hex0, HexC, RS8, RD8, E}},
+ { 2, 2,13, "mov.b", {IMM8, RD8, E}, { HexF, RD8, IMM8,IGNORE, E}},
+ { 2, 2,13, "mov.b", {RSIND|B30,RD8, E}, { Hex6, Hex8, RSIND|B30, RD8, E}},
+ { 4, 2,13, "mov.b", {DISPSRC,RD8, E}, { Hex6, HexE, DISPREG|B30, RD8, DISPSRC, IGNORE, IGNORE, IGNORE, E}} ,
+ { 2, 2,13, "mov.b", {RSINC|B30, RD8, E}, { Hex6, HexC, RSINC|B30, RD8, E}},
+
+ { 4, 2,13, "mov.b", {ABS16SRC, RD8, E}, { Hex6, HexA, Hex0, RD8,ABS16SRC, IGNORE,IGNORE,IGNORE,E}},
+ { 2, 2,13, "mov.b", {ABS8SRC, RD8, E}, { Hex2, RD8, ABS8SRC,IGNORE, E}},
+ { 2, 2,13, "mov.b", {RS8, RDIND|B30, E}, { Hex6, Hex8, RDIND|B31, RS8, E}},
+ { 4, 2,13, "mov.b", {RS8, DISPDST, E}, { Hex6, HexE, DISPREG|B31, RS8,DISPDST, IGNORE, IGNORE, IGNORE, E}},
+ { 2, 2,13, "mov.b", {RS8, RDDEC|B30, E}, { Hex6, HexC, RDDEC|B30, RS8, E}},
/* Put the 16 bit one in first so it matches first */
- { 4, 2,13, "mov.b", {RS8, ABS16DST, E}, { 0x6, 0xa, 0x8, RS8, ABS16DST,IGNORE,IGNORE,IGNORE, E}},
- { 2, 2,13, "mov.b", {RS8, ABS8DST, E}, { 0x3, RS8, ABS8DST,IGNORE, E}},
- { 2, 2,11, "mov.w", {RS16|B30, RD16|B30, E},{ 0x0, 0xd, RS16|B30, RD16|B30, E}},
- { 4, 2,11, "mov.w", {IMM16, RD16|B30, E}, { 0x7, 0x9, 0x0, RD16|B30, IMM16,IGNORE,IGNORE,IGNORE, E}},
- { 2, 2,11, "mov.w", {RSIND|B30,RD16|B30, E},{ 0x6, 0x9, RSIND|B30, RD16|B30, E}},
- { 4, 2,11, "mov.w", {DISPSRC,RD16|B30, E}, { 0x6, 0xf, DISPREG|B30, RD16|B30, DISPSRC, IGNORE, IGNORE, IGNORE,E}} ,
- { 2, 2,11, "mov.w", {RSINC|B30, RD16|B30, E}, { 0x6, 0xd, RSINC|B30, RD16|B30, E}},
- { 4, 2,11, "mov.w", {ABS16SRC, RD16|B30, E}, { 0x6, 0xb, 0x0, RD16|B30,ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
- { 2, 2,11, "mov.w", {RS16|B30, RDIND|B30, E},{ 0x6, 0x9, RDIND|B31, RS16|B30, E}},
- { 4, 2,11, "mov.w", {RS16|B30, DISPDST, E}, { 0x6, 0xf, DISPREG|B31, RS16|B30,DISPDST, IGNORE,IGNORE,IGNORE,E}},
- { 2, 2,11, "mov.w", {RS16|B30, RDDEC|B30, E},{ 0x6, 0xd, RDDEC|B31, RS16|B30, E}},
- { 4, 2,11, "mov.w", {RS16|B30, ABS16DST, E}, { 0x6, 0xb, 0x8, RS16|B30, ABS16DST, IGNORE, IGNORE, IGNORE, E}},
-
-
- { 4, 2,1, "movfpe", {ABS16SRC, RD8, E}, { 0x6, 0xa, 0x4, RD8, ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
- { 4, 2,1, "movtpe", {RS8, ABS16DST, E}, { 0x6, 0xa, 0xc, RS8, ABS16DST,IGNORE,IGNORE,IGNORE, E}},
- { 2, 2,1, "mulxu", {RS8, RD16|B30, E}, { 0x5, 0x0, RS8, RD16|B30, E}},
- { 2, 1,1, "neg", {RS8, E}, { 0x1, 0x7, 0x8, RS8, E}},
- { 2, 0,1, "nop", {E}, { 0x0, 0x0, 0x0, 0x0,E}},
- { 2, 1,1, "not", {RS8,E}, { 0x1, 0x7, 0x0, RS8,E}},
- TWOOP("or", 0xc, 0x1, 0x4),
- { 2, 2,1, "orc", {IMM8, CCR,E}, { 0x0, 0x4, IMM8,IGNORE,E}},
- { 2, 1,1, "pop", {RS16|B30,E}, { 0x6, 0xd, 0x7, RS16|B30,E}},
- { 2, 1,1, "push", {RS16|B30,E}, { 0x6, 0xd, 0xf, RS16|B30,E}},
- UNOP3( "rotl",0x1, 0x2,0x8),
- UNOP3( "rotr",0x1, 0x3, 0x8),
- UNOP3( "rotxl",0x1, 0x2, 0x0),
- UNOP3( "rotxr",0x1, 0x3, 0x0),
- { 2, 0, 1, "rte", {E}, { 0x5, 0x6, 0x7, 0x0,E}},
- { 2, 0, 1, "rts", {E}, { 0x5, 0x4, 0x7, 0x0,E}},
- UNOP3( "shal", 0x1, 0x00, 0x08),
- UNOP3( "shar", 0x1, 0x1, 0x8),
- UNOP3( "shll", 0x1, 0x0, 0x0),
- UNOP3( "shlr", 0x1, 0x1, 0x0),
- { 2, 0, 1, "sleep", {E}, { 0x0, 0x1, 0x8, 0x0,E}},
- { 2, 2, 1, "stc", {CCR, RD8,E}, { 0x0, 0x2, 0x0, RD8,E}},
- { 2, 2, 1, "sub.b", {RS8,RD8,E}, { 0x1, 0x8, RS8, RD8,E}},
- { 2, 2, 1, "sub.w", {RS16|B30, RD16|B30,E}, {0x1, 0x9, RS16|B30, RD16|B30,E}},
- { 2, 2, 1, "subs", {KBIT,RD16|B30,E}, { 0x1, 0xb, KBIT, RD16|B30,E}},
- TWOOP("subx",0xb, 0x1, 0xe),
- TWOOP("xor", 0xd, 0x1, 0x5),
- { 2, 2, 1,"xorc", {IMM8, CCR,E}, { 0x0, 0x5, IMM8,IGNORE,E}},
- { 2, 0,1, "bad 52", {E, IMM8}, { 0x5, 0x2, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 53", {E, IMM8}, { 0x5, 0x3, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 57", {E, IMM8}, { 0x5, 0x7, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 58", {E, IMM8}, { 0x5, 0x8, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 64", {E, IMM8}, { 0x6, 0x4, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 65", {E, IMM8}, { 0x6, 0x5, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 66", {E, IMM8}, { 0x6, 0x6, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 78", {E, IMM8}, { 0x7, 0x8, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 7a", {E, IMM8}, { 0x7, 0xa, IMM8, IGNORE,E}},
- { 2, 0,1, "bad 5c", {E, IMM8}, { 0x5, 0xc, IMM8, IGNORE,E}},
+ { 4, 2,13, "mov.b", {RS8, ABS16DST, E}, { Hex6, HexA, Hex8, RS8, ABS16DST,IGNORE,IGNORE,IGNORE, E}},
+ { 2, 2,13, "mov.b", {RS8, ABS8DST, E}, { Hex3, RS8, ABS8DST,IGNORE, E}},
+ { 2, 2,11, "mov.w", {RS16|B30, RD16|B30, E},{ Hex0, HexD, RS16|B30, RD16|B30, E}},
+ { 4, 2,11, "mov.w", {IMM16, RD16|B30, E}, { Hex7, Hex9, Hex0, RD16|B30, IMM16,IGNORE,IGNORE,IGNORE, E}},
+ { 2, 2,11, "mov.w", {RSIND|B30,RD16|B30, E},{ Hex6, Hex9, RSIND|B30, RD16|B30, E}},
+ { 4, 2,11, "mov.w", {DISPSRC,RD16|B30, E}, { Hex6, HexF, DISPREG|B30, RD16|B30, DISPSRC, IGNORE, IGNORE, IGNORE,E}} ,
+ { 2, 2,11, "mov.w", {RSINC|B30, RD16|B30, E}, { Hex6, HexD, RSINC|B30, RD16|B30, E}},
+ { 4, 2,11, "mov.w", {ABS16SRC, RD16|B30, E}, { Hex6, HexB, Hex0, RD16|B30,ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
+ { 2, 2,11, "mov.w", {RS16|B30, RDIND|B30, E},{ Hex6, Hex9, RDIND|B31, RS16|B30, E}},
+ { 4, 2,11, "mov.w", {RS16|B30, DISPDST, E}, { Hex6, HexF, DISPREG|B31, RS16|B30,DISPDST, IGNORE,IGNORE,IGNORE,E}},
+ { 2, 2,11, "mov.w", {RS16|B30, RDDEC|B30, E},{ Hex6, HexD, RDDEC|B31, RS16|B30, E}},
+ { 4, 2,11, "mov.w", {RS16|B30, ABS16DST, E}, { Hex6, HexB, Hex8, RS16|B30, ABS16DST, IGNORE, IGNORE, IGNORE, E}},
+
+
+ { 4, 2,1, "movfpe", {ABS16SRC, RD8, E}, { Hex6, HexA, Hex4, RD8, ABS16SRC,IGNORE,IGNORE,IGNORE, E}},
+ { 4, 2,1, "movtpe", {RS8, ABS16DST, E}, { Hex6, HexA, HexC, RS8, ABS16DST,IGNORE,IGNORE,IGNORE, E}},
+ { 2, 2,1, "mulxu", {RS8, RD16|B30, E}, { Hex5, Hex0, RS8, RD16|B30, E}},
+ { 2, 1,1, "neg", {RS8, E}, { Hex1, Hex7, Hex8, RS8, E}},
+ { 2, 0,1, "nop", {E}, { Hex0, Hex0, Hex0, Hex0,E}},
+ { 2, 1,1, "not", {RS8,E}, { Hex1, Hex7, Hex0, RS8,E}},
+ TWOOP("or", HexC, Hex1, Hex4),
+ { 2, 2,1, "orc", {IMM8, CCR,E}, { Hex0, Hex4, IMM8,IGNORE,E}},
+ { 2, 1,1, "pop", {RS16|B30,E}, { Hex6, HexD, Hex7, RS16|B30,E}},
+ { 2, 1,1, "push", {RS16|B30,E}, { Hex6, HexD, HexF, RS16|B30,E}},
+ UNOP3( "rotl",Hex1, Hex2,Hex8),
+ UNOP3( "rotr",Hex1, Hex3, Hex8),
+ UNOP3( "rotxl",Hex1, Hex2, Hex0),
+ UNOP3( "rotxr",Hex1, Hex3, Hex0),
+ { 2, 0, 1, "rte", {E}, { Hex5, Hex6, Hex7, Hex0,E}},
+ { 2, 0, 1, "rts", {E}, { Hex5, Hex4, Hex7, Hex0,E}},
+ UNOP3( "shal", Hex1, Hex0, Hex8),
+ UNOP3( "shar", Hex1, Hex1, Hex8),
+ UNOP3( "shll", Hex1, Hex0, Hex0),
+ UNOP3( "shlr", Hex1, Hex1, Hex0),
+ { 2, 0, 1, "sleep", {E}, { Hex0, Hex1, Hex8, Hex0,E}},
+ { 2, 2, 1, "stc", {CCR, RD8,E}, { Hex0, Hex2, Hex0, RD8,E}},
+ { 2, 2, 1, "sub.b", {RS8,RD8,E}, { Hex1, Hex8, RS8, RD8,E}},
+ { 2, 2, 1, "sub.w", {RS16|B30, RD16|B30,E}, {Hex1, Hex9, RS16|B30, RD16|B30,E}},
+ { 2, 2, 1, "subs", {KBIT,RD16|B30,E}, { Hex1, HexB, KBIT, RD16|B30,E}},
+ TWOOP("subx",HexB, Hex1, HexE),
+ TWOOP("xor", HexD, Hex1, Hex5),
+ { 2, 2, 1,"xorc", {IMM8, CCR,E}, { Hex0, Hex5, IMM8,IGNORE,E}},
+ { 2, 0,1, "bad 52", {E, IMM8}, { Hex5, Hex2, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 53", {E, IMM8}, { Hex5, Hex3, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 57", {E, IMM8}, { Hex5, Hex7, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 58", {E, IMM8}, { Hex5, Hex8, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 64", {E, IMM8}, { Hex6, Hex4, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 65", {E, IMM8}, { Hex6, Hex5, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 66", {E, IMM8}, { Hex6, Hex6, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 78", {E, IMM8}, { Hex7, Hex8, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 7a", {E, IMM8}, { Hex7, HexA, IMM8, IGNORE,E}},
+ { 2, 0,1, "bad 5c", {E, IMM8}, { Hex5, HexC, IMM8, IGNORE,E}},
0
}