]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/i386/ibcs2/coff.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / i386 / ibcs2 / coff.h
1 /*-
2  * Copyright (c) 1994 Sean Eric Fagan
3  * Copyright (c) 1994 Søren Schmidt
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer
11  *    in this position and unchanged.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * $FreeBSD$
30  */
31
32 #ifndef _COFF_H
33 #define _COFF_H
34
35 struct filehdr {
36         unsigned short  f_magic;        /* magic number */
37         unsigned short  f_nscns;        /* # of sections */
38         long            f_timdat;       /* time stamp */
39         long            f_symptr;       /* symbol table offset */
40         long            f_nsyms;        /* # of symbols */
41         unsigned short  f_opthdr;       /* size of system header */
42         unsigned short  f_flags;        /* flags, see below */
43 };
44
45 enum filehdr_flags {
46         F_RELFLG = 0x01,                /* relocs have been stripped */
47         F_EXEC = 0x02,                  /* executable file (or shlib) */
48         F_LNNO = 0x04,                  /* line numbers have been stripped */
49         F_LSYMS = 0x08,                 /* symbols have been stripped */
50         F_SWABD = 0x40,                 /* swabbed byte names */
51         F_AR16WR = 0x80,                /* 16-bit, byte reversed words */
52         F_AR32WR = 0x100                /* 32-bit, byte reversed words */
53 };
54
55 struct aouthdr {
56         short magic;                    /* magic number -- see below */
57         short vstamp;                   /* artifacts from a by-gone day */
58         long tsize;                     /* */
59         long dsize;                     /* */
60         long bsize;                     /* */
61         long entry;                     /* Entry point -- offset into file */
62         long tstart;                    /* artifacts from a by-gone day */
63         long dstart;                    /* */
64 };
65
66 #define I386_COFF       0x14c
67
68 #define COFF_OMAGIC     0407            /* impure format */
69 #define COFF_NMAGIC     0410            /* read-only text */
70 #define COFF_ZMAGIC     0413            /* pagable from disk */
71 #define COFF_SHLIB      0443            /* a shared library */
72
73 struct scnhdr {
74         char            s_name[8];      /* name of section (e.g., ".text") */
75         long            s_paddr;        /* physical addr, used for standalone */
76         long            s_vaddr;        /* virtual address */
77         long            s_size;         /* size of section */
78         long            s_scnptr;       /* file offset of section */
79         long            s_relptr;       /* points to relocs for section */
80         long            s_lnnoptr;      /* points to line numbers for section */
81         unsigned short  s_nreloc;       /* # of relocs */
82         unsigned short  s_nlnno;        /* # of line no's */
83         long            s_flags;        /* section flags -- see below */
84 };
85
86 enum scnhdr_flags {
87         STYP_REG = 0x00,        /* regular (alloc'ed, reloc'ed, loaded) */
88         STYP_DSECT = 0x01,      /* dummy   (reloc'd) */
89         STYP_NOLOAD = 0x02,     /* no-load (reloc'd) */
90         STYP_GROUP = 0x04,      /* grouped */
91         STYP_PAD = 0x08,        /* padding (loaded) */
92         STYP_COPY = 0x10,       /* ??? */
93         STYP_TEXT = 0x20,       /* text */
94         STYP_DATA = 0x40,       /* data */
95         STYP_BSS = 0x80,        /* bss */
96         STYP_INFO = 0x200,      /* comment (!loaded, !alloc'ed, !reloc'd) */
97         STYP_OVER = 0x400,      /* overlay (!allocated, reloc'd, !loaded) */
98         STYP_LIB = 0x800        /* lists shared library files */
99 };
100
101 struct slhdr {
102         long    entry_length;
103         long    path_index;
104         char    *shlib_name;
105 };
106 #endif /* _COFF_H */