|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Copyright (c) 1994, The University of Utah and
27: * the Center for Software Science at the University of Utah (CSS).
28: * All rights reserved.
29: *
30: * Permission to use, copy, modify and distribute this software and its
31: * documentation is hereby granted, provided that both the copyright
32: * notice and this permission notice appear in all copies of the
33: * software, derivative works or modified versions, and any portions
34: * thereof, and that both notices appear in supporting documentation.
35: *
36: * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
37: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
38: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39: *
40: * CSS requests users of this software to return to [email protected] any
41: * improvements that they make and grant CSS redistribution rights.
42: *
43: */
44:
45: /* Size of a page in an object file. */
46: #define __LDPGSZ 4096
47:
48: /* Valid magic number check. */
49: #define N_BADMAG(ex) \
50: ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
51: (ex).a_magic != ZMAGIC)
52:
53: /* Address of the bottom of the text segment. */
54: #define N_TXTADDR(X) 0
55:
56: /* Address of the bottom of the data segment. */
57: #define N_DATADDR(ex) \
58: (N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
59: : __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
60:
61: /* Text segment offset. */
62: #define N_TXTOFF(ex) \
63: ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
64:
65: /* Data segment offset. */
66: #define N_DATOFF(ex) \
67: (N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
68: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
69:
70: /* Symbol table offset. */
71: #define N_SYMOFF(ex) \
72: (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
73: (ex).a_drsize)
74:
75: /* String table offset. */
76: #define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
77:
78: /* Description of the object file header (a.out format). */
79: struct exec {
80: #define OMAGIC 0407 /* old impure format */
81: #define NMAGIC 0410 /* read-only text */
82: #define ZMAGIC 0413 /* demand load format */
83: #define QMAGIC 0314 /* demand load format. Header in text. */
84: unsigned int a_magic; /* magic number */
85:
86: unsigned int a_text; /* text segment size */
87: unsigned int a_data; /* initialized data size */
88: unsigned int a_bss; /* uninitialized data size */
89: unsigned int a_syms; /* symbol table size */
90: unsigned int a_entry; /* entry point */
91: unsigned int a_trsize; /* text relocation size */
92: unsigned int a_drsize; /* data relocation size */
93: };
94:
95: /*
96: * Address of ps_strings structure (in user space).
97: */
98: #define PS_STRINGS \
99: ((struct ps_strings *)(USRSTACK - sizeof(struct ps_strings)))
100:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.