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