Statistics
| Branch: | Revision:

root / a.out.h @ 8c5e95d8

History | View | Annotate | Download (13.6 kB)

1 0c607d57 bellard
/* a.out.h
2 0c607d57 bellard

3 0c607d57 bellard
   Copyright 1997, 1998, 1999, 2001 Red Hat, Inc.
4 0c607d57 bellard

5 0c607d57 bellard
This file is part of Cygwin.
6 0c607d57 bellard

7 0c607d57 bellard
This software is a copyrighted work licensed under the terms of the
8 0c607d57 bellard
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
9 0c607d57 bellard
details. */
10 0c607d57 bellard
11 0c607d57 bellard
#ifndef _A_OUT_H_
12 0c607d57 bellard
#define _A_OUT_H_
13 0c607d57 bellard
14 0c607d57 bellard
#ifdef __cplusplus
15 0c607d57 bellard
extern "C" {
16 0c607d57 bellard
#endif
17 0c607d57 bellard
#define COFF_IMAGE_WITH_PE
18 0c607d57 bellard
#define COFF_LONG_SECTION_NAMES
19 0c607d57 bellard
20 0c607d57 bellard
/*** coff information for Intel 386/486.  */
21 0c607d57 bellard
22 0c607d57 bellard
23 0c607d57 bellard
/********************** FILE HEADER **********************/
24 0c607d57 bellard
25 0c607d57 bellard
struct external_filehdr {
26 0c607d57 bellard
  short f_magic;        /* magic number                        */
27 0c607d57 bellard
  short f_nscns;        /* number of sections                */
28 7a2d6d96 pbrook
  host_ulong f_timdat;        /* time & date stamp                */
29 7a2d6d96 pbrook
  host_ulong f_symptr;        /* file pointer to symtab        */
30 7a2d6d96 pbrook
  host_ulong f_nsyms;        /* number of symtab entries        */
31 0c607d57 bellard
  short f_opthdr;        /* sizeof(optional hdr)                */
32 0c607d57 bellard
  short f_flags;        /* flags                        */
33 0c607d57 bellard
};
34 0c607d57 bellard
35 0c607d57 bellard
/* Bits for f_flags:
36 0c607d57 bellard
 *        F_RELFLG        relocation info stripped from file
37 0c607d57 bellard
 *        F_EXEC                file is executable (no unresolved external references)
38 0c607d57 bellard
 *        F_LNNO                line numbers stripped from file
39 0c607d57 bellard
 *        F_LSYMS                local symbols stripped from file
40 0c607d57 bellard
 *        F_AR32WR        file has byte ordering of an AR32WR machine (e.g. vax)
41 0c607d57 bellard
 */
42 0c607d57 bellard
43 0c607d57 bellard
#define F_RELFLG        (0x0001)
44 0c607d57 bellard
#define F_EXEC                (0x0002)
45 0c607d57 bellard
#define F_LNNO                (0x0004)
46 0c607d57 bellard
#define F_LSYMS                (0x0008)
47 0c607d57 bellard
48 0c607d57 bellard
49 0c607d57 bellard
50 0c607d57 bellard
#define        I386MAGIC        0x14c
51 0c607d57 bellard
#define I386PTXMAGIC        0x154
52 0c607d57 bellard
#define I386AIXMAGIC        0x175
53 0c607d57 bellard
54 0c607d57 bellard
/* This is Lynx's all-platform magic number for executables. */
55 0c607d57 bellard
56 0c607d57 bellard
#define LYNXCOFFMAGIC        0415
57 0c607d57 bellard
58 0c607d57 bellard
#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \
59 0c607d57 bellard
                       && (x).f_magic != I386AIXMAGIC \
60 0c607d57 bellard
                       && (x).f_magic != I386PTXMAGIC \
61 0c607d57 bellard
                       && (x).f_magic != LYNXCOFFMAGIC)
62 0c607d57 bellard
63 0c607d57 bellard
#define        FILHDR        struct external_filehdr
64 0c607d57 bellard
#define        FILHSZ        20
65 0c607d57 bellard
66 0c607d57 bellard
67 0c607d57 bellard
/********************** AOUT "OPTIONAL HEADER"=
68 0c607d57 bellard
 **********************/
