OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [nindy-share/] [coff.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*  Copyright 1990, 1992 Free Software Foundation, Inc.
2
 *
3
 *   This code was donated by Intel Corp.
4
 *
5
 * This is a coff version of a.out.h to support 80960 debugging from
6
 * a Unix (possibly BSD) host.  It's used by:
7
 *      o gdb960 to symbols in code generated with Intel (non-GNU) tools.
8
 *      o comm960 to convert a b.out file to a coff file for download.
9
 */
10
 
11
 
12
/********************** FILE HEADER **********************/
13
 
14
struct filehdr {
15
        unsigned short  f_magic;        /* magic number                 */
16
        unsigned short  f_nscns;        /* number of sections           */
17
        long            f_timdat;       /* time & date stamp            */
18
        long            f_symptr;       /* file pointer to symtab       */
19
        long            f_nsyms;        /* number of symtab entries     */
20
        unsigned short  f_opthdr;       /* sizeof(optional hdr)         */
21
        unsigned short  f_flags;        /* flags                        */
22
};
23
 
24
 
25
/* Bits for f_flags:
26
 *      F_RELFLG        relocation info stripped from file
27
 *      F_EXEC          file is executable (no unresolved externel references)
28
 *      F_LNNO          line nunbers stripped from file
29
 *      F_LSYMS         local symbols stripped from file
30
 *      F_AR32WR        file has byte ordering of an AR32WR machine (e.g. vax)
31
 */
32
#define F_RELFLG        0000001
33
#define F_EXEC          0000002
34
#define F_LNNO          0000004
35
#define F_LSYMS 0000010
36
#define F_AR32WR        0000400
37
 
38
 
39
/*
40
 *      Intel 80960 (I960) processor flags.
41
 *      F_I960TYPE == mask for processor type field.
42
 */
43
#define F_I960TYPE              0170000
44
#define F_I960CA                0010000
45
#define F_I960FLOAT             0020000
46
#define F_I960BA                0030000
47
#define F_I960XA                0040000
48
 
49
/*
50
 * i80960 Magic Numbers
51
 */
52
#define I960ROMAGIC     0540    /* read-only text segments      */
53
#define I960RWMAGIC     0541    /* read-write text segments     */
54
 
55
#define I960BADMAG(x) (((x).f_magic!=I960ROMAGIC) && ((x).f_magic!=I960RWMAGIC))
56
 
57
#define FILHDR  struct filehdr
58
#define FILHSZ  sizeof(FILHDR)
59
 
60
 
61
/********************** AOUT "OPTIONAL HEADER" **********************/
62
 
63
typedef struct {
64
        unsigned long   phys_addr;
65
        unsigned long   bitarray;
66
} TAGBITS;
67
 
68
typedef struct aouthdr {
69
        short           magic;  /* type of file                         */
70
        short           vstamp; /* version stamp                        */
71
        unsigned long   tsize;  /* text size in bytes, padded to FW bdry*/
72
        unsigned long   dsize;  /* initialized data "  "                */
73
        unsigned long   bsize;  /* uninitialized data "   "             */
74
#if U3B
75
        unsigned long   dum1;
76
        unsigned long   dum2;   /* pad to entry point   */
77
#endif
78
        unsigned long   entry;  /* entry pt.                            */
79
        unsigned long   text_start;     /* base of text used for this file */
80
        unsigned long   data_start;     /* base of data used for this file */
81
        unsigned long   tagentries;     /* number of tag entries to follow */
82
} AOUTHDR;
83
 
84
/* return a pointer to the tag bits array */
85
 
86
#define TAGPTR(aout) ((TAGBITS *) (&(aout.tagentries)+1))
87
 
88
/* compute size of a header */
89
 
90
#define AOUTSZ(aout) (sizeof(AOUTHDR)+(aout.tagentries*sizeof(TAGBITS)))
91
 
92
/********************** STORAGE CLASSES **********************/
93
 
94
#define C_EFCN          -1      /* physical end of function     */
95
#define C_NULL          0
96
#define C_AUTO          1       /* automatic variable           */
97
#define C_EXT           2       /* external symbol              */
98
#define C_STAT          3       /* static                       */
99
#define C_REG           4       /* register variable            */
100
#define C_EXTDEF        5       /* external definition          */
101
#define C_LABEL         6       /* label                        */
102
#define C_ULABEL        7       /* undefined label              */
103
#define C_MOS           8       /* member of structure          */
104
#define C_ARG           9       /* function argument            */
105
#define C_STRTAG        10      /* structure tag                */
106
#define C_MOU           11      /* member of union              */
107
#define C_UNTAG         12      /* union tag                    */
108
#define C_TPDEF         13      /* type definition              */
109
#define C_USTATIC       14      /* undefined static             */
110
#define C_ENTAG         15      /* enumeration tag              */
111
#define C_MOE           16      /* member of enumeration        */
112
#define C_REGPARM       17      /* register parameter           */
113
#define C_FIELD         18      /* bit field                    */
114
#define C_BLOCK         100     /* ".bb" or ".eb"               */
115
#define C_FCN           101     /* ".bf" or ".ef"               */
116
#define C_EOS           102     /* end of structure             */
117
#define C_FILE          103     /* file name                    */
118
#define C_LINE          104     /* line # reformatted as symbol table entry */
119
#define C_ALIAS         105     /* duplicate tag                */
120
#define C_HIDDEN        106     /* ext symbol in dmert public lib */
121
 
122
        /* New storage classes for 80960 */
123
 
124
#define C_SCALL         107     /* Procedure reachable via system call  */
125
#define C_LEAFPROC      108     /* Leaf procedure, "call" via BAL       */
126
 
127
 
128
/********************** SECTION HEADER **********************/
129
 
130
struct scnhdr {
131
        char            s_name[8];      /* section name                 */
132
        long            s_paddr;        /* physical address, aliased s_nlib */
133
        long            s_vaddr;        /* virtual address              */
134
        long            s_size;         /* section size                 */
135
        long            s_scnptr;       /* file ptr to raw data for section */
136
        long            s_relptr;       /* file ptr to relocation       */
137
        long            s_lnnoptr;      /* file ptr to line numbers     */
138
        unsigned short  s_nreloc;       /* number of relocation entries */
139
        unsigned short  s_nlnno;        /* number of line number entries*/
140
        long            s_flags;        /* flags                        */
141
        unsigned long   s_align;        /* section alignment            */
142
};
143
 
144
/*
145
 * names of "special" sections
146
 */
147
#define _TEXT   ".text"
148
#define _DATA   ".data"
149
#define _BSS    ".bss"
150
 
151
/*
152
 * s_flags "type"
153
 */
154
#define STYP_TEXT       0x20            /* section contains text only   */
155
#define STYP_DATA       0x40            /* section contains data only   */
156
#define STYP_BSS        0x80            /* section contains bss only    */
157
 
158
#define SCNHDR  struct scnhdr
159
#define SCNHSZ  sizeof(SCNHDR)
160
 
161
 
162
/********************** LINE NUMBERS **********************/
163
 
164
/* 1 line number entry for every "breakpointable" source line in a section.
165
 * Line numbers are grouped on a per function basis; first entry in a function
166
 * grouping will have l_lnno = 0 and in place of physical address will be the
167
 * symbol table index of the function name.
168
 */
169
struct lineno{
170
        union {
171
                long l_symndx;  /* function name symbol index, iff l_lnno == 0*/
172
                long l_paddr;   /* (physical) address of line number    */
173
        } l_addr;
174
        unsigned short  l_lnno; /* line number          */
175
        char padding[2];        /* force alignment      */
176
};
177
 
178
#define LINENO  struct lineno
179
#define LINESZ  sizeof(LINENO) 
180
 
181
 
182
/********************** SYMBOLS **********************/
183
 
184
#define SYMNMLEN        8       /* # characters in a symbol name        */
185
#define FILNMLEN        14      /* # characters in a file name          */
186
#define DIMNUM          4       /* # array dimensions in auxiliary entry */
187
 
188
 
189
struct syment {
190
        union {
191
                char    _n_name[SYMNMLEN];      /* old COFF version     */
192
                struct {
193
                        long    _n_zeroes;      /* new == 0             */
194
                        long    _n_offset;      /* offset into string table */
195
                } _n_n;
196
                char    *_n_nptr[2];    /* allows for overlaying        */
197
        } _n;
198
        long            n_value;        /* value of symbol              */
199
        short           n_scnum;        /* section number               */
200
        char            pad1[2];        /* force alignment              */
201
        unsigned long   n_type;         /* type and derived type        */
202
        char            n_sclass;       /* storage class                */
203
        char            n_numaux;       /* number of aux. entries       */
204
        char            pad2[2];        /* force alignment              */
205
};
206
 
207
#define n_name          _n._n_name
208
#define n_zeroes        _n._n_n._n_zeroes
209
#define n_offset        _n._n_n._n_offset
210
 
211
/*
212
 * Relocatable symbols have number of the section in which they are defined,
213
 * or one of the following:
214
 */
215
#define N_UNDEF 0        /* undefined symbol                             */
216
#define N_ABS   -1      /* value of symbol is absolute                  */
217
#define N_DEBUG -2      /* debugging symbol -- symbol value is meaningless */
218
 
219
/*
220
 * Type of a symbol, in low 4 bits of the word
221
 */
222
#define T_NULL          0
223
#define T_VOID          1       /* function argument (only used by compiler) */
224
#define T_CHAR          2       /* character            */
225
#define T_SHORT         3       /* short integer        */
226
#define T_INT           4       /* integer              */
227
#define T_LONG          5       /* long integer         */
228
#define T_FLOAT         6       /* floating point       */
229
#define T_DOUBLE        7       /* double word          */
230
#define T_STRUCT        8       /* structure            */
231
#define T_UNION         9       /* union                */
232
#define T_ENUM          10      /* enumeration          */
233
#define T_MOE           11      /* member of enumeration*/
234
#define T_UCHAR         12      /* unsigned character   */
235
#define T_USHORT        13      /* unsigned short       */
236
#define T_UINT          14      /* unsigned integer     */
237
#define T_ULONG         15      /* unsigned long        */
238
#define T_LNGDBL        16      /* long double          */
239
 
240
 
241
/*
242
 * derived types
243
 */
244
#define DT_PTR          1       /* pointer      */
245
#define DT_FCN          2       /* function     */
246
#define DT_ARY          3       /* array        */
247
 
248
#define N_BTMASK        037
249
#define N_TMASK         0140
250
#define N_BTSHFT        5
251
#define N_TSHIFT        2
252
 
253
#define BTYPE(x)        ((x) & N_BTMASK)
254
 
255
 
256
#define ISPTR(x)        (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
257
#define ISFCN(x)        (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
258
#define ISARY(x)        (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
259
 
260
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
261
 
262
union auxent {
263
        struct {
264
                long x_tagndx;  /* str, un, or enum tag indx */
265
                union {
266
                        struct {
267
                            unsigned short x_lnno; /* declaration line number */
268
                            unsigned short x_size; /* str/union/array size */
269
                        } x_lnsz;
270
                        long x_fsize;   /* size of function */
271
                } x_misc;
272
                union {
273
                        struct {                /* if ISFCN, tag, or .bb */
274
                            long x_lnnoptr;     /* ptr to fcn line # */
275
                            long x_endndx;      /* entry ndx past block end */
276
                        } x_fcn;
277
                        struct {                /* if ISARY, up to 4 dimen. */
278
                            unsigned short x_dimen[DIMNUM];
279
                        } x_ary;
280
                } x_fcnary;
281
                unsigned short x_tvndx;         /* tv index */
282
        } x_sym;
283
 
284
        union {
285
                char x_fname[FILNMLEN];
286
                struct {
287
                        long x_zeroes;
288
                        long x_offset;
289
                } x_n;
290
        } x_file;
291
 
292
        struct {
293
                long x_scnlen;                  /* section length */
294
                unsigned short x_nreloc;        /* # relocation entries */
295
                unsigned short x_nlinno;        /* # line numbers */
296
        } x_scn;
297
 
298
        struct {
299
                long x_stdindx;
300
        } x_sc;
301
 
302
        struct {
303
                unsigned long x_balntry;
304
        } x_bal;
305
 
306
        char a[sizeof(struct syment)];  /* force auxent/syment sizes to match */
307
};
308
 
309
#define SYMENT  struct syment
310
#define SYMESZ  sizeof(SYMENT)  
311
#define AUXENT  union auxent
312
#define AUXESZ  sizeof(AUXENT)
313
 
314
#if VAX || I960
315
#       define _ETEXT   "_etext"
316
#else
317
#       define _ETEXT   "etext"
318
#endif
319
 
320
/********************** RELOCATION DIRECTIVES **********************/
321
 
322
struct reloc {
323
        long r_vaddr;           /* Virtual address of reference */
324
        long r_symndx;          /* Index into symbol table      */
325
        unsigned short r_type;  /* Relocation type              */
326
        char pad[2];            /* Unused                       */
327
};
328
 
329
/* Only values of r_type GNU/960 cares about */
330
#define R_RELLONG       17      /* Direct 32-bit relocation             */
331
#define R_IPRMED        25      /* 24-bit ip-relative relocation        */
332
#define R_OPTCALL       27      /* 32-bit optimizable call (leafproc/sysproc) */
333
 
334
 
335
#define RELOC struct reloc
336
#define RELSZ sizeof(RELOC)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.