Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / compat / pecoff / pecoff_exec.h
blobbee393cbb726b5c8b4b79d2da8f2a70e9f7f7dd0
1 /* $NetBSD: pecoff_exec.h,v 1.10 2008/11/19 18:36:05 ad Exp $ */
3 /*
4 * Copyright (c) 2000 Masaru OKI
5 * Copyright (c) 1994, 1995, 1998 Scott Bartram
6 * All rights reserved.
8 * adapted from sys/sys/exec_ecoff.h
9 * based on Intel iBCS2
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. 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)
50 /* 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
56 direct paging */
57 #define COFF_SMAGIC 0443 /* shared lib */
59 #define COFF_LDPGSZ 4096 /* XXX */
61 struct pecoff_imghdr {
62 long i_vaddr;
63 long i_size;
66 struct pecoff_opthdr {
67 long w_base;
68 long w_salign;
69 long w_falign;
70 long w_osvers;
71 long w_imgvers;
72 long w_subvers;
73 long w_rsvd;
74 long w_imgsize;
75 long w_hdrsize;
76 long w_chksum;
77 u_short w_subsys;
78 u_short w_dllflags;
79 long w_ssize;
80 long w_cssize;
81 long w_hsize;
82 long w_chsize;
83 long w_lflag;
84 long w_nimghdr;
85 struct pecoff_imghdr w_imghdr[16];
89 /* s_flags for PE */
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 */
100 u_long a_base;
101 u_long a_entry;
102 u_long a_end;
103 u_long a_subsystem;
104 struct pecoff_imghdr a_imghdr[16];
105 u_long a_ldbase;
106 u_long a_ldexport;
108 struct pecoff_args {
109 u_long a_abiversion;
110 u_long a_zero; /* always 0 */
111 u_long a_entry;
112 u_long a_end;
113 u_long a_ldbase;
114 u_long a_ldexport;
115 struct pecoff_opthdr a_opthdr;
118 extern struct emul emul_pecoff;
120 struct exec_package;
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 *);
125 #endif