69 0c607d57 bellard
70 0c607d57 bellard
71 0c607d57 bellard
typedef struct
72 0c607d57 bellard
{
73 0c607d57 bellard
  unsigned short magic;                /* type of file                                */
74 0c607d57 bellard
  unsigned short vstamp;        /* version stamp                        */
75 7a2d6d96 pbrook
  host_ulong        tsize;                /* text size in bytes, padded to FW bdry*/
76 7a2d6d96 pbrook
  host_ulong        dsize;                /* initialized data "  "                */
77 7a2d6d96 pbrook
  host_ulong        bsize;                /* uninitialized data "   "                */
78 7a2d6d96 pbrook
  host_ulong        entry;                /* entry pt.                                */
79 7a2d6d96 pbrook
  host_ulong text_start;        /* base of text used for this file */
80 7a2d6d96 pbrook
  host_ulong data_start;        /* base of data used for this file=
81 0c607d57 bellard
 */
82 0c607d57 bellard
}
83 0c607d57 bellard
AOUTHDR;
84 0c607d57 bellard
85 0c607d57 bellard
#define AOUTSZ 28
86 0c607d57 bellard
#define AOUTHDRSZ 28
87 0c607d57 bellard
88 0c607d57 bellard
#define OMAGIC          0404    /* object files, eg as output */
89 0c607d57 bellard
#define ZMAGIC          0413    /* demand load format, eg normal ld output */
90 0c607d57 bellard
#define STMAGIC                0401        /* target shlib */
91 0c607d57 bellard
#define SHMAGIC                0443        /* host   shlib */
92 0c607d57 bellard
93 0c607d57 bellard
94 0c607d57 bellard
/* define some NT default values */
95 0c607d57 bellard
/*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
96 0c607d57 bellard
#define NT_SECTION_ALIGNMENT 0x1000
97 0c607d57 bellard
#define NT_FILE_ALIGNMENT    0x200
98 0c607d57 bellard
#define NT_DEF_RESERVE       0x100000
99 0c607d57 bellard
#define NT_DEF_COMMIT        0x1000
100 0c607d57 bellard
101 0c607d57 bellard
/********************** SECTION HEADER **********************/
102 0c607d57 bellard
103 0c607d57 bellard
104 0c607d57 bellard
struct external_scnhdr {
105 0c607d57 bellard
  char                s_name[8];        /* section name                        */
106 7a2d6d96 pbrook
  host_ulong        s_paddr;        /* physical address, offset
107 0c607d57 bellard
                                   of last addr in scn */
108 7a2d6d96 pbrook
  host_ulong        s_vaddr;        /* virtual address                */
109 7a2d6d96 pbrook
  host_ulong        s_size;                /* section size                        */
110 7a2d6d96 pbrook
  host_ulong        s_scnptr;        /* file ptr to raw data for section */
111 7a2d6d96 pbrook
  host_ulong        s_relptr;        /* file ptr to relocation        */
112 7a2d6d96 pbrook
  host_ulong        s_lnnoptr;        /* file ptr to line numbers        */
113 0c607d57 bellard
  unsigned short s_nreloc;        /* number of relocation entries        */
114 0c607d57 bellard
  unsigned short s_nlnno;        /* number of line number entries*/
115 7a2d6d96 pbrook
  host_ulong        s_flags;        /* flags                        */
116 0c607d57 bellard
};
117 0c607d57 bellard
118 0c607d57 bellard
#define        SCNHDR        struct external_scnhdr
119 0c607d57 bellard
#define        SCNHSZ        40
120 0c607d57 bellard
121 0c607d57 bellard
/*
122 0c607d57 bellard
 * names of "special" sections
123 0c607d57 bellard
 */
124 0c607d57 bellard
#define _TEXT        ".text"
125 0c607d57 bellard
#define _DATA        ".data"
126 0c607d57 bellard
#define _BSS        ".bss"
127 0c607d57 bellard
#define _COMMENT ".comment"
128 0c607d57 bellard
#define _LIB ".lib"
129 0c607d57 bellard
130 0c607d57 bellard
/********************** LINE NUMBERS **********************/
131 0c607d57 bellard
132 0c607d57 bellard
/* 1 line number entry for every "breakpointable" source line in a section.
133 0c607d57 bellard
 * Line numbers are grouped on a per function basis; first entry in a function
134 0c607d57 bellard
 * grouping will have l_lnno = 0 and in place of physical address will be the
135 0c607d57 bellard
 * symbol table index of the function name.
136 0c607d57 bellard
 */
