1 /* a.out specifics for Sequent Symmetry running Dynix 3.x 2 3 Copyright (C) 2001-2016 Free Software Foundation, Inc. 4 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 3 of the License, or 8 (at your option) any later version. 9 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. 14 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, 18 MA 02110-1301, USA. */ 19 20 #ifndef A_OUT_DYNIX3_H 21 #define A_OUT_DYNIX3_H 22 23 #define external_exec dynix_external_exec 24 25 /* struct exec for Dynix 3 26 27 a_gdtbl and a_bootstrap are only for standalone binaries. 28 Shared data fields are not supported by the kernel as of Dynix 3.1, 29 but are supported by Dynix compiler programs. */ 30 struct dynix_external_exec 31 { 32 unsigned char e_info[4]; 33 unsigned char e_text[4]; 34 unsigned char e_data[4]; 35 unsigned char e_bss[4]; 36 unsigned char e_syms[4]; 37 unsigned char e_entry[4]; 38 unsigned char e_trsize[4]; 39 unsigned char e_drsize[4]; 40 unsigned char e_g_code[8]; 41 unsigned char e_g_data[8]; 42 unsigned char e_g_desc[8]; 43 unsigned char e_shdata[4]; 44 unsigned char e_shbss[4]; 45 unsigned char e_shdrsize[4]; 46 unsigned char e_bootstrap[44]; 47 unsigned char e_reserved[12]; 48 unsigned char e_version[4]; 49 }; 50 51 #define EXEC_BYTES_SIZE (128) 52 53 /* All executables under Dynix are demand paged with read-only text, 54 Thus no NMAGIC. 55 56 ZMAGIC has a page of 0s at virtual 0, 57 XMAGIC has an invalid page at virtual 0. */ 58 #define OMAGIC 0x12eb /* .o */ 59 #define ZMAGIC 0x22eb /* zero @ 0, demand load */ 60 #define XMAGIC 0x32eb /* invalid @ 0, demand load */ 61 #define SMAGIC 0x42eb /* standalone, not supported here */ 62 63 #define N_BADMAG(x) ((OMAGIC != N_MAGIC(x)) && \ 64 (ZMAGIC != N_MAGIC(x)) && \ 65 (XMAGIC != N_MAGIC(x)) && \ 66 (SMAGIC != N_MAGIC(x))) 67 68 #define N_ADDRADJ(x) ((ZMAGIC == N_MAGIC(x) || XMAGIC == N_MAGIC(x)) ? 0x1000 : 0) 69 70 #define N_TXTOFF(x) (EXEC_BYTES_SIZE) 71 #define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x)) 72 #define N_SHDATOFF(x) (N_DATOFF(x) + (x)->a_data) 73 #define N_TRELOFF(x) (N_SHDATOFF(x) + (x)->a_shdata) 74 #define N_DRELOFF(x) (N_TRELOFF(x) + (x)->a_trsize) 75 #define N_SHDRELOFF(x) (N_DRELOFF(x) + (x)->a_drsize) 76 #define N_SYMOFF(x) (N_SHDRELOFF(x) + (x)->a_shdrsize) 77 #define N_STROFF(x) (N_SYMOFF(x) + (x)->a_syms) 78 79 #define N_TXTADDR(x) \ 80 (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \ 81 : TEXT_START_ADDR + EXEC_BYTES_SIZE) 82 83 #define N_TXTSIZE(x) \ 84 (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x)->a_text) \ 85 : ((x)->a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE)) 86 87 #endif /* A_OUT_DYNIX3_H */ 88