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