xref: /csrg-svn/sys/hp300/include/exec.h (revision 53005)
1*53005Sbostic /*-
2*53005Sbostic  * Copyright (c) 1992 The Regents of the University of California.
3*53005Sbostic  * All rights reserved.
4*53005Sbostic  *
5*53005Sbostic  * %sccs.include.redist.c%
6*53005Sbostic  *
7*53005Sbostic  *	@(#)exec.h	7.1 (Berkeley) 03/18/92
8*53005Sbostic  */
9*53005Sbostic 
10*53005Sbostic /* Size of a page in an object file. */
11*53005Sbostic #define	__LDPGSZ	4096
12*53005Sbostic 
13*53005Sbostic /* Valid magic number check. */
14*53005Sbostic #define	N_BADMAG(ex) \
15*53005Sbostic 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
16*53005Sbostic 	    (ex).a_magic != ZMAGIC)
17*53005Sbostic 
18*53005Sbostic /* Address of the bottom of the text segment. */
19*53005Sbostic #define N_TXTADDR(X)	0
20*53005Sbostic 
21*53005Sbostic /* Address of the bottom of the data segment. */
22*53005Sbostic #define N_DATADDR(ex) \
23*53005Sbostic 	(N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
24*53005Sbostic 	: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
25*53005Sbostic 
26*53005Sbostic /* Text segment offset. */
27*53005Sbostic #define	N_TXTOFF(ex) \
28*53005Sbostic 	((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
29*53005Sbostic 
30*53005Sbostic /* Data segment offset. */
31*53005Sbostic #define	N_DATOFF(ex) \
32*53005Sbostic 	(N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
33*53005Sbostic 	__LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
34*53005Sbostic 
35*53005Sbostic /* Symbol table offset. */
36*53005Sbostic #define N_SYMOFF(ex) \
37*53005Sbostic 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
38*53005Sbostic 	    (ex).a_drsize)
39*53005Sbostic 
40*53005Sbostic /* String table offset. */
41*53005Sbostic #define	N_STROFF(ex) 	(N_SYMOFF(ex) + (ex).a_syms)
42*53005Sbostic 
43*53005Sbostic /* Description of the object file header (a.out format). */
44*53005Sbostic struct exec {
45*53005Sbostic #define	MID_ZERO	0	/* unknown - implementation dependent */
46*53005Sbostic #define	MID_SUN010	1	/* sun 68010/68020 binary */
47*53005Sbostic #define	MID_SUN020	2	/* sun 68020-only binary */
48*53005Sbostic #define	MID_SUN_SPARC	3	/* sparc binary */
49*53005Sbostic #define	MID_HP200	200	/* hp200 (68010) BSD binary */
50*53005Sbostic #define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
51*53005Sbostic #define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
52*53005Sbostic #define	MID_HPUX800     0x20B   /* hp800 HP-UX binary */
53*53005Sbostic 	u_short	a_mid;		/* machine ID */
54*53005Sbostic 
55*53005Sbostic #define	OMAGIC	0407		/* old impure format */
56*53005Sbostic #define	NMAGIC	0410		/* read-only text */
57*53005Sbostic #define	ZMAGIC	0413		/* demand load format */
58*53005Sbostic 	u_short	a_magic;	/* magic number */
59*53005Sbostic 
60*53005Sbostic 	u_long	a_text;		/* text segment size */
61*53005Sbostic 	u_long	a_data;		/* initialized data size */
62*53005Sbostic 	u_long	a_bss;		/* uninitialized data size */
63*53005Sbostic 	u_long	a_syms;		/* symbol table size */
64*53005Sbostic 	u_long	a_entry;	/* entry point */
65*53005Sbostic 	u_long	a_trsize;	/* text relocation size */
66*53005Sbostic 	u_long	a_drsize;	/* data relocation size */
67*53005Sbostic };
68*53005Sbostic #define	a_machtype	a_mid	/* SUN compatibility */
69