exec_ecoff.h Source File

Back to the index.

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

Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13