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