]> git.saurik.com Git - apple/xnu.git/blame - bsd/ppc/exec.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / bsd / ppc / exec.h
CommitLineData
1c79356b 1/*
5d5c5d0d
A
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
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.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
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.
32 *
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.
38 *
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.
42 *
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.
45 *
46 */
47
9bccf70c
A
48#ifndef _BSD_PPC_EXEC_H_
49#define _BSD_PPC_EXEC_H_
50
51
52#include <sys/appleapiopts.h>
53
91447636 54#ifdef BSD_KERNEL_PRIVATE
1c79356b
A
55/* Size of a page in an object file. */
56#define __LDPGSZ 4096
57
58/* Valid magic number check. */
59#define N_BADMAG(ex) \
60 ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
61 (ex).a_magic != ZMAGIC)
62
63/* Address of the bottom of the text segment. */
64#define N_TXTADDR(X) 0
65
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))))
70
71/* Text segment offset. */
72#define N_TXTOFF(ex) \
73 ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
74
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))))
79
80/* Symbol table offset. */
81#define N_SYMOFF(ex) \
82 (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
83 (ex).a_drsize)
84
85/* String table offset. */
86#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
87
88/* Description of the object file header (a.out format). */
89struct exec {
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 */
95
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 */
103};
104
91447636 105#endif /* BSD_KERNEL_PRIVATE */
9bccf70c
A
106
107#endif /* _BSD_PPC_EXEC_H_ */
108