i960.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. /* coff information for 80960. Origins: Intel corp, natch.
  2. Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  14. MA 02110-1301, USA. */
  15. /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */
  16. /********************** FILE HEADER **********************/
  17. struct external_filehdr
  18. {
  19. char f_magic[2]; /* magic number */
  20. char f_nscns[2]; /* number of sections */
  21. char f_timdat[4]; /* time & date stamp */
  22. char f_symptr[4]; /* file pointer to symtab */
  23. char f_nsyms[4]; /* number of symtab entries */
  24. char f_opthdr[2]; /* sizeof(optional hdr) */
  25. char f_flags[2]; /* flags */
  26. };
  27. #define OMAGIC (0407) /* old impure format. data immediately
  28. follows text. both sections are rw. */
  29. #define NMAGIC (0410) /* split i&d, read-only text */
  30. /*
  31. * Intel 80960 (I960) processor flags.
  32. * F_I960TYPE == mask for processor type field.
  33. */
  34. #define F_I960TYPE (0xf000)
  35. #define F_I960CORE (0x1000)
  36. #define F_I960KB (0x2000)
  37. #define F_I960SB (0x2000)
  38. #define F_I960MC (0x3000)
  39. #define F_I960XA (0x4000)
  40. #define F_I960CA (0x5000)
  41. #define F_I960KA (0x6000)
  42. #define F_I960SA (0x6000)
  43. #define F_I960JX (0x7000)
  44. #define F_I960HX (0x8000)
  45. /** i80960 Magic Numbers
  46. */
  47. #define I960ROMAGIC (0x160) /* read-only text segments */
  48. #define I960RWMAGIC (0x161) /* read-write text segments */
  49. #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
  50. #define FILHDR struct external_filehdr
  51. #define FILHSZ 20
  52. /********************** AOUT "OPTIONAL HEADER" **********************/
  53. typedef struct
  54. {
  55. unsigned long phys_addr;
  56. unsigned long bitarray;
  57. } TAGBITS;
  58. typedef struct
  59. {
  60. char magic[2]; /* type of file */
  61. char vstamp[2]; /* version stamp */
  62. char tsize[4]; /* text size in bytes, padded to FW bdry*/
  63. char dsize[4]; /* initialized data " " */
  64. char bsize[4]; /* uninitialized data " " */
  65. char entry[4]; /* entry pt. */
  66. char text_start[4]; /* base of text used for this file */
  67. char data_start[4]; /* base of data used for this file */
  68. char tagentries[4]; /* number of tag entries to follow */
  69. }
  70. AOUTHDR;
  71. /* return a pointer to the tag bits array */
  72. #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
  73. /* compute size of a header */
  74. /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/
  75. #define AOUTSZ 32
  76. #define AOUTHDRSZ 32
  77. /********************** SECTION HEADER **********************/
  78. struct external_scnhdr
  79. {
  80. char s_name[8]; /* section name */
  81. char s_paddr[4]; /* physical address, aliased s_nlib */
  82. char s_vaddr[4]; /* virtual address */
  83. char s_size[4]; /* section size */
  84. char s_scnptr[4]; /* file ptr to raw data for section */
  85. char s_relptr[4]; /* file ptr to relocation */
  86. char s_lnnoptr[4]; /* file ptr to line numbers */
  87. char s_nreloc[2]; /* number of relocation entries */
  88. char s_nlnno[2]; /* number of line number entries*/
  89. char s_flags[4]; /* flags */
  90. char s_align[4]; /* section alignment */
  91. };
  92. #define SCNHDR struct external_scnhdr
  93. #define SCNHSZ 44
  94. /*
  95. * names of "special" sections
  96. */
  97. #define _TEXT ".text"
  98. #define _DATA ".data"
  99. #define _BSS ".bss"
  100. /********************** LINE NUMBERS **********************/
  101. /* 1 line number entry for every "breakpointable" source line in a section.
  102. * Line numbers are grouped on a per function basis; first entry in a function
  103. * grouping will have l_lnno = 0 and in place of physical address will be the
  104. * symbol table index of the function name.
  105. */
  106. struct external_lineno
  107. {
  108. union
  109. {
  110. char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
  111. char l_paddr[4]; /* (physical) address of line number */
  112. } l_addr;
  113. char l_lnno[2]; /* line number */
  114. char padding[2]; /* force alignment */
  115. };
  116. #define LINENO struct external_lineno
  117. #define LINESZ 8
  118. /********************** SYMBOLS **********************/
  119. #define E_SYMNMLEN 8 /* # characters in a symbol name */
  120. #define E_FILNMLEN 14 /* # characters in a file name */
  121. #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
  122. struct external_syment
  123. {
  124. union
  125. {
  126. char e_name[E_SYMNMLEN];
  127. struct
  128. {
  129. char e_zeroes[4];
  130. char e_offset[4];
  131. } e;
  132. } e;
  133. char e_value[4];
  134. char e_scnum[2];
  135. char e_flags[2];
  136. char e_type[4];
  137. char e_sclass[1];
  138. char e_numaux[1];
  139. char pad2[2];
  140. };
  141. #define N_BTMASK (0x1f)
  142. #define N_TMASK (0x60)
  143. #define N_BTSHFT (5)
  144. #define N_TSHIFT (2)
  145. union external_auxent
  146. {
  147. struct
  148. {
  149. char x_tagndx[4]; /* str, un, or enum tag indx */
  150. union
  151. {
  152. struct
  153. {
  154. char x_lnno[2]; /* declaration line number */
  155. char x_size[2]; /* str/union/array size */
  156. } x_lnsz;
  157. char x_fsize[4]; /* size of function */
  158. } x_misc;
  159. union
  160. {
  161. struct /* if ISFCN, tag, or .bb */
  162. {
  163. char x_lnnoptr[4]; /* ptr to fcn line # */
  164. char x_endndx[4]; /* entry ndx past block end */
  165. } x_fcn;
  166. struct /* if ISARY, up to 4 dimen. */
  167. {
  168. char x_dimen[E_DIMNUM][2];
  169. } x_ary;
  170. } x_fcnary;
  171. char x_tvndx[2]; /* tv index */
  172. } x_sym;
  173. union
  174. {
  175. char x_fname[E_FILNMLEN];
  176. struct
  177. {
  178. char x_zeroes[4];
  179. char x_offset[4];
  180. } x_n;
  181. } x_file;
  182. struct
  183. {
  184. char x_scnlen[4]; /* section length */
  185. char x_nreloc[2]; /* # relocation entries */
  186. char x_nlinno[2]; /* # line numbers */
  187. } x_scn;
  188. struct
  189. {
  190. char x_tvfill[4]; /* tv fill value */
  191. char x_tvlen[2]; /* length of .tv */
  192. char x_tvran[2][2]; /* tv range */
  193. } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
  194. /******************************************
  195. * I960-specific *2nd* aux. entry formats
  196. ******************************************/
  197. struct
  198. {
  199. /* This is a very old typo that keeps getting propagated. */
  200. #define x_stdindx x_stindx
  201. char x_stindx[4]; /* sys. table entry */
  202. } x_sc; /* system call entry */
  203. struct
  204. {
  205. char x_balntry[4]; /* BAL entry point */
  206. } x_bal; /* BAL-callable function */
  207. struct
  208. {
  209. char x_timestamp[4]; /* time stamp */
  210. char x_idstring[20]; /* producer identity string */
  211. } x_ident; /* Producer ident info */
  212. };
  213. #define SYMENT struct external_syment
  214. #define SYMESZ 24
  215. #define AUXENT union external_auxent
  216. #define AUXESZ 24
  217. # define _ETEXT "_etext"
  218. /********************** RELOCATION DIRECTIVES **********************/
  219. struct external_reloc
  220. {
  221. char r_vaddr[4];
  222. char r_symndx[4];
  223. char r_type[2];
  224. char pad[2];
  225. };
  226. /* r_type values for the i960. */
  227. /* The i960 uses R_RELLONG, which is defined in internal.h as 0x11.
  228. It is an absolute 32 bit relocation. */
  229. #define R_IPRMED (0x19) /* 24-bit ip-relative relocation */
  230. #define R_OPTCALL (0x1b) /* 32-bit optimizable call (leafproc/sysproc) */
  231. #define R_OPTCALLX (0x1c) /* 64-bit optimizable call (leafproc/sysproc) */
  232. /* The following relocation types are defined use by relaxing linkers,
  233. which convert 32 bit calls (which require a 64 bit instruction)
  234. into 24 bit calls (which require a 32 bit instruction) when
  235. possible. It will be possible whenever the target of the call is
  236. within a 24 bit range of the call instruction.
  237. It is always safe to ignore these relocations. They only serve to
  238. mark points which the relaxing linker will have to consider. The
  239. assembler must ensure that the correct code is generated even if
  240. the relocations are ignored. In particular, this means that the
  241. R_IPR13 relocation may not appear with an external symbol. */
  242. #define R_IPR13 (0x1d) /* 13 bit ip-relative branch */
  243. #define R_ALIGN (0x1e) /* alignment marker. This has no
  244. associated symbol. Instead, the
  245. r_symndx field indicates the
  246. require alignment at this point in
  247. the file. It must be a power of 2. */
  248. #define RELOC struct external_reloc
  249. #define RELSZ 12