]> git.saurik.com Git - apple/xnu.git/blob - bsd/ppc/exec.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / bsd / ppc / exec.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (c) 1994, The University of Utah and
25 * the Center for Software Science at the University of Utah (CSS).
26 * All rights reserved.
27 *
28 * Permission to use, copy, modify and distribute this software and its
29 * documentation is hereby granted, provided that both the copyright
30 * notice and this permission notice appear in all copies of the
31 * software, derivative works or modified versions, and any portions
32 * thereof, and that both notices appear in supporting documentation.
33 *
34 * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
35 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
36 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
37 *
38 * CSS requests users of this software to return to css-dist@cs.utah.edu any
39 * improvements that they make and grant CSS redistribution rights.
40 *
41 */
42
43 #ifndef _BSD_PPC_EXEC_H_
44 #define _BSD_PPC_EXEC_H_
45
46
47 #include <sys/appleapiopts.h>
48
49 #ifdef BSD_KERNEL_PRIVATE
50 /* Size of a page in an object file. */
51 #define __LDPGSZ 4096
52
53 /* Valid magic number check. */
54 #define N_BADMAG(ex) \
55 ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
56 (ex).a_magic != ZMAGIC)
57
58 /* Address of the bottom of the text segment. */
59 #define N_TXTADDR(X) 0
60
61 /* Address of the bottom of the data segment. */
62 #define N_DATADDR(ex) \
63 (N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
64 : __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
65
66 /* Text segment offset. */
67 #define N_TXTOFF(ex) \
68 ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
69
70 /* Data segment offset. */
71 #define N_DATOFF(ex) \
72 (N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
73 __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
74
75 /* Symbol table offset. */
76 #define N_SYMOFF(ex) \
77 (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
78 (ex).a_drsize)
79
80 /* String table offset. */
81 #define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
82
83 /* Description of the object file header (a.out format). */
84 struct exec {
85 #define OMAGIC 0407 /* old impure format */
86 #define NMAGIC 0410 /* read-only text */
87 #define ZMAGIC 0413 /* demand load format */
88 #define QMAGIC 0314 /* demand load format. Header in text. */
89 unsigned int a_magic; /* magic number */
90
91 unsigned int a_text; /* text segment size */
92 unsigned int a_data; /* initialized data size */
93 unsigned int a_bss; /* uninitialized data size */
94 unsigned int a_syms; /* symbol table size */
95 unsigned int a_entry; /* entry point */
96 unsigned int a_trsize; /* text relocation size */
97 unsigned int a_drsize; /* data relocation size */
98 };
99
100 #endif /* BSD_KERNEL_PRIVATE */
101
102 #endif /* _BSD_PPC_EXEC_H_ */
103