xref: /csrg-svn/sys/pmax/include/exec.h (revision 53006)
1*53006Sbostic /*-
2*53006Sbostic  * Copyright (c) 1992 The Regents of the University of California.
3*53006Sbostic  * All rights reserved.
4*53006Sbostic  *
5*53006Sbostic  * %sccs.include.redist.c%
6*53006Sbostic  *
7*53006Sbostic  *	@(#)exec.h	7.1 (Berkeley) 03/18/92
8*53006Sbostic  */
9*53006Sbostic 
10*53006Sbostic /*
11*53006Sbostic  * Portions of this file are subject to the following copyright notice:
12*53006Sbostic  *
13*53006Sbostic  * Copyright (C) 1989 Digital Equipment Corporation.
14*53006Sbostic  * Permission to use, copy, modify, and distribute this software and
15*53006Sbostic  * its documentation for any purpose and without fee is hereby granted,
16*53006Sbostic  * provided that the above copyright notice appears in all copies.
17*53006Sbostic  * Digital Equipment Corporation makes no representations about the
18*53006Sbostic  * suitability of this software for any purpose.  It is provided "as is"
19*53006Sbostic  * without express or implied warranty.
20*53006Sbostic  */
21*53006Sbostic 
22*53006Sbostic /*
23*53006Sbostic  * /sprite/src/kernel/proc/ds3100.md/RCS/procMach.h,v 9.3 90/02/20 15:35:50
24*53006Sbostic  * shirriff Exp $ SPRITE (Berkeley)
25*53006Sbostic  */
26*53006Sbostic 
27*53006Sbostic /* Size of a page in an object file. */
28*53006Sbostic #define	__LDPGSZ	4096
29*53006Sbostic 
30*53006Sbostic /* Valid magic number check. */
31*53006Sbostic #define	N_BADMAG(ex) \
32*53006Sbostic 	((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \
33*53006Sbostic 	    (ex).a_magic != ZMAGIC)
34*53006Sbostic 
35*53006Sbostic /* Address of the bottom of the text segment. */
36*53006Sbostic #define N_TXTADDR(ex)	0x400000
37*53006Sbostic 
38*53006Sbostic /* Address of the bottom of the data segment. */
39*53006Sbostic /* NOT DEFINED FOR THE MIPS. */
40*53006Sbostic 
41*53006Sbostic /* Text segment offset. */
42*53006Sbostic #define	__N_TXTOFF_ROUND(ex) \
43*53006Sbostic 	((ex).ex_aout.verStamp < 23 ? 7 : 15)
44*53006Sbostic #define	N_TXTOFF(ex) \
45*53006Sbostic 	((ex).ex_aout.magic == ZMAGIC ? 0 : (sizeof(struct exec) + \
46*53006Sbostic 	    (ex).ex_fhdr.numSections * sizeof(ProcSectionHeader) + \
47*53006Sbostic 	    __N_TXTOFF_ROUND(ex)) & ~__N_TXTOFF_ROUND(ex))
48*53006Sbostic 
49*53006Sbostic /* Data segment offset. */
50*53006Sbostic #define N_DATAOFF(ex) \
51*53006Sbostic 	(N_TXTOFF(ex) + (ex).ex_aout.codeSize)
52*53006Sbostic 
53*53006Sbostic /* Symbol table offset. */
54*53006Sbostic /* NOT DEFINED FOR THE MIPS. */
55*53006Sbostic 
56*53006Sbostic /* String table offset. */
57*53006Sbostic /* NOT DEFINED FOR THE MIPS. */
58*53006Sbostic 
59*53006Sbostic /*
60*53006Sbostic  * XXX
61*53006Sbostic  * The ProcFileHeader structure and the ProcAOUTHeader structure should be
62*53006Sbostic  * folded together into a single struct exec.
63*53006Sbostic  */
64*53006Sbostic 
65*53006Sbostic /* Description of the COFF section. */
66*53006Sbostic typedef struct {
67*53006Sbostic #define	COFF_MAGIC	0x0162
68*53006Sbostic 	u_short	magic;		/* The magic number. */
69*53006Sbostic 
70*53006Sbostic 	u_short	numSections;	/* The number of sections. */
71*53006Sbostic 	long	timeDateStamp;	/* Time and date stamp. */
72*53006Sbostic 	long	symPtr;		/* File pointer to symbolic header. */
73*53006Sbostic 	long	numSyms;	/* Size of symbolic header. */
74*53006Sbostic 	u_short	optHeader;	/* Size of optional header. */
75*53006Sbostic 	u_short	flags;		/* Flags. */
76*53006Sbostic } ProcFileHeader;
77*53006Sbostic 
78*53006Sbostic /* Description of the a.out section. */
79*53006Sbostic typedef struct {
80*53006Sbostic #define	OMAGIC	0407		/* old impure format */
81*53006Sbostic #define	NMAGIC	0410		/* read-only text */
82*53006Sbostic #define	ZMAGIC	0413		/* demand load format */
83*53006Sbostic 	short	magic;		/* Magic number. */
84*53006Sbostic 
85*53006Sbostic 	short	verStamp;	/* Version stamp. */
86*53006Sbostic 	long	codeSize;	/* Code size in bytes. */
87*53006Sbostic 	long	heapSize;	/* Initialized data size in bytes. */
88*53006Sbostic 	long	bssSize;	/* Uninitialized data size in bytes. */
89*53006Sbostic 	long	entry;		/* Entry point. */
90*53006Sbostic 	long	codeStart;	/* Base of code used for this file. */
91*53006Sbostic 	long	heapStart;	/* Base of heap used for this file. */
92*53006Sbostic 	long	bssStart;	/* Base of bss used for this file. */
93*53006Sbostic 	long	gprMask;	/* General purpose register mask. */
94*53006Sbostic 	long	cprMask[4];	/* Co-processor register masks. */
95*53006Sbostic 	long	gpValue;	/* The gp value for this object. */
96*53006Sbostic } ProcAOUTHeader;
97*53006Sbostic 
98*53006Sbostic /* Section header. */
99*53006Sbostic typedef struct {
100*53006Sbostic 	char	name[8];	/* Section name. */
101*53006Sbostic 	long	physAddr;	/* Section physical address. */
102*53006Sbostic 	long	virtAddr;	/* Section virtual address. */
103*53006Sbostic 	long	size;		/* Section size. */
104*53006Sbostic 	long	sectionPtr;	/* File pointer to section data. */
105*53006Sbostic 	long	relocPtr;	/* File pointer to relocation data. */
106*53006Sbostic 	long	lnnoPtr;	/* File pointer to gp tables. */
107*53006Sbostic 	u_short	numReloc;	/* Number of relocation entries. */
108*53006Sbostic 	u_short	numLnno;	/* Numberof gp tables. */
109*53006Sbostic 	long	flags;		/* Section flags. */
110*53006Sbostic } ProcSectionHeader;
111*53006Sbostic 
112*53006Sbostic /* Description of the object file header. */
113*53006Sbostic struct exec {
114*53006Sbostic 	ProcFileHeader	ex_fhdr;
115*53006Sbostic 	ProcAOUTHeader	ex_aout;
116*53006Sbostic };
117*53006Sbostic #define a_magic	ex_aout.magic
118*53006Sbostic #define a_text	ex_aout.codeSize
119*53006Sbostic #define a_data	ex_aout.heapSize
120*53006Sbostic #define a_bss	ex_aout.bssSize
121*53006Sbostic #define a_entry	ex_aout.entry
122