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