1 
   2 #ifndef _UAPI__A_OUT_GNU_H__
   3 #define _UAPI__A_OUT_GNU_H__
   4 
   5 #define __GNU_EXEC_MACROS__
   6 
   7 #ifndef __STRUCT_EXEC_OVERRIDE__
   8 
   9 #include <asm/a.out.h>
  10 
  11 #endif 
  12 
  13 #ifndef __ASSEMBLY__
  14 
  15 
  16 enum machine_type {
  17 #if defined (M_OLDSUN2)
  18   M__OLDSUN2 = M_OLDSUN2,
  19 #else
  20   M_OLDSUN2 = 0,
  21 #endif
  22 #if defined (M_68010)
  23   M__68010 = M_68010,
  24 #else
  25   M_68010 = 1,
  26 #endif
  27 #if defined (M_68020)
  28   M__68020 = M_68020,
  29 #else
  30   M_68020 = 2,
  31 #endif
  32 #if defined (M_SPARC)
  33   M__SPARC = M_SPARC,
  34 #else
  35   M_SPARC = 3,
  36 #endif
  37   
  38   M_386 = 100,
  39   M_MIPS1 = 151,        
  40   M_MIPS2 = 152         
  41 };
  42 
  43 #if !defined (N_MAGIC)
  44 #define N_MAGIC(exec) ((exec).a_info & 0xffff)
  45 #endif
  46 #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
  47 #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
  48 #define N_SET_INFO(exec, magic, type, flags) \
  49         ((exec).a_info = ((magic) & 0xffff) \
  50          | (((int)(type) & 0xff) << 16) \
  51          | (((flags) & 0xff) << 24))
  52 #define N_SET_MAGIC(exec, magic) \
  53         ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
  54 
  55 #define N_SET_MACHTYPE(exec, machtype) \
  56         ((exec).a_info = \
  57          ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
  58 
  59 #define N_SET_FLAGS(exec, flags) \
  60         ((exec).a_info = \
  61          ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
  62 
  63 
  64 #define OMAGIC 0407
  65 
  66 #define NMAGIC 0410
  67 
  68 #define ZMAGIC 0413
  69 
  70 
  71 #define QMAGIC 0314
  72 
  73 
  74 #define CMAGIC 0421
  75 
  76 #if !defined (N_BADMAG)
  77 #define N_BADMAG(x)       (N_MAGIC(x) != OMAGIC         \
  78                         && N_MAGIC(x) != NMAGIC         \
  79                         && N_MAGIC(x) != ZMAGIC \
  80                         && N_MAGIC(x) != QMAGIC)
  81 #endif
  82 
  83 #define _N_HDROFF(x) (1024 - sizeof (struct exec))
  84 
  85 #if !defined (N_TXTOFF)
  86 #define N_TXTOFF(x) \
  87  (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
  88   (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
  89 #endif
  90 
  91 #if !defined (N_DATOFF)
  92 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
  93 #endif
  94 
  95 #if !defined (N_TRELOFF)
  96 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
  97 #endif
  98 
  99 #if !defined (N_DRELOFF)
 100 #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
 101 #endif
 102 
 103 #if !defined (N_SYMOFF)
 104 #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
 105 #endif
 106 
 107 #if !defined (N_STROFF)
 108 #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
 109 #endif
 110 
 111 
 112 #if !defined (N_TXTADDR)
 113 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
 114 #endif
 115 
 116 
 117 #ifndef __KERNEL__
 118 #include <unistd.h>
 119 #endif
 120 #if defined(__i386__) || defined(__mc68000__)
 121 #define SEGMENT_SIZE    1024
 122 #else
 123 #ifndef SEGMENT_SIZE
 124 #ifndef __KERNEL__
 125 #define SEGMENT_SIZE   getpagesize()
 126 #endif
 127 #endif
 128 #endif
 129 
 130 #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
 131 
 132 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
 133 
 134 #ifndef N_DATADDR
 135 #define N_DATADDR(x) \
 136     (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
 137      : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
 138 #endif
 139 
 140 
 141 #if !defined (N_BSSADDR)
 142 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
 143 #endif
 144 
 145 #if !defined (N_NLIST_DECLARED)
 146 struct nlist {
 147   union {
 148     char *n_name;
 149     struct nlist *n_next;
 150     long n_strx;
 151   } n_un;
 152   unsigned char n_type;
 153   char n_other;
 154   short n_desc;
 155   unsigned long n_value;
 156 };
 157 #endif 
 158 
 159 #if !defined (N_UNDF)
 160 #define N_UNDF 0
 161 #endif
 162 #if !defined (N_ABS)
 163 #define N_ABS 2
 164 #endif
 165 #if !defined (N_TEXT)
 166 #define N_TEXT 4
 167 #endif
 168 #if !defined (N_DATA)
 169 #define N_DATA 6
 170 #endif
 171 #if !defined (N_BSS)
 172 #define N_BSS 8
 173 #endif
 174 #if !defined (N_FN)
 175 #define N_FN 15
 176 #endif
 177 
 178 #if !defined (N_EXT)
 179 #define N_EXT 1
 180 #endif
 181 #if !defined (N_TYPE)
 182 #define N_TYPE 036
 183 #endif
 184 #if !defined (N_STAB)
 185 #define N_STAB 0340
 186 #endif
 187 
 188 
 189 
 190 
 191 
 192 
 193 
 194 
 195 
 196 #define N_INDR 0xa
 197 
 198 
 199 
 200 
 201 
 202 
 203 
 204 
 205 
 206 
 207 
 208 
 209 
 210 #define N_SETA  0x14            
 211 #define N_SETT  0x16            
 212 #define N_SETD  0x18            
 213 #define N_SETB  0x1A            
 214 
 215 
 216 #define N_SETV  0x1C            
 217 
 218 #if !defined (N_RELOCATION_INFO_DECLARED)
 219 
 220 
 221 
 222 
 223 
 224 struct relocation_info
 225 {
 226   
 227   int r_address;
 228   
 229   unsigned int r_symbolnum:24;
 230   
 231 
 232 
 233   unsigned int r_pcrel:1;
 234   
 235 
 236   unsigned int r_length:2;
 237   
 238 
 239 
 240 
 241 
 242 
 243   unsigned int r_extern:1;
 244   
 245 
 246   unsigned int r_pad:4;
 247 };
 248 #endif 
 249 
 250 #endif 
 251 #endif