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