137 0c607d57 bellard
struct external_lineno {
138 0c607d57 bellard
  union {
139 7a2d6d96 pbrook
    host_ulong l_symndx; /* function name symbol index, iff l_lnno 0 */
140 7a2d6d96 pbrook
    host_ulong l_paddr;        /* (physical) address of line number        */
141 0c607d57 bellard
  } l_addr;
142 0c607d57 bellard
  unsigned short l_lnno;        /* line number                */
143 0c607d57 bellard
};
144 0c607d57 bellard
145 0c607d57 bellard
#define        LINENO        struct external_lineno
146 0c607d57 bellard
#define        LINESZ        6
147 0c607d57 bellard
148 0c607d57 bellard
/********************** SYMBOLS **********************/
149 0c607d57 bellard
150 0c607d57 bellard
#define E_SYMNMLEN        8        /* # characters in a symbol name        */
151 0c607d57 bellard
#define E_FILNMLEN        14        /* # characters in a file name                */
152 0c607d57 bellard
#define E_DIMNUM        4        /* # array dimensions in auxiliary entry */
153 0c607d57 bellard
154 de06c511 bellard
struct __attribute__((packed)) external_syment
155 0c607d57 bellard
{
156 0c607d57 bellard
  union {
157 0c607d57 bellard
    char e_name[E_SYMNMLEN];
158 0c607d57 bellard
    struct {
159 7a2d6d96 pbrook
      host_ulong e_zeroes;
160 7a2d6d96 pbrook
      host_ulong e_offset;
161 0c607d57 bellard
    } e;
162 0c607d57 bellard
  } e;
163 7a2d6d96 pbrook
  host_ulong e_value;
164 0c607d57 bellard
  unsigned short e_scnum;
165 0c607d57 bellard
  unsigned short e_type;
166 0c607d57 bellard
  char e_sclass[1];
167 0c607d57 bellard
  char e_numaux[1];
168 0c607d57 bellard
};
169 0c607d57 bellard
170 0c607d57 bellard
#define N_BTMASK        (0xf)
171 0c607d57 bellard
#define N_TMASK                (0x30)
172 0c607d57 bellard
#define N_BTSHFT        (4)
173 0c607d57 bellard
#define N_TSHIFT        (2)
174 0c607d57 bellard
175 0c607d57 bellard
union external_auxent {
176 0c607d57 bellard
  struct {
177 7a2d6d96 pbrook
    host_ulong x_tagndx;        /* str, un, or enum tag indx */
178 0c607d57 bellard
    union {
179 0c607d57 bellard
      struct {
180 0c607d57 bellard
        unsigned short  x_lnno; /* declaration line number */
181 0c607d57 bellard
        unsigned short  x_size; /* str/union/array size */
182 0c607d57 bellard
      } x_lnsz;
183 7a2d6d96 pbrook
      host_ulong x_fsize;        /* size of function */
184 0c607d57 bellard
    } x_misc;
185 0c607d57 bellard
    union {
186 0c607d57 bellard
      struct {                        /* if ISFCN, tag, or .bb */
187 7a2d6d96 pbrook
        host_ulong x_lnnoptr;/* ptr to fcn line # */
188 7a2d6d96 pbrook
        host_ulong x_endndx;        /* entry ndx past block end */
189 0c607d57 bellard
      } x_fcn;
190 0c607d57 bellard
      struct {                        /* if ISARY, up to 4 dimen. */
191 0c607d57 bellard
        char x_dimen[E_DIMNUM][2];
192 0c607d57 bellard
      } x_ary;
193 0c607d57 bellard
    } x_fcnary;
194 0c607d57 bellard
    unsigned short x_tvndx;        /* tv index */
195 0c607d57 bellard
  } x_sym;
196 0c607d57 bellard
197 0c607d57 bellard
  union {
198 0c607d57 bellard
    char x_fname[E_FILNMLEN];
199 0c607d57 bellard
    struct {
200 7a2d6d96 pbrook
      host_ulong x_zeroes;
201 7a2d6d96 pbrook
      host_ulong x_offset;
202 0c607d57 bellard
    } x_n;
203 0c607d57 bellard
  } x_file;
204 0c607d57 bellard
205 0c607d57 bellard
  struct {
206 7a2d6d96 pbrook
    host_ulong x_scnlen;        /* section length */
207 0c607d57 bellard
    unsigned short x_nreloc;        /* # relocation entries */
208 0c607d57 bellard
    unsigned short x_nlinno;        /* # line numbers */
209 7a2d6d96 pbrook
    host_ulong x_checksum;        /* section COMDAT checksum */
210 0c607d57 bellard
    unsigned short x_associated;/* COMDAT associated section index */
211 0c607d57 bellard
    char x_comdat[1];                /* COMDAT selection number */
212 0c607d57 bellard
  } x_scn;
213 0c607d57 bellard
214 0c607d57 bellard
  struct {
215 7a2d6d96 pbrook
    host_ulong x_tvfill;        /* tv fill value */
216 0c607d57 bellard
    unsigned short x_tvlen;        /* length of .tv */
217 0c607d57 bellard
    char x_tvran[2][2];                /* tv range */
218 0c607d57 bellard
  } x_tv;        /* info about .tv section (in auxent of symbol .tv)) */
219 0c607d57 bellard
220 0c607d57 bellard
};
221 0c607d57 bellard
222 0c607d57 bellard
#define        SYMENT        struct external_syment
223 0c607d57 bellard
#define        SYMESZ        18
224 0c607d57 bellard
#define        AUXENT        union external_auxent
225 0c607d57 bellard
#define        AUXESZ        18
226 0c607d57 bellard
227 0c607d57 bellard
#define _ETEXT        "etext"
228 0c607d57 bellard
229 0c607d57 bellard
/********************** RELOCATION DIRECTIVES **********************/
230 0c607d57 bellard
231 0c607d57 bellard
struct external_reloc {
232 0c607d57 bellard
  char r_vaddr[4];
233 0c607d57 bellard
  char r_symndx[4];
234 0c607d57 bellard
  char r_type[2];
235 0c607d57 bellard
};
236 0c607d57 bellard
237 0c607d57 bellard
#define RELOC struct external_reloc
238 0c607d57 bellard
#define RELSZ 10
239 0c607d57 bellard
240 0c607d57 bellard
/* end of coff/i386.h */
241 0c607d57 bellard
242 0c607d57 bellard
/* PE COFF header information */
243 0c607d57 bellard
244 0c607d57 bellard
#ifndef _PE_H
245 0c607d57 bellard
#define _PE_H
246 0c607d57 bellard
247 0c607d57 bellard
/* NT specific file attributes */
248 0c607d57 bellard
#define IMAGE_FILE_RELOCS_STRIPPED           0x0001
249 0c607d57 bellard
#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
250 0c607d57 bellard
#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
251 0c607d57 bellard
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
252 0c607d57 bellard
#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
253 0c607d57 bellard
#define IMAGE_FILE_32BIT_MACHINE             0x0100
254 0c607d57 bellard
#define IMAGE_FILE_DEBUG_STRIPPED            0x0200
255 0c607d57 bellard
#define IMAGE_FILE_SYSTEM                    0x1000
256 0c607d57 bellard
#define IMAGE_FILE_DLL                       0x2000
257 0c607d57 bellard
#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
258 0c607d57 bellard
259 0c607d57 bellard
/* additional flags to be set for section headers to allow the NT loader to
260 0c607d57 bellard
   read and write to the section data (to replace the addresses of data in
261 0c607d57 bellard
   dlls for one thing); also to execute the section in .text's case=
262 0c607d57 bellard
 */
