xref: /csrg-svn/sys/pmax/ultrix/exec.h (revision 63230)
160310Sralph /*-
2*63230Sbostic  * Copyright (c) 1992, 1993
3*63230Sbostic  *	The Regents of the University of California.  All rights reserved.
460310Sralph  *
560310Sralph  * %sccs.include.redist.c%
660310Sralph  *
7*63230Sbostic  *	@(#)exec.h	8.1 (Berkeley) 06/10/93
860310Sralph  */
960310Sralph 
1060310Sralph /*
1160310Sralph  * Portions of this file are subject to the following copyright notice:
1260310Sralph  *
1360310Sralph  * Copyright (C) 1989 Digital Equipment Corporation.
1460310Sralph  * Permission to use, copy, modify, and distribute this software and
1560310Sralph  * its documentation for any purpose and without fee is hereby granted,
1660310Sralph  * provided that the above copyright notice appears in all copies.
1760310Sralph  * Digital Equipment Corporation makes no representations about the
1860310Sralph  * suitability of this software for any purpose.  It is provided "as is"
1960310Sralph  * without express or implied warranty.
2060310Sralph  */
2160310Sralph 
2260310Sralph /*
2360310Sralph  * /sprite/src/kernel/proc/ds3100.md/RCS/procMach.h,v 9.3 90/02/20 15:35:50
2460310Sralph  * shirriff Exp $ SPRITE (Berkeley)
2560310Sralph  */
2660310Sralph 
2760310Sralph /* Size of a page in an object file. */
2860310Sralph #define	__LDPGSZ	4096
2960310Sralph 
3060310Sralph /* Valid magic number check. */
3160310Sralph #define	N_BADMAG(ex) \
3260310Sralph 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
3360310Sralph 	    (ex).a_magic != ZMAGIC)
3460310Sralph 
3560310Sralph /* Address of the bottom of the text segment. */
3660310Sralph #define N_TXTADDR(ex)	0x400000
3760310Sralph 
3860310Sralph /* Address of the bottom of the data segment. */
3960310Sralph /* NOT DEFINED FOR THE MIPS. */
4060310Sralph 
4160310Sralph /* Text segment offset. */
4260310Sralph #define	__N_TXTOFF_ROUND(ex) \
4360310Sralph 	((ex).ex_aout.verStamp < 23 ? 7 : 15)
4460310Sralph #define	N_TXTOFF(ex) \
4560310Sralph 	((ex).ex_aout.magic == ZMAGIC ? 0 : (sizeof(struct exec) + \
4660310Sralph 	    (ex).ex_fhdr.numSections * sizeof(ProcSectionHeader) + \
4760310Sralph 	    __N_TXTOFF_ROUND(ex)) & ~__N_TXTOFF_ROUND(ex))
4860310Sralph 
4960310Sralph /* Data segment offset. */
5060310Sralph #define N_DATOFF(ex) \
5160310Sralph 	(N_TXTOFF(ex) + (ex).ex_aout.codeSize)
5260310Sralph 
5360310Sralph /* Symbol table offset. */
5460310Sralph /* NOT DEFINED FOR THE MIPS. */
5560310Sralph 
5660310Sralph /* String table offset. */
5760310Sralph /* NOT DEFINED FOR THE MIPS. */
5860310Sralph 
5960310Sralph /*
6060310Sralph  * XXX
6160310Sralph  * The ProcFileHeader structure and the ProcAOUTHeader structure should be
6260310Sralph  * folded together into a single struct exec.
6360310Sralph  */
6460310Sralph 
6560310Sralph /* Description of the COFF section. */
6660310Sralph typedef struct {
6760310Sralph #define	COFF_MAGIC	0x0162
6860310Sralph 	u_short	magic;		/* The magic number. */
6960310Sralph 
7060310Sralph 	u_short	numSections;	/* The number of sections. */
7160310Sralph 	long	timeDateStamp;	/* Time and date stamp. */
7260310Sralph 	long	symPtr;		/* File pointer to symbolic header. */
7360310Sralph 	long	numSyms;	/* Size of symbolic header. */
7460310Sralph 	u_short	optHeader;	/* Size of optional header. */
7560310Sralph 	u_short	flags;		/* Flags. */
7660310Sralph } ProcFileHeader;
7760310Sralph 
7860310Sralph /* Description of the a.out section. */
7960310Sralph typedef struct {
8060310Sralph #define	OMAGIC	0407		/* old impure format */
8160310Sralph #define	NMAGIC	0410		/* read-only text */
8260310Sralph #define	ZMAGIC	0413		/* demand load format */
8360310Sralph 	short	magic;		/* Magic number. */
8460310Sralph 
8560310Sralph 	short	verStamp;	/* Version stamp. */
8660310Sralph 	long	codeSize;	/* Code size in bytes. */
8760310Sralph 	long	heapSize;	/* Initialized data size in bytes. */
8860310Sralph 	long	bssSize;	/* Uninitialized data size in bytes. */
8960310Sralph 	long	entry;		/* Entry point. */
9060310Sralph 	long	codeStart;	/* Base of code used for this file. */
9160310Sralph 	long	heapStart;	/* Base of heap used for this file. */
9260310Sralph 	long	bssStart;	/* Base of bss used for this file. */
9360310Sralph 	long	gprMask;	/* General purpose register mask. */
9460310Sralph 	long	cprMask[4];	/* Co-processor register masks. */
9560310Sralph 	long	gpValue;	/* The gp value for this object. */
9660310Sralph } ProcAOUTHeader;
9760310Sralph 
9860310Sralph /* Section header. */
9960310Sralph typedef struct {
10060310Sralph 	char	name[8];	/* Section name. */
10160310Sralph 	long	physAddr;	/* Section physical address. */
10260310Sralph 	long	virtAddr;	/* Section virtual address. */
10360310Sralph 	long	size;		/* Section size. */
10460310Sralph 	long	sectionPtr;	/* File pointer to section data. */
10560310Sralph 	long	relocPtr;	/* File pointer to relocation data. */
10660310Sralph 	long	lnnoPtr;	/* File pointer to gp tables. */
10760310Sralph 	u_short	numReloc;	/* Number of relocation entries. */
10860310Sralph 	u_short	numLnno;	/* Numberof gp tables. */
10960310Sralph 	long	flags;		/* Section flags. */
11060310Sralph } ProcSectionHeader;
11160310Sralph 
11260310Sralph /* Description of the object file header. */
11360310Sralph struct exec {
11460310Sralph 	ProcFileHeader	ex_fhdr;
11560310Sralph 	ProcAOUTHeader	ex_aout;
11660310Sralph };
11760310Sralph #define a_magic	ex_aout.magic
11860310Sralph #define a_text	ex_aout.codeSize
11960310Sralph #define a_data	ex_aout.heapSize
12060310Sralph #define a_bss	ex_aout.bssSize
12160310Sralph #define a_entry	ex_aout.entry
122