1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 */
4/*-
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)exec.h 8.1 (Berkeley) 6/11/93
37 */
38
39#ifndef _BSD_ARM_EXEC_H_
40#define _BSD_ARM_EXEC_H_
41
42
43#ifdef BSD_KERNEL_PRIVATE
44/* Size of a page in an object file. */
45#define __LDPGSZ 4096
46
47/* Valid magic number check. */
48#define N_BADMAG(ex) \
49 ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
50 (ex).a_magic != ZMAGIC)
51
52/* Address of the bottom of the text segment. */
53#define N_TXTADDR(X) 0
54
55/* Address of the bottom of the data segment. */
56#define N_DATADDR(ex) \
57 (N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
58 : __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
59
60/* Text segment offset. */
61#define N_TXTOFF(ex) \
62 ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
63
64/* Data segment offset. */
65#define N_DATOFF(ex) \
66 (N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
67 __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
68
69/* Symbol table offset. */
70#define N_SYMOFF(ex) \
71 (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
72 (ex).a_drsize)
73
74/* String table offset. */
75#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
76
77/* Description of the object file header (a.out format). */
78struct exec {
79#define OMAGIC 0407 /* old impure format */
80#define NMAGIC 0410 /* read-only text */
81#define ZMAGIC 0413 /* demand load format */
82#define QMAGIC 0314 /* demand load format. Header in text. */
83 unsigned int a_magic; /* magic number */
84
85 unsigned int a_text; /* text segment size */
86 unsigned int a_data; /* initialized data size */
87 unsigned int a_bss; /* uninitialized data size */
88 unsigned int a_syms; /* symbol table size */
89 unsigned int a_entry; /* entry point */
90 unsigned int a_trsize; /* text relocation size */
91 unsigned int a_drsize; /* data relocation size */
92};
93
94#endif /* BSD_KERNEL_PRIVATE */
95
96#endif /* _BSD_ARM_EXEC_H_ */
97