1 /* a.out specifics for Sequent Symmetry running Dynix 3.x
3 Copyright 2001 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
19 #ifndef A_OUT_DYNIX3_H
20 #define A_OUT_DYNIX3_H
22 #define external_exec dynix_external_exec
24 /* struct exec for Dynix 3
26 a_gdtbl and a_bootstrap are only for standalone binaries.
27 Shared data fields are not supported by the kernel as of Dynix 3.1,
28 but are supported by Dynix compiler programs. */
29 struct dynix_external_exec
31 unsigned char e_info
[4];
32 unsigned char e_text
[4];
33 unsigned char e_data
[4];
34 unsigned char e_bss
[4];
35 unsigned char e_syms
[4];
36 unsigned char e_entry
[4];
37 unsigned char e_trsize
[4];
38 unsigned char e_drsize
[4];
39 unsigned char e_g_code
[8];
40 unsigned char e_g_data
[8];
41 unsigned char e_g_desc
[8];
42 unsigned char e_shdata
[4];
43 unsigned char e_shbss
[4];
44 unsigned char e_shdrsize
[4];
45 unsigned char e_bootstrap
[44];
46 unsigned char e_reserved
[12];
47 unsigned char e_version
[4];
50 #define EXEC_BYTES_SIZE (128)
52 /* All executables under Dynix are demand paged with read-only text,
55 ZMAGIC has a page of 0s at virtual 0,
56 XMAGIC has an invalid page at virtual 0. */
57 #define OMAGIC 0x12eb /* .o */
58 #define ZMAGIC 0x22eb /* zero @ 0, demand load */
59 #define XMAGIC 0x32eb /* invalid @ 0, demand load */
60 #define SMAGIC 0x42eb /* standalone, not supported here */
62 #define N_BADMAG(x) ((OMAGIC != N_MAGIC(x)) && \
63 (ZMAGIC != N_MAGIC(x)) && \
64 (XMAGIC != N_MAGIC(x)) && \
65 (SMAGIC != N_MAGIC(x)))
67 #define N_ADDRADJ(x) ((ZMAGIC == N_MAGIC(x) || XMAGIC == N_MAGIC(x)) ? 0x1000 : 0)
69 #define N_TXTOFF(x) (EXEC_BYTES_SIZE)
70 #define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x))
71 #define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data)
72 #define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata)
73 #define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
74 #define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize)
75 #define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize)
76 #define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
78 #define N_TXTADDR(x) \
79 (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \
80 : TEXT_START_ADDR + EXEC_BYTES_SIZE)
82 #define N_TXTSIZE(x) \
83 (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \
84 : ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE))
86 #endif /* A_OUT_DYNIX3_H */