Back to index

cell-binutils  2.17cvs20070401
oasys.h
Go to the documentation of this file.
00001 /* Oasys object format header file for BFD.
00002 
00003    Copyright 2001 Free Software Foundation, Inc.
00004    
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019    
00020    Contributed by Cygnus Support.  */
00021 
00022 #define OASYS_MAX_SEC_COUNT 16
00023 /* **** */
00024 
00025 typedef struct oasys_archive_header
00026   {
00027     unsigned int  version;
00028     char create_date[12];
00029     char revision_date[12];
00030     unsigned int mod_count;
00031     file_ptr mod_tbl_offset;
00032     unsigned int sym_tbl_size;
00033     unsigned int sym_count;
00034     file_ptr sym_tbl_offset;
00035     unsigned int xref_count;
00036     file_ptr xref_lst_offset;
00037   }
00038 oasys_archive_header_type;
00039 
00040 typedef struct oasys_extarchive_header
00041   {
00042     bfd_byte version[4];
00043     bfd_byte create_date[12];
00044     bfd_byte revision_date[12];
00045     bfd_byte mod_count[4];
00046     bfd_byte mod_tbl_offset[4];
00047     bfd_byte sym_tbl_size[4];
00048     bfd_byte sym_count[4];
00049     bfd_byte sym_tbl_offset[4];
00050     bfd_byte xref_count[4];
00051     bfd_byte xref_lst_offset[4];
00052   }
00053 oasys_extarchive_header_type;
00054 
00055 typedef struct oasys_module_table
00056   {
00057     int mod_number;
00058     char mod_date[12];
00059     unsigned int mod_size;
00060     unsigned int dep_count;
00061     unsigned int depee_count;
00062     file_ptr file_offset;
00063     unsigned int sect_count;
00064     char *module_name;
00065     unsigned int module_name_size;
00066   }
00067 oasys_module_table_type;
00068 
00069 typedef struct oasys_extmodule_table_a
00070   {
00071     bfd_byte mod_number[4];
00072     bfd_byte mod_date[12];
00073     bfd_byte mod_size[4];
00074     bfd_byte dep_count[4];
00075     bfd_byte depee_count[4];
00076     bfd_byte sect_count[4];
00077     bfd_byte file_offset[4];
00078     bfd_byte mod_name[32];
00079   }
00080 oasys_extmodule_table_type_a_type;
00081 
00082 typedef struct oasys_extmodule_table_b
00083   {
00084     bfd_byte mod_number[4];
00085     bfd_byte mod_date[12];
00086     bfd_byte mod_size[4];
00087     bfd_byte dep_count[4];
00088     bfd_byte depee_count[4];
00089     bfd_byte sect_count[4];
00090     bfd_byte file_offset[4];
00091     bfd_byte mod_name_length[4];
00092   }
00093 oasys_extmodule_table_type_b_type;
00094 
00095 typedef enum oasys_record
00096   {
00097     oasys_record_is_end_enum = 0,
00098     oasys_record_is_data_enum = 1,
00099     oasys_record_is_symbol_enum = 2,
00100     oasys_record_is_header_enum = 3,
00101     oasys_record_is_named_section_enum = 4,
00102     oasys_record_is_com_enum = 5,
00103     oasys_record_is_debug_enum = 6,
00104     oasys_record_is_section_enum = 7,
00105     oasys_record_is_debug_file_enum = 8,
00106     oasys_record_is_module_enum = 9,
00107     oasys_record_is_local_enum = 10
00108   }
00109 oasys_record_enum_type;
00110 
00111 typedef struct oasys_record_header
00112   {
00113     unsigned char length;
00114     unsigned char check_sum;
00115     unsigned char type;
00116     unsigned char fill;
00117   }
00118 oasys_record_header_type;
00119 
00120 typedef struct oasys_data_record
00121   {
00122     oasys_record_header_type header;
00123     unsigned char relb;
00124     bfd_byte addr[4];
00125     /* maximum total size of data record is 255 bytes */
00126     bfd_byte data[246];
00127   }
00128 oasys_data_record_type;
00129 
00130 typedef struct oasys_header_record
00131   {
00132     oasys_record_header_type header;
00133     unsigned char version_number;
00134     unsigned char rev_number;
00135     char module_name[26-6];
00136     char description[64-26];
00137   }
00138 oasys_header_record_type;
00139 
00140 #define OASYS_VERSION_NUMBER 0
00141 #define OASYS_REV_NUMBER 0
00142 
00143 typedef struct oasys_symbol_record
00144   {
00145     oasys_record_header_type header;
00146     unsigned char relb;
00147     bfd_byte value[4];
00148     bfd_byte refno[2];
00149     char name[64];
00150   }
00151 oasys_symbol_record_type;
00152 
00153 #define RELOCATION_PCREL_BIT 0x80
00154 #define RELOCATION_32BIT_BIT 0x40
00155 #define RELOCATION_TYPE_BITS 0x30
00156 #define RELOCATION_TYPE_ABS 0x00
00157 #define RELOCATION_TYPE_REL 0x10
00158 #define RELOCATION_TYPE_UND 0x20
00159 #define RELOCATION_TYPE_COM 0x30
00160 #define RELOCATION_SECT_BITS 0x0f
00161 
00162 typedef struct oasys_section_record
00163   {
00164     oasys_record_header_type header;
00165     unsigned char relb;
00166     bfd_byte value[4];
00167     bfd_byte vma[4];
00168     bfd_byte fill[3];
00169   }
00170 oasys_section_record_type;
00171 
00172 typedef struct oasys_end_record
00173   {
00174     oasys_record_header_type header;
00175     unsigned char relb;
00176     bfd_byte entry[4];
00177     bfd_byte fill[2];
00178     bfd_byte zero;
00179   }
00180 oasys_end_record_type;
00181 
00182 typedef union oasys_record_union
00183   {
00184     oasys_record_header_type header;
00185     oasys_data_record_type data;
00186     oasys_section_record_type section;
00187     oasys_symbol_record_type symbol;
00188     oasys_header_record_type first;
00189     oasys_end_record_type end;
00190     bfd_byte pad[256];
00191   }
00192 oasys_record_union_type;