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