gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exec_ecoff.h
Go to the documentation of this file.
1 /*
2  * Taken from NetBSD sys/exec_ecoff.h
3  */
4 
5 /* $NetBSD: exec_ecoff.h,v 1.13 2003/01/18 09:53:18 thorpej Exp $ */
6 
7 /*
8  * Copyright (c) 1994 Adam Glass
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  * must display the following acknowledgement:
21  * This product includes software developed by Adam Glass.
22  * 4. The name of the author may not be used to endorse or promote products
23  * derived from this software without specific prior written permission
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 #ifndef _SYS_EXEC_ECOFF_H_
38 #define _SYS_EXEC_ECOFF_H_
39 
40 struct ecoff_filehdr {
41  coff_ushort f_magic; /* magic number */
42  coff_ushort f_nscns; /* # of sections */
43  coff_uint f_timdat; /* time and date stamp */
44  coff_ulong f_symptr; /* file offset of symbol table */
45  coff_uint f_nsyms; /* # of symbol table entries */
46  coff_ushort f_opthdr; /* sizeof the optional header */
47  coff_ushort f_flags; /* flags??? */
48 };
49 
50 struct ecoff_aouthdr {
53  ECOFF_PAD
62 };
63 
64 struct ecoff_scnhdr { /* needed for size info */
65  char s_name[8]; /* name */
66  coff_ulong s_paddr; /* physical addr? for ROMing?*/
67  coff_ulong s_vaddr; /* virtual addr? */
68  coff_ulong s_size; /* size */
69  coff_ulong s_scnptr; /* file offset of raw data */
70  coff_ulong s_relptr; /* file offset of reloc data */
71  coff_ulong s_lnnoptr; /* file offset of line data */
72  coff_ushort s_nreloc; /* # of relocation entries */
73  coff_ushort s_nlnno; /* # of line entries */
74  coff_uint s_flags; /* flags */
75 };
76 
77 struct ecoff_exechdr {
78  struct ecoff_filehdr f;
79  struct ecoff_aouthdr a;
80 };
81 
82 #define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr))
83 
84 #define ECOFF_OMAGIC 0407
85 #define ECOFF_NMAGIC 0410
86 #define ECOFF_ZMAGIC 0413
87 
88 #define ECOFF_ROUND(value, by) \
89  (((value) + (by) - 1) & ~((by) - 1))
90 
91 #define ECOFF_BLOCK_ALIGN(ep, value) \
92  ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \
93  (value))
94 
95 #define ECOFF_TXTOFF(ep) \
96  ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \
97  ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \
98  sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep)))
99 
100 #define ECOFF_DATOFF(ep) \
101  (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize))
102 
103 #define ECOFF_SEGMENT_ALIGN(ep, value) \
104  (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \
105  ECOFF_SEGMENT_ALIGNMENT(ep))))
106 
107 #endif /* !_SYS_EXEC_ECOFF_H_ */
coff_ulong s_vaddr
Definition: exec_ecoff.h:67
coff_ushort magic
Definition: exec_ecoff.h:51
coff_uint f_timdat
Definition: exec_ecoff.h:43
coff_ulong f_symptr
Definition: exec_ecoff.h:44
#define ECOFF_PAD
Definition: ecoff_machdep.h:51
coff_ushort vstamp
Definition: exec_ecoff.h:52
coff_uint s_flags
Definition: exec_ecoff.h:74
uint32_t coff_uint
Definition: ecoff_machdep.h:44
coff_ushort f_nscns
Definition: exec_ecoff.h:42
struct ecoff_aouthdr a
Definition: exec_ecoff.h:79
coff_ulong s_scnptr
Definition: exec_ecoff.h:69
char s_name[8]
Definition: exec_ecoff.h:65
coff_ulong entry
Definition: exec_ecoff.h:57
coff_uint f_nsyms
Definition: exec_ecoff.h:45
coff_ulong text_start
Definition: exec_ecoff.h:58
coff_ulong s_lnnoptr
Definition: exec_ecoff.h:71
coff_ulong dsize
Definition: exec_ecoff.h:55
coff_ulong s_paddr
Definition: exec_ecoff.h:66
coff_ushort s_nreloc
Definition: exec_ecoff.h:72
coff_ulong bss_start
Definition: exec_ecoff.h:60
ECOFF_PAD coff_ulong tsize
Definition: exec_ecoff.h:54
coff_ushort f_opthdr
Definition: exec_ecoff.h:46
coff_ulong bsize
Definition: exec_ecoff.h:56
uint16_t coff_ushort
Definition: ecoff_machdep.h:42
coff_ulong s_relptr
Definition: exec_ecoff.h:70
coff_ushort f_flags
Definition: exec_ecoff.h:47
struct ecoff_filehdr f
Definition: exec_ecoff.h:78
coff_ulong s_size
Definition: exec_ecoff.h:68
uint64_t coff_ulong
Definition: ecoff_machdep.h:46
coff_ushort f_magic
Definition: exec_ecoff.h:41
coff_ulong data_start
Definition: exec_ecoff.h:59
coff_ushort s_nlnno
Definition: exec_ecoff.h:73

Generated on Fri Jun 9 2017 13:03:41 for gem5 by doxygen 1.8.6