1 |
dpavlin |
4 |
/* 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 */ |
62 |
|
|
ECOFF_MACHDEP; |
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_ */ |