|
1 |
| -/* $OpenBSD: exec.h,v 1.54 2024/04/02 08:39:16 deraadt Exp $ */ |
| 1 | +/* $OpenBSD: exec.h,v 1.55 2024/10/16 18:47:48 miod Exp $ */ |
2 | 2 | /* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */
|
3 | 3 |
|
4 | 4 | /*-
|
@@ -222,38 +222,6 @@ extern int stackgap_random;
|
222 | 222 |
|
223 | 223 | #endif /* _KERNEL */
|
224 | 224 |
|
225 |
| -#ifndef N_PAGSIZ |
226 |
| -#define N_PAGSIZ(ex) (__LDPGSZ) |
227 |
| -#endif |
228 |
| - |
229 |
| -/* |
230 |
| - * Legacy a.out structures and defines; start deleting these when |
231 |
| - * external use no longer exist. |
232 |
| - */ |
233 |
| - |
234 |
| - |
235 |
| -/* |
236 |
| - * Header prepended to each a.out file. |
237 |
| - * only manipulate the a_midmag field via the |
238 |
| - * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros below. |
239 |
| - */ |
240 |
| -struct exec { |
241 |
| - u_int32_t a_midmag; /* htonl(flags<<26|mid<<16|magic) */ |
242 |
| - u_int32_t a_text; /* text segment size */ |
243 |
| - u_int32_t a_data; /* initialized data size */ |
244 |
| - u_int32_t a_bss; /* uninitialized data size */ |
245 |
| - u_int32_t a_syms; /* symbol table size */ |
246 |
| - u_int32_t a_entry; /* entry point */ |
247 |
| - u_int32_t a_trsize; /* text relocation size */ |
248 |
| - u_int32_t a_drsize; /* data relocation size */ |
249 |
| -}; |
250 |
| - |
251 |
| -/* a_magic */ |
252 |
| -#define OMAGIC 0407 /* old impure format */ |
253 |
| -#define NMAGIC 0410 /* read-only text */ |
254 |
| -#define ZMAGIC 0413 /* demand load format */ |
255 |
| -#define QMAGIC 0314 /* "compact" demand load format; deprecated */ |
256 |
| - |
257 | 225 | /*
|
258 | 226 | * a_mid - keep sorted in numerical order for sanity's sake
|
259 | 227 | * ensure that: 0 < mid < 0x3ff
|
@@ -292,92 +260,6 @@ struct exec {
|
292 | 260 | #define MID_HPPA11 0x210 /* hp700 HP-UX binary pa1.1 */
|
293 | 261 | #define MID_HPPA20 0x214 /* hp700 HP-UX binary pa2.0 */
|
294 | 262 |
|
295 |
| -/* |
296 |
| - * a_flags |
297 |
| - */ |
298 |
| -#define EX_DYNAMIC 0x20 |
299 |
| -#define EX_PIC 0x10 |
300 |
| -#define EX_DPMASK 0x30 |
301 |
| -/* |
302 |
| - * Interpretation of the (a_flags & EX_DPMASK) bits: |
303 |
| - * |
304 |
| - * 00 traditional executable or object file |
305 |
| - * 01 object file contains PIC code (set by `as -k') |
306 |
| - * 10 dynamic executable |
307 |
| - * 11 position independent executable image |
308 |
| - * (eg. a shared library) |
309 |
| - * |
310 |
| - */ |
311 |
| - |
312 |
| -/* |
313 |
| - * The a.out structure's a_midmag field is a network-byteorder encoding |
314 |
| - * of this int |
315 |
| - * FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM |
316 |
| - * Where `F' is 6 bits of flag like EX_DYNAMIC, |
317 |
| - * `m' is 10 bits of machine-id like MID_I386, and |
318 |
| - * `M' is 16 bits worth of magic number, ie. ZMAGIC. |
319 |
| - * The macros below will set/get the needed fields. |
320 |
| - */ |
321 |
| -#define N_GETMAGIC(ex) \ |
322 |
| - ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : ((ex).a_midmag)) |
323 |
| -#define N_GETMAGIC2(ex) \ |
324 |
| - ( (((ex).a_midmag)&0xffff0000) ? (ntohl(((ex).a_midmag))&0xffff) : \ |
325 |
| - (((ex).a_midmag) | 0x10000) ) |
326 |
| -#define N_GETMID(ex) \ |
327 |
| - ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>16)&0x03ff) : MID_ZERO ) |
328 |
| -#define N_GETFLAG(ex) \ |
329 |
| - ( (((ex).a_midmag)&0xffff0000) ? ((ntohl(((ex).a_midmag))>>26)&0x3f) : 0 ) |
330 |
| -#define N_SETMAGIC(ex,mag,mid,flag) \ |
331 |
| - ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ |
332 |
| - (((mag)&0xffff)) ) ) |
333 |
| - |
334 |
| -#define N_ALIGN(ex,x) \ |
335 |
| - (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC ? \ |
336 |
| - ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x)) |
337 |
| - |
338 |
| -/* Valid magic number check. */ |
339 |
| -#define N_BADMAG(ex) \ |
340 |
| - (N_GETMAGIC(ex) != NMAGIC && N_GETMAGIC(ex) != OMAGIC && \ |
341 |
| - N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC) |
342 |
| - |
343 |
| -/* Address of the bottom of the text segment. */ |
344 |
| -#define N_TXTADDR(ex) (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ) |
345 |
| - |
346 |
| -/* Address of the bottom of the data segment. */ |
347 |
| -#define N_DATADDR(ex) \ |
348 |
| - (N_GETMAGIC(ex) == OMAGIC ? N_TXTADDR(ex) + (ex).a_text : \ |
349 |
| - (N_TXTADDR(ex) + (ex).a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1)) |
350 |
| - |
351 |
| -/* Address of the bottom of the bss segment. */ |
352 |
| -#define N_BSSADDR(ex) \ |
353 |
| - (N_DATADDR(ex) + (ex).a_data) |
354 |
| - |
355 |
| -/* Text segment offset. */ |
356 |
| -#define N_TXTOFF(ex) \ |
357 |
| - ( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \ |
358 |
| - 0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : \ |
359 |
| - sizeof(struct exec)) ) |
360 |
| - |
361 |
| -/* Data segment offset. */ |
362 |
| -#define N_DATOFF(ex) \ |
363 |
| - N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) |
364 |
| - |
365 |
| -/* Text relocation table offset. */ |
366 |
| -#define N_TRELOFF(ex) \ |
367 |
| - (N_DATOFF(ex) + (ex).a_data) |
368 |
| - |
369 |
| -/* Data relocation table offset. */ |
370 |
| -#define N_DRELOFF(ex) \ |
371 |
| - (N_TRELOFF(ex) + (ex).a_trsize) |
372 |
| - |
373 |
| -/* Symbol table offset. */ |
374 |
| -#define N_SYMOFF(ex) \ |
375 |
| - (N_DRELOFF(ex) + (ex).a_drsize) |
376 |
| - |
377 |
| -/* String table offset. */ |
378 |
| -#define N_STROFF(ex) \ |
379 |
| - (N_SYMOFF(ex) + (ex).a_syms) |
380 |
| - |
381 | 263 | #include <machine/exec.h>
|
382 | 264 |
|
383 | 265 | #endif /* !_SYS_EXEC_H_ */
|
0 commit comments