]>
Commit | Line | Data |
---|---|---|
a07cc613 JG |
1 | /*** coff information for 80960. Origins: Intel corp, natch. */ |
2 | ||
d6c01d81 | 3 | /* NOTE: Tagentries (cf TAGBITS) are no longer used by the 960 */ |
a07cc613 JG |
4 | |
5 | /********************** FILE HEADER **********************/ | |
6 | ||
a8f3d651 SC |
7 | struct external_filehdr { |
8 | char f_magic[2]; /* magic number */ | |
9 | char f_nscns[2]; /* number of sections */ | |
10 | char f_timdat[4]; /* time & date stamp */ | |
11 | char f_symptr[4]; /* file pointer to symtab */ | |
12 | char f_nsyms[4]; /* number of symtab entries */ | |
13 | char f_opthdr[2]; /* sizeof(optional hdr) */ | |
14 | char f_flags[2]; /* flags */ | |
15 | }; | |
16 | ||
ea017097 SC |
17 | #define OMAGIC (0407) /* old impure format. data immediately |
18 | follows text. both sections are rw. */ | |
19 | #define NMAGIC (0410) /* split i&d, read-only text */ | |
a07cc613 JG |
20 | |
21 | /* | |
a8f3d651 SC |
22 | * Intel 80960 (I960) processor flags. |
23 | * F_I960TYPE == mask for processor type field. | |
24 | */ | |
a07cc613 JG |
25 | |
26 | #define F_I960TYPE (0xf000) | |
27 | #define F_I960CORE (0x1000) | |
28 | #define F_I960KB (0x2000) | |
29 | #define F_I960SB (0x2000) | |
30 | #define F_I960MC (0x3000) | |
31 | #define F_I960XA (0x4000) | |
32 | #define F_I960CA (0x5000) | |
33 | #define F_I960KA (0x6000) | |
34 | #define F_I960SA (0x6000) | |
a8f3d651 SC |
35 | |
36 | ||
a8f3d651 SC |
37 | /** i80960 Magic Numbers |
38 | */ | |
a07cc613 JG |
39 | |
40 | #define I960ROMAGIC (0x160) /* read-only text segments */ | |
41 | #define I960RWMAGIC (0x161) /* read-write text segments */ | |
42 | ||
43 | #define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC)) | |
44 | ||
a8f3d651 SC |
45 | #define FILHDR struct external_filehdr |
46 | #define FILHSZ 20 | |
a07cc613 JG |
47 | |
48 | /********************** AOUT "OPTIONAL HEADER" **********************/ | |
49 | ||
50 | typedef struct { | |
51 | unsigned long phys_addr; | |
52 | unsigned long bitarray; | |
53 | } TAGBITS; | |
54 | ||
55 | ||
a8f3d651 SC |
56 | |
57 | typedef struct | |
58 | { | |
59 | char magic[2]; /* type of file */ | |
60 | char vstamp[2]; /* version stamp */ | |
61 | char tsize[4]; /* text size in bytes, padded to FW bdry*/ | |
62 | char dsize[4]; /* initialized data " " */ | |
63 | char bsize[4]; /* uninitialized data " " */ | |
64 | char entry[4]; /* entry pt. */ | |
65 | char text_start[4]; /* base of text used for this file */ | |
66 | char data_start[4]; /* base of data used for this file */ | |
a8f3d651 | 67 | char tagentries[4]; /* number of tag entries to follow */ |
a8f3d651 SC |
68 | } |
69 | AOUTHDR; | |
a07cc613 JG |
70 | |
71 | /* return a pointer to the tag bits array */ | |
72 | ||
73 | #define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1)) | |
74 | ||
75 | /* compute size of a header */ | |
76 | ||
77 | /*#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))*/ | |
78 | #define AOUTSZ (sizeof(AOUTHDR)) | |
79 | ||
80 | ||
a07cc613 JG |
81 | |
82 | /********************** SECTION HEADER **********************/ | |
83 | ||
a07cc613 | 84 | |
a8f3d651 SC |
85 | struct external_scnhdr { |
86 | char s_name[8]; /* section name */ | |
87 | char s_paddr[4]; /* physical address, aliased s_nlib */ | |
88 | char s_vaddr[4]; /* virtual address */ | |
89 | char s_size[4]; /* section size */ | |
90 | char s_scnptr[4]; /* file ptr to raw data for section */ | |
91 | char s_relptr[4]; /* file ptr to relocation */ | |
92 | char s_lnnoptr[4]; /* file ptr to line numbers */ | |
93 | char s_nreloc[2]; /* number of relocation entries */ | |
94 | char s_nlnno[2]; /* number of line number entries*/ | |
95 | char s_flags[4]; /* flags */ | |
a8f3d651 | 96 | char s_align[4]; /* section alignment */ |
a8f3d651 SC |
97 | }; |
98 | ||
a07cc613 | 99 | |
a8f3d651 | 100 | #define SCNHDR struct external_scnhdr |
a07cc613 JG |
101 | #define SCNHSZ sizeof(SCNHDR) |
102 | ||
bc7d7419 JG |
103 | /* |
104 | * names of "special" sections | |
105 | */ | |
106 | #define _TEXT ".text" | |
107 | #define _DATA ".data" | |
108 | #define _BSS ".bss" | |
a07cc613 JG |
109 | |
110 | /********************** LINE NUMBERS **********************/ | |
111 | ||
112 | /* 1 line number entry for every "breakpointable" source line in a section. | |
113 | * Line numbers are grouped on a per function basis; first entry in a function | |
114 | * grouping will have l_lnno = 0 and in place of physical address will be the | |
115 | * symbol table index of the function name. | |
116 | */ | |
81623791 SC |
117 | struct external_lineno { |
118 | union { | |
119 | char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ | |
120 | char l_paddr[4]; /* (physical) address of line number */ | |
121 | } l_addr; | |
a8f3d651 | 122 | char l_lnno[2]; /* line number */ |
81623791 SC |
123 | char padding[2]; /* force alignment */ |
124 | }; | |
125 | ||
a07cc613 | 126 | |
81623791 SC |
127 | #define LINENO struct external_lineno |
128 | #define LINESZ 8 | |
a07cc613 JG |
129 | |
130 | ||
131 | /********************** SYMBOLS **********************/ | |
132 | ||
054862cf JG |
133 | #define E_SYMNMLEN 8 /* # characters in a symbol name */ |
134 | #define E_FILNMLEN 14 /* # characters in a file name */ | |
135 | #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ | |
a07cc613 | 136 | |
81623791 SC |
137 | struct external_syment |
138 | { | |
139 | union { | |
054862cf | 140 | char e_name[E_SYMNMLEN]; |
81623791 SC |
141 | struct { |
142 | char e_zeroes[4]; | |
143 | char e_offset[4]; | |
144 | } e; | |
145 | } e; | |
146 | char e_value[4]; | |
147 | char e_scnum[2]; | |
148 | char e_flags[2]; | |
149 | char e_type[4]; | |
150 | char e_sclass[1]; | |
151 | char e_numaux[1]; | |
152 | char pad2[2]; | |
153 | }; | |
154 | ||
155 | ||
a07cc613 | 156 | |
a07cc613 JG |
157 | |
158 | #define N_BTMASK (0x1f) | |
159 | #define N_TMASK (0x60) | |
160 | #define N_BTSHFT (5) | |
161 | #define N_TSHIFT (2) | |
162 | ||
81623791 SC |
163 | union external_auxent { |
164 | struct { | |
165 | char x_tagndx[4]; /* str, un, or enum tag indx */ | |
166 | union { | |
167 | struct { | |
168 | char x_lnno[2]; /* declaration line number */ | |
169 | char x_size[2]; /* str/union/array size */ | |
170 | } x_lnsz; | |
171 | char x_fsize[4]; /* size of function */ | |
172 | } x_misc; | |
173 | union { | |
174 | struct { /* if ISFCN, tag, or .bb */ | |
175 | char x_lnnoptr[4]; /* ptr to fcn line # */ | |
176 | char x_endndx[4]; /* entry ndx past block end */ | |
177 | } x_fcn; | |
178 | struct { /* if ISARY, up to 4 dimen. */ | |
054862cf | 179 | char x_dimen[E_DIMNUM][2]; |
81623791 SC |
180 | } x_ary; |
181 | } x_fcnary; | |
182 | char x_tvndx[2]; /* tv index */ | |
183 | } x_sym; | |
184 | ||
185 | union { | |
054862cf | 186 | char x_fname[E_FILNMLEN]; |
81623791 SC |
187 | struct { |
188 | char x_zeroes[4]; | |
189 | char x_offset[4]; | |
190 | } x_n; | |
191 | } x_file; | |
192 | ||
193 | struct { | |
194 | char x_scnlen[4]; /* section length */ | |
195 | char x_nreloc[2]; /* # relocation entries */ | |
196 | char x_nlinno[2]; /* # line numbers */ | |
197 | } x_scn; | |
198 | ||
199 | struct { | |
200 | char x_tvfill[4]; /* tv fill value */ | |
201 | char x_tvlen[2]; /* length of .tv */ | |
202 | char x_tvran[2][2]; /* tv range */ | |
203 | } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ | |
204 | ||
205 | /****************************************** | |
206 | * I960-specific *2nd* aux. entry formats | |
207 | ******************************************/ | |
208 | struct { | |
209 | /* This is a very old typo that keeps getting propagated. */ | |
210 | #define x_stdindx x_stindx | |
211 | char x_stindx[4]; /* sys. table entry */ | |
212 | } x_sc; /* system call entry */ | |
a07cc613 | 213 | |
81623791 SC |
214 | struct { |
215 | char x_balntry[4]; /* BAL entry point */ | |
216 | } x_bal; /* BAL-callable function */ | |
217 | ||
218 | struct { | |
219 | char x_timestamp[4]; /* time stamp */ | |
220 | char x_idstring[20]; /* producer identity string */ | |
221 | } x_ident; /* Producer ident info */ | |
222 | ||
223 | }; | |
224 | ||
a07cc613 | 225 | |
a07cc613 | 226 | |
81623791 | 227 | #define SYMENT struct external_syment |
a8f3d651 | 228 | #define SYMESZ sizeof(SYMENT) /* FIXME - calc by hand */ |
81623791 | 229 | #define AUXENT union external_auxent |
a8f3d651 | 230 | #define AUXESZ sizeof(AUXENT) /* FIXME - calc by hand */ |
a07cc613 | 231 | |
a07cc613 | 232 | # define _ETEXT "_etext" |
a07cc613 JG |
233 | |
234 | /********************** RELOCATION DIRECTIVES **********************/ | |
235 | ||
81623791 SC |
236 | struct external_reloc { |
237 | char r_vaddr[4]; | |
238 | char r_symndx[4]; | |
239 | char r_type[2]; | |
240 | char pad[2]; | |
241 | }; | |
242 | ||
a07cc613 JG |
243 | |
244 | /* Relevent values for r_type and i960. Would someone please document them */ | |
245 | ||
a07cc613 | 246 | |
81623791 SC |
247 | #define RELOC struct external_reloc |
248 | #define RELSZ 12 | |
a07cc613 JG |
249 | |
250 | #define DEFAULT_DATA_SECTION_ALIGNMENT 4 | |
251 | #define DEFAULT_BSS_SECTION_ALIGNMENT 4 | |
252 | #define DEFAULT_TEXT_SECTION_ALIGNMENT 16 | |
253 | /* For new sections we havn't heard of before */ | |
254 | #define DEFAULT_SECTION_ALIGNMENT 4 |