0001
0002 #ifndef _UAPI__A_OUT_GNU_H__
0003 #define _UAPI__A_OUT_GNU_H__
0004
0005 #define __GNU_EXEC_MACROS__
0006
0007 #ifndef __STRUCT_EXEC_OVERRIDE__
0008
0009 #include <asm/a.out.h>
0010
0011 #endif
0012
0013 #ifndef __ASSEMBLY__
0014
0015
0016 enum machine_type {
0017 #if defined (M_OLDSUN2)
0018 M__OLDSUN2 = M_OLDSUN2,
0019 #else
0020 M_OLDSUN2 = 0,
0021 #endif
0022 #if defined (M_68010)
0023 M__68010 = M_68010,
0024 #else
0025 M_68010 = 1,
0026 #endif
0027 #if defined (M_68020)
0028 M__68020 = M_68020,
0029 #else
0030 M_68020 = 2,
0031 #endif
0032 #if defined (M_SPARC)
0033 M__SPARC = M_SPARC,
0034 #else
0035 M_SPARC = 3,
0036 #endif
0037
0038 M_386 = 100,
0039 M_MIPS1 = 151,
0040 M_MIPS2 = 152
0041 };
0042
0043 #if !defined (N_MAGIC)
0044 #define N_MAGIC(exec) ((exec).a_info & 0xffff)
0045 #endif
0046 #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
0047 #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
0048 #define N_SET_INFO(exec, magic, type, flags) \
0049 ((exec).a_info = ((magic) & 0xffff) \
0050 | (((int)(type) & 0xff) << 16) \
0051 | (((flags) & 0xff) << 24))
0052 #define N_SET_MAGIC(exec, magic) \
0053 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
0054
0055 #define N_SET_MACHTYPE(exec, machtype) \
0056 ((exec).a_info = \
0057 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
0058
0059 #define N_SET_FLAGS(exec, flags) \
0060 ((exec).a_info = \
0061 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
0062
0063
0064 #define OMAGIC 0407
0065
0066 #define NMAGIC 0410
0067
0068 #define ZMAGIC 0413
0069
0070
0071 #define QMAGIC 0314
0072
0073
0074 #define CMAGIC 0421
0075
0076 #if !defined (N_BADMAG)
0077 #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
0078 && N_MAGIC(x) != NMAGIC \
0079 && N_MAGIC(x) != ZMAGIC \
0080 && N_MAGIC(x) != QMAGIC)
0081 #endif
0082
0083 #define _N_HDROFF(x) (1024 - sizeof (struct exec))
0084
0085 #if !defined (N_TXTOFF)
0086 #define N_TXTOFF(x) \
0087 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
0088 (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
0089 #endif
0090
0091 #if !defined (N_DATOFF)
0092 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
0093 #endif
0094
0095 #if !defined (N_TRELOFF)
0096 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
0097 #endif
0098
0099 #if !defined (N_DRELOFF)
0100 #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
0101 #endif
0102
0103 #if !defined (N_SYMOFF)
0104 #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
0105 #endif
0106
0107 #if !defined (N_STROFF)
0108 #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
0109 #endif
0110
0111
0112 #if !defined (N_TXTADDR)
0113 #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
0114 #endif
0115
0116
0117 #ifndef __KERNEL__
0118 #include <unistd.h>
0119 #endif
0120 #if defined(__i386__) || defined(__mc68000__)
0121 #define SEGMENT_SIZE 1024
0122 #else
0123 #ifndef SEGMENT_SIZE
0124 #ifndef __KERNEL__
0125 #define SEGMENT_SIZE getpagesize()
0126 #endif
0127 #endif
0128 #endif
0129
0130 #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
0131
0132 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
0133
0134 #ifndef N_DATADDR
0135 #define N_DATADDR(x) \
0136 (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
0137 : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
0138 #endif
0139
0140
0141 #if !defined (N_BSSADDR)
0142 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
0143 #endif
0144
0145 #if !defined (N_NLIST_DECLARED)
0146 struct nlist {
0147 union {
0148 char *n_name;
0149 struct nlist *n_next;
0150 long n_strx;
0151 } n_un;
0152 unsigned char n_type;
0153 char n_other;
0154 short n_desc;
0155 unsigned long n_value;
0156 };
0157 #endif
0158
0159 #if !defined (N_UNDF)
0160 #define N_UNDF 0
0161 #endif
0162 #if !defined (N_ABS)
0163 #define N_ABS 2
0164 #endif
0165 #if !defined (N_TEXT)
0166 #define N_TEXT 4
0167 #endif
0168 #if !defined (N_DATA)
0169 #define N_DATA 6
0170 #endif
0171 #if !defined (N_BSS)
0172 #define N_BSS 8
0173 #endif
0174 #if !defined (N_FN)
0175 #define N_FN 15
0176 #endif
0177
0178 #if !defined (N_EXT)
0179 #define N_EXT 1
0180 #endif
0181 #if !defined (N_TYPE)
0182 #define N_TYPE 036
0183 #endif
0184 #if !defined (N_STAB)
0185 #define N_STAB 0340
0186 #endif
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196 #define N_INDR 0xa
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210 #define N_SETA 0x14
0211 #define N_SETT 0x16
0212 #define N_SETD 0x18
0213 #define N_SETB 0x1A
0214
0215
0216 #define N_SETV 0x1C
0217
0218 #if !defined (N_RELOCATION_INFO_DECLARED)
0219
0220
0221
0222
0223
0224 struct relocation_info
0225 {
0226
0227 int r_address;
0228
0229 unsigned int r_symbolnum:24;
0230
0231
0232
0233 unsigned int r_pcrel:1;
0234
0235
0236 unsigned int r_length:2;
0237
0238
0239
0240
0241
0242
0243 unsigned int r_extern:1;
0244
0245
0246 unsigned int r_pad:4;
0247 };
0248 #endif
0249
0250 #endif
0251 #endif