xref: /original-bsd/sys/pmax/include/exec.h (revision 3705696b)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)exec.h	8.1 (Berkeley) 06/10/93
8  */
9 
10 #include <machine/endian.h>
11 
12 /* Size of a page in an object file. */
13 #define	__LDPGSZ	4096
14 
15 /* Valid magic number check. */
16 #define	N_BADMAG(ex) \
17 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
18 	    (ex).a_magic != ZMAGIC)
19 
20 /* Address of the bottom of the text segment. */
21 #define N_TXTADDR(X)	__LDPGSZ
22 
23 /* Address of the bottom of the data segment. */
24 #define N_DATADDR(ex) \
25 	(N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
26 	: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
27 
28 /* Text segment offset. */
29 #define	N_TXTOFF(ex) \
30 	((ex).a_magic == ZMAGIC ? 0 : sizeof(struct exec))
31 
32 /* Data segment offset. */
33 #define	N_DATOFF(ex) \
34 	(N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
35 	__LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
36 
37 /* Symbol table offset. */
38 #define N_SYMOFF(ex) \
39 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
40 	    (ex).a_drsize)
41 
42 /* String table offset. */
43 #define	N_STROFF(ex) 	(N_SYMOFF(ex) + (ex).a_syms)
44 
45 /* Description of the object file header (a.out format). */
46 struct exec {
47 #if BYTE_ORDER == BIG_ENDIAN
48 	u_short	a_mid;		/* machine ID */
49 	u_short	a_magic;	/* magic number */
50 #else
51 	u_short	a_magic;	/* magic number */
52 	u_short	a_mid;		/* machine ID */
53 #endif
54 
55 	u_long	a_text;		/* text segment size */
56 	u_long	a_data;		/* initialized data size */
57 	u_long	a_bss;		/* uninitialized data size */
58 	u_long	a_syms;		/* symbol table size */
59 	u_long	a_entry;	/* entry point */
60 	u_long	a_trsize;	/* text relocation size */
61 	u_long	a_drsize;	/* data relocation size */
62 };
63 
64 #define	a_machtype	a_mid	/* SUN compatibility */
65 
66 #define	MID_ZERO	0	/* unknown - implementation dependent */
67 #define	MID_SUN010	1	/* sun 68010/68020 binary */
68 #define	MID_SUN020	2	/* sun 68020-only binary */
69 #define	MID_SUN_SPARC	3	/* sparc binary */
70 #define	MID_386		100	/* Intel 80386 binary */
71 #define	MID_29K		101	/* AMD 29000 binary */
72 #define	MID_MIPSI	151	/* MIPS R2000/R3000 binary */
73 #define	MID_MIPSII	152	/* MIPS R4000 binary */
74 #define	MID_HP200	200	/* hp200 (68010) BSD binary */
75 #define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
76 #define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
77 #define	MID_HPUX800	0x20B	/* hp800 HP-UX binary */
78 
79 #define	OMAGIC	0407		/* old impure format */
80 #define	NMAGIC	0410		/* read-only text */
81 #define	ZMAGIC	0413		/* demand load format */
82