VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.0.1/aout.h@ 62425

最後變更 在這個檔案從62425是 51223,由 vboxsync 提交於 11 年 前

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.7 KB
 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aout.h,v 1.7 2002/05/31 18:46:00 dawes Exp $ */
2
3/*
4 * Borrowed from NetBSD's exec_aout.h
5 *
6 * Copyright (c) 1993, 1994 Christopher G. Demetriou
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Christopher G. Demetriou.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifdef HAVE_XORG_CONFIG_H
36#include <xorg-config.h>
37#endif
38
39#ifndef _AOUT_H
40#define _AOUT_H
41
42#include <X11/Xos.h>
43
44/* Get prototype for ntohl, per SuSv3. */
45#include <arpa/inet.h>
46
47/* OS/2 EMX has ntohl in this file */
48#ifdef __UNIXOS2__
49#include <sys/param.h>
50#endif
51
52#define __LDPGSZ 4096U
53#ifndef AOUT_PAGSIZ
54#define AOUT_PAGSIZ(ex) (__LDPGSZ)
55#endif
56
57/*
58 * a.out header
59 */
60typedef struct AOUT_exec {
61 unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
62 unsigned long a_text; /* text segment size */
63 unsigned long a_data; /* initialized data size */
64 unsigned long a_bss; /* uninitialized data size */
65 unsigned long a_syms; /* symbol table size */
66 unsigned long a_entry; /* entry point */
67 unsigned long a_trsize; /* text relocation size */
68 unsigned long a_drsize; /* data relocation size */
69} AOUTHDR;
70
71/* a_magic */
72#define OMAGIC 0407 /* old impure format */
73#define NMAGIC 0410 /* read-only text */
74#define ZMAGIC 0413 /* demand load format */
75#define QMAGIC 0314 /* "compact" demand load format; deprecated */
76
77/*
78 * a_mid - keep sorted in numerical order for sanity's sake
79 * ensure that: 0 < mid < 0x3ff
80 */
81#define MID_ZERO 0 /* unknown - implementation dependent */
82#define MID_SUN010 1 /* sun 68010/68020 binary */
83#define MID_SUN020 2 /* sun 68020-only binary */
84#define MID_PC386 100 /* 386 PC binary. (so quoth BFD) */
85#define MID_HP200 200 /* hp200 (68010) BSD binary */
86#define MID_I386 134 /* i386 BSD binary */
87#define MID_M68K 135 /* m68k BSD binary with 8K page sizes */
88#define MID_M68K4K 136 /* m68k BSD binary with 4K page sizes */
89#define MID_NS32532 137 /* ns32532 */
90#define MID_SPARC 138 /* sparc */
91#define MID_PMAX 139 /* pmax */
92#define MID_VAX 140 /* vax */
93#define MID_ALPHA 141 /* Alpha BSD binary */
94#define MID_MIPS 142 /* big-endian MIPS */
95#define MID_ARM6 143 /* ARM6 */
96#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */
97#define MID_HPUX 0x20C /* hp200/300 HP-UX binary */
98#define MID_HPUX800 0x20B /* hp800 HP-UX binary */
99
100/*
101 * a_flags
102 */
103#define EX_DYNAMIC 0x20
104#define EX_PIC 0x10
105#define EX_DPMASK 0x30
106/*
107 * Interpretation of the (a_flags & EX_DPMASK) bits:
108 *
109 * 00 traditional executable or object file
110 * 01 object file contains PIC code (set by `as -k')
111 * 10 dynamic executable
112 * 11 position independent executable image
113 * (eg. a shared library)
114 *
115 */
116
117/*
118 * The a.out structure's a_midmag field is a network-byteorder encoding
119 * of this int
120 * FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM
121 * Where `F' is 6 bits of flag like EX_DYNAMIC,
122 * `m' is 10 bits of machine-id like MID_I386, and
123 * `M' is 16 bits worth of magic number, ie. ZMAGIC.
124 * The macros below will set/get the needed fields.
125 */
126#define AOUT_GETMAGIC(ex) \
127 ( (((ex)->a_midmag)&0xffff0000U) ? (ntohl(((ex)->a_midmag))&0xffffU) : ((ex)->a_midmag))
128#define AOUT_GETMAGIC2(ex) \
129 ( (((ex)->a_midmag)&0xffff0000U) ? (ntohl(((ex)->a_midmag))&0xffffU) : \
130 (((ex)->a_midmag) | 0x10000) )
131#define AOUT_GETMID(ex) \
132 ( (((ex)->a_midmag)&0xffff0000U) ? ((ntohl(((ex)->a_midmag))>>16)&0x03ffU) : MID_ZERO )
133#define AOUT_GETFLAG(ex) \
134 ( (((ex)->a_midmag)&0xffff0000U) ? ((ntohl(((ex)->a_midmag))>>26)&0x3fU) : 0 )
135#define AOUT_SETMAGIC(ex,mag,mid,flag) \
136 ( (ex)->a_midmag = htonl( (((flag)&0x3fU)<<26) | (((mid)&0x03ffU)<<16) | \
137 (((mag)&0xffffU)) ) )
138
139#define AOUT_ALIGN(ex,x) \
140 (AOUT_GETMAGIC(ex) == ZMAGIC || AOUT_GETMAGIC(ex) == QMAGIC ? \
141 ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x))
142
143/* Valid magic number check. */
144#define AOUT_BADMAG(ex) \
145 (AOUT_GETMAGIC(ex) != NMAGIC && AOUT_GETMAGIC(ex) != OMAGIC && \
146 AOUT_GETMAGIC(ex) != ZMAGIC && AOUT_GETMAGIC(ex) != QMAGIC)
147
148/* Address of the bottom of the text segment. */
149#define AOUT_TXTADDR(ex) (AOUT_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ)
150
151/* Address of the bottom of the data segment. */
152#define AOUT_DATADDR(ex) \
153 (AOUT_GETMAGIC(ex) == OMAGIC ? AOUT_TXTADDR(ex) + (ex)->a_text : \
154 (AOUT_TXTADDR(ex) + (ex)->a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1))
155
156/* Address of the bottom of the bss segment. */
157#define AOUT_BSSADDR(ex) \
158 (AOUT_DATADDR(ex) + (ex)->a_data)
159
160/* Text segment offset. */
161#define AOUT_TXTOFF(ex) \
162 ( AOUT_GETMAGIC2(ex)==ZMAGIC || AOUT_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \
163 0 : (AOUT_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : \
164 sizeof(struct AOUT_exec)) )
165
166/* Data segment offset. */
167#define AOUT_DATOFF(ex) \
168 AOUT_ALIGN(ex, AOUT_TXTOFF(ex) + (ex)->a_text)
169
170/* Text relocation table offset. */
171#define AOUT_TRELOFF(ex) \
172 (AOUT_DATOFF(ex) + (ex)->a_data)
173
174/* Data relocation table offset. */
175#define AOUT_DRELOFF(ex) \
176 (AOUT_TRELOFF(ex) + (ex)->a_trsize)
177
178/* Symbol table offset. */
179#define AOUT_SYMOFF(ex) \
180 (AOUT_DRELOFF(ex) + (ex)->a_drsize)
181
182/* String table offset. */
183#define AOUT_STROFF(ex) \
184 (AOUT_SYMOFF(ex) + (ex)->a_syms)
185
186/* Relocation format. */
187struct relocation_info_i386 {
188 int r_address; /* offset in text or data segment */
189 unsigned int r_symbolnum:24, /* ordinal number of add symbol */
190 r_pcrel:1, /* 1 if value should be pc-relative */
191 r_length:2, /* log base 2 of value's width */
192 r_extern:1, /* 1 if need to add symbol to value */
193 r_baserel:1, /* linkage table relative */
194 r_jmptable:1, /* relocate to jump table */
195 r_relative:1, /* load address relative */
196 r_copy:1; /* run time copy */
197};
198
199#define relocation_info relocation_info_i386
200
201/*
202 * Symbol table entry format. The #ifdef's are so that programs including
203 * nlist.h can initialize nlist structures statically.
204 */
205typedef struct AOUT_nlist {
206 union {
207 char *n_name; /* symbol name (in memory) */
208 long n_strx; /* file string table offset (on disk) */
209 } n_un;
210
211#define AOUT_UNDF 0x00 /* undefined */
212#define AOUT_ABS 0x02 /* absolute address */
213#define AOUT_TEXT 0x04 /* text segment */
214#define AOUT_DATA 0x06 /* data segment */
215#define AOUT_BSS 0x08 /* bss segment */
216#define AOUT_INDR 0x0a /* alias definition */
217#define AOUT_SIZE 0x0c /* pseudo type, defines a symbol's size */
218#define AOUT_COMM 0x12 /* common reference */
219#define AOUT_FN 0x1e /* file name (AOUT_EXT on) */
220#define AOUT_WARN 0x1e /* warning message (AOUT_EXT off) */
221
222#define AOUT_EXT 0x01 /* external (global) bit, OR'ed in */
223#define AOUT_TYPE 0x1e /* mask for all the type bits */
224 unsigned char n_type; /* type defines */
225
226 char n_other; /* spare */
227#define n_hash n_desc /* used internally by ld(1); XXX */
228 short n_desc; /* used by stab entries */
229 unsigned long n_value; /* address/value of the symbol */
230} AOUT_nlist;
231
232#define AOUT_FORMAT "%08x" /* namelist value format; XXX */
233#define AOUT_STAB 0x0e0 /* mask for debugger symbols -- stab(5) */
234
235#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette