xref: /csrg-svn/sys/pmax/include/exec.h (revision 57867)
153006Sbostic /*-
253006Sbostic  * Copyright (c) 1992 The Regents of the University of California.
353006Sbostic  * All rights reserved.
453006Sbostic  *
553006Sbostic  * %sccs.include.redist.c%
653006Sbostic  *
7*57867Sralph  *	@(#)exec.h	7.3 (Berkeley) 02/04/93
853006Sbostic  */
953006Sbostic 
10*57867Sralph #include <machine/endian.h>
1153006Sbostic 
1253006Sbostic /* Size of a page in an object file. */
1353006Sbostic #define	__LDPGSZ	4096
1453006Sbostic 
1553006Sbostic /* Valid magic number check. */
1653006Sbostic #define	N_BADMAG(ex) \
1753006Sbostic 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
1853006Sbostic 	    (ex).a_magic != ZMAGIC)
1953006Sbostic 
2053006Sbostic /* Address of the bottom of the text segment. */
21*57867Sralph #define N_TXTADDR(X)	__LDPGSZ
2253006Sbostic 
2353006Sbostic /* Address of the bottom of the data segment. */
24*57867Sralph #define N_DATADDR(ex) \
25*57867Sralph 	(N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
26*57867Sralph 	: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
2753006Sbostic 
2853006Sbostic /* Text segment offset. */
2953006Sbostic #define	N_TXTOFF(ex) \
30*57867Sralph 	((ex).a_magic == ZMAGIC ? 0 : sizeof(struct exec))
3153006Sbostic 
3253006Sbostic /* Data segment offset. */
33*57867Sralph #define	N_DATOFF(ex) \
34*57867Sralph 	(N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
35*57867Sralph 	__LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
3653006Sbostic 
3753006Sbostic /* Symbol table offset. */
38*57867Sralph #define N_SYMOFF(ex) \
39*57867Sralph 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
40*57867Sralph 	    (ex).a_drsize)
4153006Sbostic 
4253006Sbostic /* String table offset. */
43*57867Sralph #define	N_STROFF(ex) 	(N_SYMOFF(ex) + (ex).a_syms)
4453006Sbostic 
45*57867Sralph /* Description of the object file header (a.out format). */
46*57867Sralph struct exec {
47*57867Sralph #if BYTE_ORDER == BIG_ENDIAN
48*57867Sralph 	u_short	a_mid;		/* machine ID */
49*57867Sralph 	u_short	a_magic;	/* magic number */
50*57867Sralph #else
51*57867Sralph 	u_short	a_magic;	/* magic number */
52*57867Sralph 	u_short	a_mid;		/* machine ID */
53*57867Sralph #endif
5453006Sbostic 
55*57867Sralph 	u_long	a_text;		/* text segment size */
56*57867Sralph 	u_long	a_data;		/* initialized data size */
57*57867Sralph 	u_long	a_bss;		/* uninitialized data size */
58*57867Sralph 	u_long	a_syms;		/* symbol table size */
59*57867Sralph 	u_long	a_entry;	/* entry point */
60*57867Sralph 	u_long	a_trsize;	/* text relocation size */
61*57867Sralph 	u_long	a_drsize;	/* data relocation size */
62*57867Sralph };
6353006Sbostic 
64*57867Sralph #define	a_machtype	a_mid	/* SUN compatibility */
6553006Sbostic 
66*57867Sralph #define	MID_ZERO	0	/* unknown - implementation dependent */
67*57867Sralph #define	MID_SUN010	1	/* sun 68010/68020 binary */
68*57867Sralph #define	MID_SUN020	2	/* sun 68020-only binary */
69*57867Sralph #define	MID_SUN_SPARC	3	/* sparc binary */
70*57867Sralph #define	MID_386		100	/* Intel 80386 binary */
71*57867Sralph #define	MID_29K		101	/* AMD 29000 binary */
72*57867Sralph #define	MID_MIPSI	151	/* MIPS R2000/R3000 binary */
73*57867Sralph #define	MID_MIPSII	152	/* MIPS R4000 binary */
74*57867Sralph #define	MID_HP200	200	/* hp200 (68010) BSD binary */
75*57867Sralph #define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
76*57867Sralph #define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
77*57867Sralph #define	MID_HPUX800	0x20B	/* hp800 HP-UX binary */
78*57867Sralph 
7953006Sbostic #define	OMAGIC	0407		/* old impure format */
8053006Sbostic #define	NMAGIC	0410		/* read-only text */
8153006Sbostic #define	ZMAGIC	0413		/* demand load format */
82