263 0c607d57 bellard
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
264 0c607d57 bellard
#define IMAGE_SCN_MEM_EXECUTE     0x20000000
265 0c607d57 bellard
#define IMAGE_SCN_MEM_READ        0x40000000
266 0c607d57 bellard
#define IMAGE_SCN_MEM_WRITE       0x80000000
267 0c607d57 bellard
268 0c607d57 bellard
/*
269 0c607d57 bellard
 * Section characteristics added for ppc-nt
270 0c607d57 bellard
 */
271 0c607d57 bellard
272 0c607d57 bellard
#define IMAGE_SCN_TYPE_NO_PAD                0x00000008  /* Reserved.  */
273 0c607d57 bellard
274 0c607d57 bellard
#define IMAGE_SCN_CNT_CODE                   0x00000020  /* Section contains code. */
275 0c607d57 bellard
#define IMAGE_SCN_CNT_INITIALIZED_DATA       0x00000040  /* Section contains initialized data. */
276 0c607d57 bellard
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA     0x00000080  /* Section contains uninitialized data. */
277 0c607d57 bellard
278 0c607d57 bellard
#define IMAGE_SCN_LNK_OTHER                  0x00000100  /* Reserved.  */
279 0c607d57 bellard
#define IMAGE_SCN_LNK_INFO                   0x00000200  /* Section contains comments or some other type of information. */
280 0c607d57 bellard
#define IMAGE_SCN_LNK_REMOVE                 0x00000800  /* Section contents will not become part of image. */
281 0c607d57 bellard
#define IMAGE_SCN_LNK_COMDAT                 0x00001000  /* Section contents comdat. */
282 0c607d57 bellard
283 0c607d57 bellard
#define IMAGE_SCN_MEM_FARDATA                0x00008000
284 0c607d57 bellard
285 0c607d57 bellard
#define IMAGE_SCN_MEM_PURGEABLE              0x00020000
286 0c607d57 bellard
#define IMAGE_SCN_MEM_16BIT                  0x00020000
287 0c607d57 bellard
#define IMAGE_SCN_MEM_LOCKED                 0x00040000
288 0c607d57 bellard
#define IMAGE_SCN_MEM_PRELOAD                0x00080000
289 0c607d57 bellard
290 0c607d57 bellard
#define IMAGE_SCN_ALIGN_1BYTES               0x00100000
291 0c607d57 bellard
#define IMAGE_SCN_ALIGN_2BYTES               0x00200000
292 0c607d57 bellard
#define IMAGE_SCN_ALIGN_4BYTES               0x00300000
293 0c607d57 bellard
#define IMAGE_SCN_ALIGN_8BYTES               0x00400000
294 0c607d57 bellard
#define IMAGE_SCN_ALIGN_16BYTES              0x00500000  /* Default alignment if no others are specified. */
295 0c607d57 bellard
#define IMAGE_SCN_ALIGN_32BYTES              0x00600000
296 0c607d57 bellard
#define IMAGE_SCN_ALIGN_64BYTES              0x00700000
297 0c607d57 bellard
298 0c607d57 bellard
299 0c607d57 bellard
#define IMAGE_SCN_LNK_NRELOC_OVFL            0x01000000  /* Section contains extended relocations. */
300 0c607d57 bellard
#define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  /* Section is not cachable.               */
301 0c607d57 bellard
#define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  /* Section is not pageable.               */
302 0c607d57 bellard
#define IMAGE_SCN_MEM_SHARED                 0x10000000  /* Section is shareable.                  */
303 0c607d57 bellard
304 0c607d57 bellard
/* COMDAT selection codes.  */
305 0c607d57 bellard
306 0c607d57 bellard
#define IMAGE_COMDAT_SELECT_NODUPLICATES     (1) /* Warn if duplicates.  */
307 0c607d57 bellard
#define IMAGE_COMDAT_SELECT_ANY                     (2) /* No warning.  */
308 0c607d57 bellard
#define IMAGE_COMDAT_SELECT_SAME_SIZE             (3) /* Warn if different size.  */
309 0c607d57 bellard
#define IMAGE_COMDAT_SELECT_EXACT_MATCH             (4) /* Warn if different.  */
310 0c607d57 bellard
#define IMAGE_COMDAT_SELECT_ASSOCIATIVE             (5) /* Base on other section.  */
311 0c607d57 bellard
312 0c607d57 bellard
/* Magic values that are true for all dos/nt implementations */
313 0c607d57 bellard
#define DOSMAGIC       0x5a4d
314 0c607d57 bellard
#define NT_SIGNATURE   0x00004550
315 0c607d57 bellard
316 0c607d57 bellard
/* NT allows long filenames, we want to accommodate this.  This may break
317 0c607d57 bellard
     some of the bfd functions */
