xref: /original-bsd/sys/pmax/include/exec.h (revision 99c3aed0)
18d6e97d5Sbostic /*-
2*99c3aed0Sbostic  * Copyright (c) 1992, 1993
3*99c3aed0Sbostic  *	The Regents of the University of California.  All rights reserved.
48d6e97d5Sbostic  *
58d6e97d5Sbostic  * %sccs.include.redist.c%
68d6e97d5Sbostic  *
7*99c3aed0Sbostic  *	@(#)exec.h	8.1 (Berkeley) 06/10/93
88d6e97d5Sbostic  */
98d6e97d5Sbostic 
10438bd6e8Sralph #include <machine/endian.h>
118d6e97d5Sbostic 
128d6e97d5Sbostic /* Size of a page in an object file. */
138d6e97d5Sbostic #define	__LDPGSZ	4096
148d6e97d5Sbostic 
158d6e97d5Sbostic /* Valid magic number check. */
168d6e97d5Sbostic #define	N_BADMAG(ex) \
178d6e97d5Sbostic 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
188d6e97d5Sbostic 	    (ex).a_magic != ZMAGIC)
198d6e97d5Sbostic 
208d6e97d5Sbostic /* Address of the bottom of the text segment. */
21438bd6e8Sralph #define N_TXTADDR(X)	__LDPGSZ
228d6e97d5Sbostic 
238d6e97d5Sbostic /* Address of the bottom of the data segment. */
24438bd6e8Sralph #define N_DATADDR(ex) \
25438bd6e8Sralph 	(N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
26438bd6e8Sralph 	: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
278d6e97d5Sbostic 
288d6e97d5Sbostic /* Text segment offset. */
298d6e97d5Sbostic #define	N_TXTOFF(ex) \
30438bd6e8Sralph 	((ex).a_magic == ZMAGIC ? 0 : sizeof(struct exec))
318d6e97d5Sbostic 
328d6e97d5Sbostic /* Data segment offset. */
330a6b785fSralph #define	N_DATOFF(ex) \
34438bd6e8Sralph 	(N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
35438bd6e8Sralph 	__LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
368d6e97d5Sbostic 
378d6e97d5Sbostic /* Symbol table offset. */
38438bd6e8Sralph #define N_SYMOFF(ex) \
39438bd6e8Sralph 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
40438bd6e8Sralph 	    (ex).a_drsize)
418d6e97d5Sbostic 
428d6e97d5Sbostic /* String table offset. */
43438bd6e8Sralph #define	N_STROFF(ex) 	(N_SYMOFF(ex) + (ex).a_syms)
448d6e97d5Sbostic 
45438bd6e8Sralph /* Description of the object file header (a.out format). */
46438bd6e8Sralph struct exec {
47438bd6e8Sralph #if BYTE_ORDER == BIG_ENDIAN
48438bd6e8Sralph 	u_short	a_mid;		/* machine ID */
49438bd6e8Sralph 	u_short	a_magic;	/* magic number */
50438bd6e8Sralph #else
51438bd6e8Sralph 	u_short	a_magic;	/* magic number */
52438bd6e8Sralph 	u_short	a_mid;		/* machine ID */
53438bd6e8Sralph #endif
548d6e97d5Sbostic 
55438bd6e8Sralph 	u_long	a_text;		/* text segment size */
56438bd6e8Sralph 	u_long	a_data;		/* initialized data size */
57438bd6e8Sralph 	u_long	a_bss;		/* uninitialized data size */
58438bd6e8Sralph 	u_long	a_syms;		/* symbol table size */
59438bd6e8Sralph 	u_long	a_entry;	/* entry point */
60438bd6e8Sralph 	u_long	a_trsize;	/* text relocation size */
61438bd6e8Sralph 	u_long	a_drsize;	/* data relocation size */
62438bd6e8Sralph };
638d6e97d5Sbostic 
64438bd6e8Sralph #define	a_machtype	a_mid	/* SUN compatibility */
658d6e97d5Sbostic 
66438bd6e8Sralph #define	MID_ZERO	0	/* unknown - implementation dependent */
67438bd6e8Sralph #define	MID_SUN010	1	/* sun 68010/68020 binary */
68438bd6e8Sralph #define	MID_SUN020	2	/* sun 68020-only binary */
69438bd6e8Sralph #define	MID_SUN_SPARC	3	/* sparc binary */
70438bd6e8Sralph #define	MID_386		100	/* Intel 80386 binary */
71438bd6e8Sralph #define	MID_29K		101	/* AMD 29000 binary */
72438bd6e8Sralph #define	MID_MIPSI	151	/* MIPS R2000/R3000 binary */
73438bd6e8Sralph #define	MID_MIPSII	152	/* MIPS R4000 binary */
74438bd6e8Sralph #define	MID_HP200	200	/* hp200 (68010) BSD binary */
75438bd6e8Sralph #define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
76438bd6e8Sralph #define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
77438bd6e8Sralph #define	MID_HPUX800	0x20B	/* hp800 HP-UX binary */
78438bd6e8Sralph 
798d6e97d5Sbostic #define	OMAGIC	0407		/* old impure format */
808d6e97d5Sbostic #define	NMAGIC	0410		/* read-only text */
818d6e97d5Sbostic #define	ZMAGIC	0413		/* demand load format */
82