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/11/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 #if BYTE_ORDER == BIG_ENDIAN 68 # define COFF_MAGIC 0x0160 69 #else 70 # define COFF_MAGIC 0x0162 71 #endif 72 u_short magic; /* The magic number. */ 73 74 u_short numSections; /* The number of sections. */ 75 long timeDateStamp; /* Time and date stamp. */ 76 long symPtr; /* File pointer to symbolic header. */ 77 long numSyms; /* Size of symbolic header. */ 78 u_short optHeader; /* Size of optional header. */ 79 u_short flags; /* Flags. */ 80 } ProcFileHeader; 81 82 /* Description of the a.out section. */ 83 typedef struct { 84 #define OMAGIC 0407 /* old impure format */ 85 #define NMAGIC 0410 /* read-only text */ 86 #define ZMAGIC 0413 /* demand load format */ 87 short magic; /* Magic number. */ 88 89 short verStamp; /* Version stamp. */ 90 long codeSize; /* Code size in bytes. */ 91 long heapSize; /* Initialized data size in bytes. */ 92 long bssSize; /* Uninitialized data size in bytes. */ 93 long entry; /* Entry point. */ 94 long codeStart; /* Base of code used for this file. */ 95 long heapStart; /* Base of heap used for this file. */ 96 long bssStart; /* Base of bss used for this file. */ 97 long gprMask; /* General purpose register mask. */ 98 long cprMask[4]; /* Co-processor register masks. */ 99 long gpValue; /* The gp value for this object. */ 100 } ProcAOUTHeader; 101 102 /* Section header. */ 103 typedef struct { 104 char name[8]; /* Section name. */ 105 long physAddr; /* Section physical address. */ 106 long virtAddr; /* Section virtual address. */ 107 long size; /* Section size. */ 108 long sectionPtr; /* File pointer to section data. */ 109 long relocPtr; /* File pointer to relocation data. */ 110 long lnnoPtr; /* File pointer to gp tables. */ 111 u_short numReloc; /* Number of relocation entries. */ 112 u_short numLnno; /* Numberof gp tables. */ 113 long flags; /* Section flags. */ 114 } ProcSectionHeader; 115 116 /* Description of the object file header. */ 117 struct exec { 118 ProcFileHeader ex_fhdr; 119 ProcAOUTHeader ex_aout; 120 }; 121 #define a_magic ex_aout.magic 122 #define a_text ex_aout.codeSize 123 #define a_data ex_aout.heapSize 124 #define a_bss ex_aout.bssSize 125 #define a_entry ex_aout.entry 126