Back to index

cell-binutils  2.17cvs20070401
dynix3.h
Go to the documentation of this file.
00001 /* a.out specifics for Sequent Symmetry running Dynix 3.x
00002 
00003    Copyright 2001 Free Software Foundation, Inc.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 #ifndef A_OUT_DYNIX3_H
00020 #define A_OUT_DYNIX3_H
00021 
00022 #define external_exec dynix_external_exec
00023 
00024 /* struct exec for Dynix 3
00025  
00026    a_gdtbl and a_bootstrap are only for standalone binaries.
00027    Shared data fields are not supported by the kernel as of Dynix 3.1,
00028    but are supported by Dynix compiler programs.  */
00029 struct dynix_external_exec
00030   {
00031     unsigned char e_info[4];
00032     unsigned char e_text[4];
00033     unsigned char e_data[4];
00034     unsigned char e_bss[4];
00035     unsigned char e_syms[4];
00036     unsigned char e_entry[4];
00037     unsigned char e_trsize[4];
00038     unsigned char e_drsize[4];
00039     unsigned char e_g_code[8];
00040     unsigned char e_g_data[8];
00041     unsigned char e_g_desc[8];
00042     unsigned char e_shdata[4];
00043     unsigned char e_shbss[4];
00044     unsigned char e_shdrsize[4];
00045     unsigned char e_bootstrap[44];
00046     unsigned char e_reserved[12];
00047     unsigned char e_version[4];
00048   };
00049 
00050 #define       EXEC_BYTES_SIZE      (128)
00051 
00052 /* All executables under Dynix are demand paged with read-only text,
00053    Thus no NMAGIC.
00054   
00055    ZMAGIC has a page of 0s at virtual 0,
00056    XMAGIC has an invalid page at virtual 0.  */
00057 #define OMAGIC       0x12eb        /* .o */
00058 #define ZMAGIC       0x22eb        /* zero @ 0, demand load */
00059 #define XMAGIC       0x32eb        /* invalid @ 0, demand load */
00060 #define SMAGIC       0x42eb        /* standalone, not supported here */
00061 
00062 #define N_BADMAG(x) ((OMAGIC != N_MAGIC(x)) && \
00063                    (ZMAGIC != N_MAGIC(x)) && \
00064                    (XMAGIC != N_MAGIC(x)) && \
00065                    (SMAGIC != N_MAGIC(x)))
00066 
00067 #define N_ADDRADJ(x) ((ZMAGIC == N_MAGIC(x) || XMAGIC == N_MAGIC(x)) ? 0x1000 : 0)
00068 
00069 #define N_TXTOFF(x) (EXEC_BYTES_SIZE)
00070 #define N_DATOFF(x) (N_TXTOFF(x) + N_TXTSIZE(x))
00071 #define N_SHDATOFF(x) (N_DATOFF(x) + (x).a_data)
00072 #define N_TRELOFF(x) (N_SHDATOFF(x) + (x).a_shdata)
00073 #define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
00074 #define N_SHDRELOFF(x) (N_DRELOFF(x) + (x).a_drsize)
00075 #define N_SYMOFF(x) (N_SHDRELOFF(x) + (x).a_shdrsize)
00076 #define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
00077 
00078 #define N_TXTADDR(x) \
00079        (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? 0 \
00080         : TEXT_START_ADDR + EXEC_BYTES_SIZE)
00081 
00082 #define N_TXTSIZE(x) \
00083        (((OMAGIC == N_MAGIC(x)) || (SMAGIC == N_MAGIC(x))) ? ((x).a_text) \
00084         : ((x).a_text - N_ADDRADJ(x) - EXEC_BYTES_SIZE))
00085 
00086 #endif /* A_OUT_DYNIX3_H */