Minimal changes to get m6502 to compile (won't work)
[Apout.git] / aout.h
1 /* aout.h - parse and load the contents of a UNIX a.out file, for
2  * several flavours of PDP-11 UNIX
3  *
4  * $Revision: 1.5 $
5  * $Date: 2008/05/19 13:42:39 $
6  */
7 #include <unistd.h>
8 #define EIGHT_K          8192
9
10 /* UNIX magic numbers for the a.out header */
11 #define V1_NORMAL       0405    /* normal: 1st Edition, six words long */
12 #define ANY_NORMAL      0407    /* normal: V5,V6,V7,2.11BSD */
13 #define ANY_ROTEXT      0410    /* read-only text: V5,V6,V7,2.11BSD */
14 #define ANY_SPLITID     0411    /* seperated I&D: V5,V6,V7,2.11BSD */
15 #define BSD_OVERLAY     0430    /* 2.11BSD overlay, non-separate */
16 #define BSD_ROVERLAY    0431    /* 2.11BSD overlay, separate */
17 #define ANY_SCRIPT      020443  /* Shell script, i.e #! */
18 #define A68_MAGIC       0       /* Algol68 binaries have these magic nums */
19 #define A68_DATA        0107116 /* Algol68 binaries have these magic nums */
20 #define V1_RAW          0104421 /* V1 'raw' binary: rm, ln, chmod from s2
21                                    archive. */
22
23 #define UNKNOWN_AOUT   034567   /* An unknown a.out header */
24
25 /* a.out header for nearly all UNIX flavours */
26 struct exec {
27     u_int16_t a_magic;          /* magic number */
28     u_int16_t a_text;           /* size of text segment */
29     u_int16_t a_data;           /* size of initialised data */
30     u_int16_t a_bss;            /* size of initialised bss */
31     u_int16_t a_syms;           /* size of symbol table */
32     u_int16_t a_entry;          /* entry point */
33     u_int16_t a_unused;         /* unused */
34     u_int16_t a_flag;           /* relocation info stripped */
35     /* 16 bytes up to here */
36
37     /* 2.11BSD overlay files have the following */
38 #define NOVL    15
39     int16_t max_ovl;            /* maximum overlay size */
40     u_int16_t ov_siz[NOVL];     /* size of the i'th overlay */
41     /* Note that if the file isn't a 2.11BSD */
42     /* overlay, we have to rewind to undo */
43     /* the read of this section */
44 };
45
46 /* Because V5, V6, V7 and 2.11BSD share several magic numbers
47  * in their a.out headers, we must distinguish them so as to
48  * set up the correct emulated environment. This is done by
49  * observing the differences in their crt0.s code: they all
50  * differ at position 021
51  */
52 #define a_magic2        ov_siz[0]
53 #define V2_M2           0177304 /* Doesn't apply to all, tho */
54 #define V6_M2           0010600
55 #define V7_M2           0016600
56 #define BSD_M2          0162706