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