xref: /csrg-svn/sys/hp300/include/exec.h (revision 63160)
153005Sbostic /*-
2*63160Sbostic  * Copyright (c) 1992, 1993
3*63160Sbostic  *	The Regents of the University of California.  All rights reserved.
453005Sbostic  *
553005Sbostic  * %sccs.include.redist.c%
653005Sbostic  *
7*63160Sbostic  *	@(#)exec.h	8.1 (Berkeley) 06/10/93
853005Sbostic  */
953005Sbostic 
1053005Sbostic /* Size of a page in an object file. */
1153005Sbostic #define	__LDPGSZ	4096
1253005Sbostic 
1353005Sbostic /* Valid magic number check. */
1453005Sbostic #define	N_BADMAG(ex) \
1553005Sbostic 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
1653005Sbostic 	    (ex).a_magic != ZMAGIC)
1753005Sbostic 
1853005Sbostic /* Address of the bottom of the text segment. */
1953005Sbostic #define N_TXTADDR(X)	0
2053005Sbostic 
2153005Sbostic /* Address of the bottom of the data segment. */
2253005Sbostic #define N_DATADDR(ex) \
2353005Sbostic 	(N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \
2453005Sbostic 	: __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
2553005Sbostic 
2653005Sbostic /* Text segment offset. */
2753005Sbostic #define	N_TXTOFF(ex) \
2853005Sbostic 	((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec))
2953005Sbostic 
3053005Sbostic /* Data segment offset. */
3153005Sbostic #define	N_DATOFF(ex) \
3253005Sbostic 	(N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \
3353005Sbostic 	__LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1))))
3453005Sbostic 
3553005Sbostic /* Symbol table offset. */
3653005Sbostic #define N_SYMOFF(ex) \
3753005Sbostic 	(N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \
3853005Sbostic 	    (ex).a_drsize)
3953005Sbostic 
4053005Sbostic /* String table offset. */
4153005Sbostic #define	N_STROFF(ex) 	(N_SYMOFF(ex) + (ex).a_syms)
4253005Sbostic 
4353005Sbostic /* Description of the object file header (a.out format). */
4453005Sbostic struct exec {
4553005Sbostic #define	MID_ZERO	0	/* unknown - implementation dependent */
4653005Sbostic #define	MID_SUN010	1	/* sun 68010/68020 binary */
4753005Sbostic #define	MID_SUN020	2	/* sun 68020-only binary */
4853005Sbostic #define	MID_SUN_SPARC	3	/* sparc binary */
4953005Sbostic #define	MID_HP200	200	/* hp200 (68010) BSD binary */
5053005Sbostic #define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
5153005Sbostic #define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
5253005Sbostic #define	MID_HPUX800     0x20B   /* hp800 HP-UX binary */
5353005Sbostic 	u_short	a_mid;		/* machine ID */
5453005Sbostic 
5553005Sbostic #define	OMAGIC	0407		/* old impure format */
5653005Sbostic #define	NMAGIC	0410		/* read-only text */
5753005Sbostic #define	ZMAGIC	0413		/* demand load format */
5853005Sbostic 	u_short	a_magic;	/* magic number */
5953005Sbostic 
6053005Sbostic 	u_long	a_text;		/* text segment size */
6153005Sbostic 	u_long	a_data;		/* initialized data size */
6253005Sbostic 	u_long	a_bss;		/* uninitialized data size */
6353005Sbostic 	u_long	a_syms;		/* symbol table size */
6453005Sbostic 	u_long	a_entry;	/* entry point */
6553005Sbostic 	u_long	a_trsize;	/* text relocation size */
6653005Sbostic 	u_long	a_drsize;	/* data relocation size */
6753005Sbostic };
6853005Sbostic #define	a_machtype	a_mid	/* SUN compatibility */
69