Back to index

cell-binutils  2.17cvs20070401
i960.h
Go to the documentation of this file.
00001 /* coff information for 80960.  Origins: Intel corp, natch.
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 of the License, or
00008    (at your option) 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, Boston, MA 02110-1301, USA.  */
00018 
00019 /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */
00020 
00021 /********************** FILE HEADER **********************/
00022 
00023 struct external_filehdr
00024 {
00025   char f_magic[2];   /* magic number                    */
00026   char f_nscns[2];   /* number of sections              */
00027   char f_timdat[4];  /* time & date stamp        */
00028   char f_symptr[4];  /* file pointer to symtab   */
00029   char f_nsyms[4];   /* number of symtab entries */
00030   char f_opthdr[2];  /* sizeof(optional hdr)            */
00031   char f_flags[2];   /* flags                    */
00032 };
00033 
00034 #define OMAGIC      (0407)  /* old impure format. data immediately
00035                                    follows text. both sections are rw. */
00036 #define NMAGIC      (0410)  /* split i&d, read-only text */
00037 
00038 /*
00039 *      Intel 80960 (I960) processor flags.
00040 *      F_I960TYPE == mask for processor type field. 
00041 */
00042 
00043 #define       F_I960TYPE    (0xf000)
00044 #define       F_I960CORE    (0x1000)
00045 #define       F_I960KB      (0x2000)
00046 #define       F_I960SB      (0x2000)
00047 #define       F_I960MC      (0x3000)
00048 #define       F_I960XA      (0x4000)
00049 #define       F_I960CA      (0x5000)
00050 #define       F_I960KA      (0x6000)
00051 #define       F_I960SA      (0x6000)
00052 #define F_I960JX     (0x7000)
00053 #define F_I960HX     (0x8000)
00054 
00055 
00059 #define I960ROMAGIC  (0x160)       /* read-only text segments */
00060 #define I960RWMAGIC  (0x161)       /* read-write text segments */
00061 
00062 #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
00063 
00064 #define       FILHDR struct external_filehdr
00065 #define       FILHSZ 20
00066 
00067 /********************** AOUT "OPTIONAL HEADER" **********************/
00068 
00069 typedef struct
00070 {
00071   unsigned long      phys_addr;
00072   unsigned long      bitarray;
00073 } TAGBITS;
00074 
00075 typedef struct 
00076 {
00077   char        magic[2];            /* type of file                           */
00078   char vstamp[2];           /* version stamp                   */
00079   char tsize[4];            /* text size in bytes, padded to FW bdry*/
00080   char dsize[4];            /* initialized data "  "           */
00081   char bsize[4];            /* uninitialized data "   "        */
00082   char entry[4];            /* entry pt.                       */
00083   char        text_start[4];              /* base of text used for this file */
00084   char        data_start[4];              /* base of data used for this file */
00085   char tagentries[4];              /* number of tag entries to follow */
00086 }
00087 AOUTHDR;
00088 
00089 /* return a pointer to the tag bits array */
00090 
00091 #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
00092 
00093 /* compute size of a header */
00094 
00095 /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
00096 #define AOUTSZ 32
00097 #define AOUTHDRSZ 32
00098 
00099 
00100 /********************** SECTION HEADER **********************/
00101 
00102 struct external_scnhdr
00103 {
00104   char        s_name[8];    /* section name                    */
00105   char        s_paddr[4];   /* physical address, aliased s_nlib */
00106   char        s_vaddr[4];   /* virtual address          */
00107   char        s_size[4];    /* section size                    */
00108   char        s_scnptr[4];  /* file ptr to raw data for section */
00109   char        s_relptr[4];  /* file ptr to relocation   */
00110   char        s_lnnoptr[4]; /* file ptr to line numbers */
00111   char        s_nreloc[2];  /* number of relocation entries    */
00112   char        s_nlnno[2];   /* number of line number entries*/
00113   char        s_flags[4];   /* flags                    */
00114   char               s_align[4];   /* section alignment        */
00115 };
00116 
00117 
00118 #define       SCNHDR struct external_scnhdr
00119 #define       SCNHSZ 44
00120 
00121 /*
00122  * names of "special" sections
00123  */
00124 #define _TEXT   ".text"
00125 #define _DATA   ".data"
00126 #define _BSS    ".bss"
00127 
00128 /********************** LINE NUMBERS **********************/
00129 
00130 /* 1 line number entry for every "breakpointable" source line in a section.
00131  * Line numbers are grouped on a per function basis; first entry in a function
00132  * grouping will have l_lnno = 0 and in place of physical address will be the
00133  * symbol table index of the function name.
00134  */
00135 struct external_lineno
00136 {
00137   union
00138   {
00139     char l_symndx[4];       /* function name symbol index, iff l_lnno == 0*/
00140     char l_paddr[4]; /* (physical) address of line number      */
00141   } l_addr;
00142 
00143   char l_lnno[2];           /* line number              */
00144   char padding[2];   /* force alignment   */
00145 };
00146 
00147 
00148 #define       LINENO struct external_lineno
00149 #define       LINESZ 8
00150 
00151 /********************** SYMBOLS **********************/
00152 
00153 #define E_SYMNMLEN   8      /* # characters in a symbol name   */
00154 #define E_FILNMLEN   14     /* # characters in a file name            */
00155 #define E_DIMNUM     4      /* # array dimensions in auxiliary entry */
00156 
00157 struct external_syment 
00158 {
00159   union
00160   {
00161     char e_name[E_SYMNMLEN];
00162 
00163     struct
00164     {
00165       char e_zeroes[4];
00166       char e_offset[4];
00167     } e;
00168   } e;
00169 
00170   char e_value[4];
00171   char e_scnum[2];
00172   char e_flags[2];
00173   char e_type[4];
00174   char e_sclass[1];
00175   char e_numaux[1];
00176   char pad2[2];
00177 };
00178 
00179 #define N_BTMASK     (0x1f)
00180 #define N_TMASK             (0x60)
00181 #define N_BTSHFT     (5)
00182 #define N_TSHIFT     (2)
00183   
00184 union external_auxent
00185 {
00186   struct
00187   {
00188     char x_tagndx[4];       /* str, un, or enum tag indx */
00189 
00190     union
00191     {
00192       struct
00193       {
00194        char  x_lnno[2]; /* declaration line number */
00195        char  x_size[2]; /* str/union/array size */
00196       } x_lnsz;
00197 
00198       char x_fsize[4];      /* size of function */
00199 
00200     } x_misc;
00201 
00202     union
00203     {
00204       struct         /* if ISFCN, tag, or .bb */
00205       {
00206        char x_lnnoptr[4];   /* ptr to fcn line # */
00207        char x_endndx[4];    /* entry ndx past block end */
00208       } x_fcn;
00209 
00210       struct         /* if ISARY, up to 4 dimen. */
00211       {
00212        char x_dimen[E_DIMNUM][2];
00213       } x_ary;
00214 
00215     } x_fcnary;
00216 
00217     char x_tvndx[2];        /* tv index */
00218 
00219   } x_sym;
00220 
00221   union
00222   {
00223     char x_fname[E_FILNMLEN];
00224 
00225     struct
00226     {
00227       char x_zeroes[4];
00228       char x_offset[4];
00229     } x_n;
00230 
00231   } x_file;
00232 
00233   struct
00234   {
00235     char x_scnlen[4];                     /* section length */
00236     char x_nreloc[2];       /* # relocation entries */
00237     char x_nlinno[2];       /* # line numbers */
00238 
00239   } x_scn;
00240 
00241   struct
00242   {
00243     char x_tvfill[4];       /* tv fill value */
00244     char x_tvlen[2]; /* length of .tv */
00245     char x_tvran[2][2];     /* tv range */
00246 
00247   } x_tv;            /* info about .tv section (in auxent of symbol .tv)) */
00248 
00249   /******************************************
00250    *  I960-specific *2nd* aux. entry formats
00251    ******************************************/
00252   struct
00253   {
00254     /* This is a very old typo that keeps getting propagated. */
00255 #define x_stdindx x_stindx
00256     char x_stindx[4];       /* sys. table entry */
00257   } x_sc;     /* system call entry */
00258 
00259   struct
00260   {
00261     char x_balntry[4]; /* BAL entry point */
00262   } x_bal; /* BAL-callable function */
00263 
00264   struct
00265   {
00266     char x_timestamp[4];            /* time stamp */
00267     char      x_idstring[20];              /* producer identity string */
00268 
00269   } x_ident;                          /* Producer ident info */
00270 };
00271 
00272 #define       SYMENT struct external_syment
00273 #define       SYMESZ 24
00274 #define       AUXENT union external_auxent
00275 #define       AUXESZ 24
00276 
00277 #      define _ETEXT "_etext"
00278 
00279 /********************** RELOCATION DIRECTIVES **********************/
00280 
00281 struct external_reloc
00282 {
00283   char r_vaddr[4];
00284   char r_symndx[4];
00285   char r_type[2];
00286   char pad[2];
00287 };
00288 
00289 /* r_type values for the i960.  */
00290 
00291 /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11.
00292    It is an absolute 32 bit relocation.  */
00293 
00294 #define R_IPRMED     (0x19) /* 24-bit ip-relative relocation */
00295 #define R_OPTCALL    (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
00296 #define R_OPTCALLX   (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
00297 
00298 /* The following relocation types are defined use by relaxing linkers,
00299    which convert 32 bit calls (which require a 64 bit instruction)
00300    into 24 bit calls (which require a 32 bit instruction) when
00301    possible.  It will be possible whenever the target of the call is
00302    within a 24 bit range of the call instruction.
00303 
00304    It is always safe to ignore these relocations.  They only serve to
00305    mark points which the relaxing linker will have to consider.  The
00306    assembler must ensure that the correct code is generated even if
00307    the relocations are ignored.  In particular, this means that the
00308    R_IPR13 relocation may not appear with an external symbol.  */
00309 
00310 #define R_IPR13             (0x1d) /* 13 bit ip-relative branch */
00311 #define R_ALIGN             (0x1e)  /* alignment marker.  This has no
00312                                associated symbol.  Instead, the
00313                                r_symndx field indicates the
00314                                require alignment at this point in
00315                                the file.  It must be a power of 2.  */
00316 
00317 #define RELOC struct external_reloc
00318 #define RELSZ 12
00319