1 /* $NetBSD: ibcs2_exec.h,v 1.15 2007/12/04 18:40:10 dsl Exp $ */
4 * Copyright (c) 1994, 1995, 1998 Scott Bartram
7 * adapted from sys/sys/exec_ecoff.h
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _IBCS2_EXEC_H_
34 #define _IBCS2_EXEC_H_
41 /* defined in <machine/ibcs2_machdep.h> */
44 #define COFF_OMAGIC 0407 /* text not write-protected; data seg
45 is contiguous with text */
46 #define COFF_NMAGIC 0410 /* text is write-protected; data starts
47 at next seg following text */
48 #define COFF_ZMAGIC 0413 /* text and data segs are aligned for
50 #define COFF_SMAGIC 0443 /* shared lib */
52 #define COFF_SEGMENT_ALIGNMENT(fp, ap) 4
54 #define IBCS2_HIGH_SYSCALL(n) (((n) & 0x7f) == 0x28 && ((n) >> 8) > 0)
55 #define IBCS2_CVT_HIGH_SYSCALL(n) (((n) >> 8) + 200)
58 int exec_ibcs2_coff_makecmds(struct lwp
*, struct exec_package
*);
65 u_short x_magic
; /* magic number */
66 u_short x_ext
; /* size of extended header */
67 long x_text
; /* ignored */
68 long x_data
; /* ignored */
69 long x_bss
; /* ignored */
70 long x_syms
; /* ignored */
71 long x_reloc
; /* ignored */
72 long x_entry
; /* executable entry point */
73 char x_cpu
; /* processor type */
74 char x_relsym
; /* ignored */
75 u_short x_renv
; /* flags */
79 #define XOUT_MAGIC 0x0206
82 #define XC_386 0x004a /* 386, word-swapped */
88 #define XE_ITER 0x0200
89 #define XE_VMOD 0x0100
91 #define XE_LTEXT 0x0040
92 #define XE_LDATA 0x0020
93 #define XE_OVER 0x0010
95 #define XE_PURE 0x0004
97 #define XE_EXEC 0x0001
100 * x.out extended header
104 long xe_trsize
; /* ignored */
105 long xe_drsize
; /* ignored */
106 long xe_tbase
; /* ignored */
107 long xe_dbase
; /* ignored */
108 long xe_stksize
; /* stack size if XE_FS set in x_renv */
109 long xe_segpos
; /* offset of segment table */
110 long xe_segsize
; /* segment table size */
111 long xe_mdtpos
; /* ignored */
112 long xe_mdtsize
; /* ignored */
113 char xe_mdttype
; /* ignored */
114 char xe_pagesize
; /* ignored */
115 char xe_ostype
; /* ignored */
116 char xe_osvers
; /* ignored */
117 u_short xe_eseg
; /* ignored */
118 u_short xe_sres
; /* ignored */
122 * x.out segment table
126 u_short xs_type
; /* segment type */
127 u_short xs_attr
; /* attribute flags */
128 u_short xs_seg
; /* segment selector number */
129 char xs_align
; /* ignored */
130 char xs_cres
; /* ignored */
131 long xs_filpos
; /* offset of this segment */
132 long xs_psize
; /* physical segment size */
133 long xs_vsize
; /* virtual segment size */
134 long xs_rbase
; /* relocation base address */
135 u_short xs_noff
; /* ignored */
136 u_short xs_sres
; /* ignored */
137 long xs_lres
; /* ignored */
141 #define XS_TNULL 0 /* unused */
142 #define XS_TTEXT 1 /* text (read-only) */
143 #define XS_TDATA 2 /* data (read-write) */
144 #define XS_TSYMS 3 /* symbol table (noload) */
145 #define XS_TREL 4 /* relocation segment (noload) */
146 #define XS_TSESTR 5 /* string table (noload) */
147 #define XS_TGRPS 6 /* group segment (noload) */
160 #define XS_AMEM 0x8000 /* memory image */
161 #define XS_AITER 0x0001 /* iteration records */
162 #define XS_AHUGE 0x0002 /* unused */
163 #define XS_ABSS 0x0004 /* uninitialized data */
164 #define XS_APURE 0x0008 /* read-only (sharable) segment */
165 #define XS_AEDOWN 0x0010 /* expand down memory segment */
166 #define XS_APRIV 0x0020 /* unused */
167 #define XS_A32BIT 0x0040 /* 32-bit text/data */
170 * x.out iteration record
174 long xi_size
; /* text/data size */
175 long xi_rep
; /* number of replications */
176 long xi_offset
; /* offset within segment to replicated data */
179 extern struct emul emul_ibcs2
;
181 #define XOUT_HDR_SIZE (sizeof(struct xexec) + sizeof(struct xext))
183 int exec_ibcs2_xout_makecmds(struct lwp
*, struct exec_package
*);
184 int ibcs2_exec_setup_stack(struct lwp
*, struct exec_package
*);
187 int ibcs2_elf32_probe(struct lwp
*, struct exec_package
*,
188 void *, char *, vaddr_t
*);
191 /* following two are used for indication of executable type */
192 #define IBCS2_EXEC_XENIX ((void *)0x01) /* XENIX x.out executable */
193 #define IBCS2_EXEC_OTHER ((void *)0x02) /* something else */
195 #endif /* !_IBCS2_EXEC_H_ */