1 /* $NetBSD: pecoff_exec.h,v 1.10 2008/11/19 18:36:05 ad Exp $ */
4 * Copyright (c) 2000 Masaru OKI
5 * Copyright (c) 1994, 1995, 1998 Scott Bartram
8 * adapted from sys/sys/exec_ecoff.h
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission
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.
34 #ifndef _PECOFF_EXEC_H_
35 #define _PECOFF_EXEC_H_
37 #include <sys/exec_coff.h> /* for COFF_HDR_SIZE */
39 struct pecoff_dos_filehdr
{
40 u_int16_t d_magic
; /* +0x00 'MZ' */
41 u_int8_t d_stub
[0x3a];
42 u_int32_t d_peofs
; /* +0x3c */
45 #define PECOFF_DOS_MAGIC 0x5a4d
46 #define PECOFF_DOS_HDR_SIZE (sizeof(struct pecoff_dos_filehdr))
48 #define DOS_BADMAG(dp) ((dp)->d_magic != PECOFF_DOS_MAGIC)
51 #define COFF_OMAGIC 0407 /* text not write-protected; data seg
52 is contiguous with text */
53 #define COFF_NMAGIC 0410 /* text is write-protected; data starts
54 at next seg following text */
55 #define COFF_ZMAGIC 0413 /* text and data segs are aligned for
57 #define COFF_SMAGIC 0443 /* shared lib */
59 #define COFF_LDPGSZ 4096 /* XXX */
61 struct pecoff_imghdr
{
66 struct pecoff_opthdr
{
85 struct pecoff_imghdr w_imghdr
[16];
90 #define COFF_STYP_DISCARD 0x2000000
91 #define COFF_STYP_EXEC 0x20000000
92 #define COFF_STYP_READ 0x40000000
93 #define COFF_STYP_WRITE 0x80000000
95 #define PECOFF_HDR_SIZE (COFF_HDR_SIZE + sizeof(struct pecoff_opthdr))
97 #define NETBSDPE_ABI_VERSION 0x00000002
99 struct pecoff_args1
{ /* obsoleted */
104 struct pecoff_imghdr a_imghdr
[16];
110 u_long a_zero
; /* always 0 */
115 struct pecoff_opthdr a_opthdr
;
118 extern struct emul emul_pecoff
;
121 int exec_pecoff_makecmds (struct lwp
*, struct exec_package
*);
122 int pecoff_copyargs (struct lwp
*, struct exec_package
*,
123 struct ps_strings
*, char **, void *);