|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
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.
26: *
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.
32: *
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.
36: *
37: * CSS requests users of this software to return to [email protected] any
38: * improvements that they make and grant CSS redistribution rights.
39: *
40: */
41:
42: /* Size of a page in an object file. */
43: #define __LDPGSZ 4096
44:
45: /* Valid magic number check. */
46: #define N_BADMAG(ex) \
47: ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
48: (ex).a_magic != ZMAGIC)
49:
50: /* Address of the bottom of the text segment. */
51: #define N_TXTADDR(X) 0
52:
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))))
57:
58: /* Text segment offset. */
59: #define N_TXTOFF(ex) \
60: ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
61:
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))))
66:
67: /* Symbol table offset. */
68: #define N_SYMOFF(ex) \
69: (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
70: (ex).a_drsize)
71:
72: /* String table offset. */
73: #define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
74:
75: /* Description of the object file header (a.out format). */
76: struct exec {
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 */
82:
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 */
90: };
91:
92: /*
93: * Address of ps_strings structure (in user space).
94: */
95: #define PS_STRINGS \
96: ((struct ps_strings *)(USRSTACK - sizeof(struct ps_strings)))
97:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.