318 0c607d57 bellard
#undef  FILNMLEN
319 0c607d57 bellard
#define FILNMLEN        18        /* # characters in a file name                */
320 0c607d57 bellard
321 0c607d57 bellard
322 0c607d57 bellard
#ifdef COFF_IMAGE_WITH_PE
323 0c607d57 bellard
/* The filehdr is only weired in images */
324 0c607d57 bellard
325 0c607d57 bellard
#undef FILHDR
326 0c607d57 bellard
struct external_PE_filehdr
327 0c607d57 bellard
{
328 0c607d57 bellard
  /* DOS header fields */
329 0c607d57 bellard
  unsigned short e_magic;        /* Magic number, 0x5a4d */
330 0c607d57 bellard
  unsigned short e_cblp;        /* Bytes on last page of file, 0x90 */
331 0c607d57 bellard
  unsigned short e_cp;                /* Pages in file, 0x3 */
332 0c607d57 bellard
  unsigned short e_crlc;        /* Relocations, 0x0 */
333 0c607d57 bellard
  unsigned short e_cparhdr;        /* Size of header in paragraphs, 0x4 */
334 0c607d57 bellard
  unsigned short e_minalloc;        /* Minimum extra paragraphs needed, 0x0 */
335 0c607d57 bellard
  unsigned short e_maxalloc;        /* Maximum extra paragraphs needed, 0xFFFF */
336 0c607d57 bellard
  unsigned short e_ss;                /* Initial (relative) SS value, 0x0 */
337 0c607d57 bellard
  unsigned short e_sp;                /* Initial SP value, 0xb8 */
338 0c607d57 bellard
  unsigned short e_csum;        /* Checksum, 0x0 */
339 0c607d57 bellard
  unsigned short e_ip;                /* Initial IP value, 0x0 */
340 0c607d57 bellard
  unsigned short e_cs;                /* Initial (relative) CS value, 0x0 */
341 0c607d57 bellard
  unsigned short e_lfarlc;        /* File address of relocation table, 0x40 */
342 0c607d57 bellard
  unsigned short e_ovno;        /* Overlay number, 0x0 */
343 0c607d57 bellard
  char e_res[4][2];                /* Reserved words, all 0x0 */
344 0c607d57 bellard
  unsigned short e_oemid;        /* OEM identifier (for e_oeminfo), 0x0 */
345 0c607d57 bellard
  unsigned short e_oeminfo;        /* OEM information; e_oemid specific, 0x0 */
346 0c607d57 bellard
  char e_res2[10][2];                /* Reserved words, all 0x0 */
347 7a2d6d96 pbrook
  host_ulong e_lfanew;        /* File address of new exe header, 0x80 */
348 0c607d57 bellard
  char dos_message[16][4];        /* other stuff, always follow DOS header */
349 0c607d57 bellard
  unsigned int nt_signature;        /* required NT signature, 0x4550 */
350 0c607d57 bellard
351 0c607d57 bellard
  /* From standard header */
352 0c607d57 bellard
353 0c607d57 bellard
  unsigned short f_magic;        /* magic number                        */
354 0c607d57 bellard
  unsigned short f_nscns;        /* number of sections                */
355 7a2d6d96 pbrook
  host_ulong f_timdat;        /* time & date stamp                */
356 7a2d6d96 pbrook
  host_ulong f_symptr;        /* file pointer to symtab        */
357 7a2d6d96 pbrook
  host_ulong f_nsyms;        /* number of symtab entries        */
358 0c607d57 bellard
  unsigned short f_opthdr;        /* sizeof(optional hdr)                */
359 0c607d57 bellard
  unsigned short f_flags;        /* flags                        */
360 0c607d57 bellard
};
361 0c607d57 bellard
362 0c607d57 bellard
363 0c607d57 bellard
#define FILHDR struct external_PE_filehdr
364 0c607d57 bellard
#undef FILHSZ
365 0c607d57 bellard
#define FILHSZ 152
366 0c607d57 bellard
367 0c607d57 bellard
#endif
368 0c607d57 bellard
369 0c607d57 bellard
typedef struct
370 0c607d57 bellard
{
371 0c607d57 bellard
  unsigned short magic;                /* type of file                                */
372 0c607d57 bellard
  unsigned short vstamp;        /* version stamp                        */
373 7a2d6d96 pbrook
  host_ulong        tsize;                /* text size in bytes, padded to FW bdry*/
374 7a2d6d96 pbrook
  host_ulong        dsize;                /* initialized data "  "                */
375 7a2d6d96 pbrook
  host_ulong        bsize;                /* uninitialized data "   "                */
376 7a2d6d96 pbrook
  host_ulong        entry;                /* entry pt.                                */
377 7a2d6d96 pbrook
  host_ulong text_start;        /* base of text used for this file */
378 7a2d6d96 pbrook
  host_ulong data_start;        /* base of all data used for this file */
379 0c607d57 bellard
380 0c607d57 bellard
  /* NT extra fields; see internal.h for descriptions */
381 7a2d6d96 pbrook
  host_ulong  ImageBase;
382 7a2d6d96 pbrook
  host_ulong  SectionAlignment;
383 7a2d6d96 pbrook
  host_ulong  FileAlignment;
384 0c607d57 bellard
  unsigned short  MajorOperatingSystemVersion;
385 0c607d57 bellard
  unsigned short  MinorOperatingSystemVersion;
386 0c607d57 bellard
  unsigned short  MajorImageVersion;
387 0c607d57 bellard
  unsigned short  MinorImageVersion;
388 0c607d57 bellard
  unsigned short  MajorSubsystemVersion;
389 0c607d57 bellard
  unsigned short  MinorSubsystemVersion;
390 0c607d57 bellard
  char  Reserved1[4];
391 7a2d6d96 pbrook
  host_ulong  SizeOfImage;
392 7a2d6d96 pbrook
  host_ulong  SizeOfHeaders;
393 7a2d6d96 pbrook
  host_ulong  CheckSum;
394 0c607d57 bellard
  unsigned short Subsystem;
395 0c607d57 bellard
  unsigned short DllCharacteristics;
396 7a2d6d96 pbrook
  host_ulong  SizeOfStackReserve;
397 7a2d6d96 pbrook
  host_ulong  SizeOfStackCommit;
398 7a2d6d96 pbrook
  host_ulong  SizeOfHeapReserve;
399 7a2d6d96 pbrook
  host_ulong  SizeOfHeapCommit;
400 7a2d6d96 pbrook
  host_ulong  LoaderFlags;
401 7a2d6d96 pbrook
  host_ulong  NumberOfRvaAndSizes;
402 0c607d57 bellard
  /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
403 0c607d57 bellard
  char  DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
404 0c607d57 bellard
405 0c607d57 bellard
} PEAOUTHDR;
406 0c607d57 bellard
407 0c607d57 bellard
408 0c607d57 bellard
#undef AOUTSZ
409 0c607d57 bellard
#define AOUTSZ (AOUTHDRSZ + 196)
410 0c607d57 bellard
411 0c607d57 bellard
#undef  E_FILNMLEN
412 0c607d57 bellard
#define E_FILNMLEN        18        /* # characters in a file name                */
413 0c607d57 bellard
#endif
414 0c607d57 bellard
415 0c607d57 bellard
/* end of coff/pe.h */
416 0c607d57 bellard
417 0c607d57 bellard
#define DT_NON                (0)        /* no derived type */
418 0c607d57 bellard
#define DT_PTR                (1)        /* pointer */
419 0c607d57 bellard
#define DT_FCN                (2)        /* function */
420 0c607d57 bellard
#define DT_ARY                (3)        /* array */
421 0c607d57 bellard
422 0c607d57 bellard
#define ISPTR(x)        (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
423 0c607d57 bellard
#define ISFCN(x)        (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
424 0c607d57 bellard
#define ISARY(x)        (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
425 0c607d57 bellard
426 0c607d57 bellard
#ifdef __cplusplus
427 0c607d57 bellard
}
428 0c607d57 bellard
#endif
429 0c607d57 bellard
430 0c607d57 bellard
#endif /* _A_OUT_H_ */