|
|
1.1 ! root 1: /* ! 2: * coff.h ! 3: * Common Object File Format (COFF) header for COHERENT. ! 4: */ ! 5: ! 6: /* File header. */ ! 7: typedef struct filehdr { ! 8: unsigned short f_magic; /* Magic number */ ! 9: unsigned short f_nscns; /* Number of sections */ ! 10: long f_timdat; /* Time and date */ ! 11: long f_symptr; /* Seek to symbol table */ ! 12: long f_nsyms; /* Number of symbols */ ! 13: unsigned short f_opthdr; /* Optional header size */ ! 14: unsigned short f_flags; /* Flags */ ! 15: } FILHDR; ! 16: ! 17: #define FILHSZ sizeof(FILHDR) ! 18: ! 19: /* Magic number. */ ! 20: #define I386MAGIC 0x14C /* Intel iAPX 80386 */ ! 21: #define C_386_MAGIC 0x14C /* Intel iAPX 80386 */ ! 22: ! 23: /* ! 24: * This is just a short version of this macro. We really ought to define ! 25: * all the other magic numbers as well. ! 26: */ ! 27: #define ISCOFF(x) ((x) == C_386_MAGIC) ! 28: ! 29: /* Flags for f_flags field. */ ! 30: #define F_RELFLG 0x0001 /* No relocation info */ ! 31: #define F_EXEC 0x0002 /* Executable */ ! 32: #define F_LNNO 0x0004 /* No line numbers */ ! 33: #define F_LSYMS 0x0008 /* No local symbols */ ! 34: #define F_MINMAL 0x0010 /* product of strip */ ! 35: #define F_AR32WR 0x0100 /* i80x86 byte order */ ! 36: #define F_KER 0x0800 /* Loadable driver */ ! 37: ! 38: /* Optional header. */ ! 39: typedef struct aouthdr { ! 40: short magic; /* AOUT_MAGIC */ ! 41: short vstamp; /* version stamp */ ! 42: long tsize; /* .text size in bytes */ ! 43: long dsize; /* .data size in bytes */ ! 44: long bsize; /* .bss size in bytes */ ! 45: long entry; /* entry point */ ! 46: long text_start; /* base of .text data */ ! 47: long data_start; /* base of .data data */ ! 48: } AOUTHDR; ! 49: ! 50: /* Magic numbers for aouthdr. Coherent only supports Z_MAGIC */ ! 51: #define O_MAGIC 0x107 /* Text and data are contiguous text not shared */ ! 52: #define N_MAGIC 0x108 /* .data starts at seg after .text .text is protected */ ! 53: #define I_MAGIC 0x109 /* sep id */ ! 54: #define Z_MAGIC 0x10B /* Text and data aligned within a.out for direct page */ ! 55: ! 56: /* Section header. */ ! 57: typedef struct scnhdr { ! 58: char s_name[8]; /* Section name */ ! 59: long s_paddr; /* Physical address */ ! 60: long s_vaddr; /* Virtual address */ ! 61: long s_size; /* Size */ ! 62: long s_scnptr; /* Data pointer */ ! 63: long s_relptr; /* Reloc pointer */ ! 64: long s_lnnoptr; /* Line number pointer */ ! 65: unsigned short s_nreloc; /* Reloc entries */ ! 66: unsigned short s_nlnno; /* Line number entries */ ! 67: long s_flags; /* Flags */ ! 68: } SCNHDR; ! 69: ! 70: #define SCNHSZ sizeof(SCNHDR) ! 71: ! 72: /* Names of special sections */ ! 73: #define _TEXT ".text" ! 74: #define _DATA ".data" ! 75: #define _BSS ".bss" ! 76: #define _TV ".tv" ! 77: #define _INIT ".init" ! 78: #define _FINI ".fini" ! 79: ! 80: /* Flags for s_flags field. */ ! 81: #define STYP_TEXT 0x20L /* Code segment */ ! 82: #define STYP_DATA 0x40L /* Data segment */ ! 83: #define STYP_BSS 0x80L /* BSS segment */ ! 84: ! 85: /* Relocation items. */ ! 86: typedef struct reloc { ! 87: long r_vaddr; /* Address (where) */ ! 88: long r_symndx; /* Symbol index (what) */ ! 89: unsigned short r_type; /* Type (how) */ ! 90: } RELOC; ! 91: ! 92: #define RELSZ 10 /* sizeof(RELOC) */ ! 93: ! 94: /* Relocation types. */ ! 95: #define R_DIR8 0x07 /* 8-bit direct */ ! 96: #define R_DIR16 0x01 /* 16-bit direct */ ! 97: #define R_DIR32 0x06 /* 32-bit direct */ ! 98: #define R_RELBYTE 0x0f /* 8 bit direct */ ! 99: #define R_RELWORD 0x10 /* 16 bit direct */ ! 100: #define R_RELLONG 0x11 /* 32 bit direct */ ! 101: #define R_PCRBYTE 0x12 /* 8-bit PC-relative */ ! 102: #define R_PCRWORD 0x13 /* 16-bit PC-relative */ ! 103: #define R_PCRLONG 0x14 /* 32-bit PC-relative */ ! 104: #define R_NONREL 0x00 /* fake record for ld -r */ ! 105: ! 106: /* Line number. */ ! 107: typedef struct lineno { ! 108: union { ! 109: long l_symndx; /* sym table ix of fun name */ ! 110: long l_paddr; /* physical addr */ ! 111: } l_addr; ! 112: unsigned short l_lnno; /* line number or 0 for fun */ ! 113: } LINENO; ! 114: ! 115: #define LINESZ 6 /* sizeof(LINENO) */ ! 116: ! 117: /* Symbol table. */ ! 118: #define SYMNMLEN 8 /* Symbol name length */ ! 119: #define FILNMLEN 14 /* Characters in a file name */ ! 120: #define DIMNUM 4 /* dimensions in aux entry */ ! 121: ! 122: typedef struct syment { ! 123: union { ! 124: char _n_name[SYMNMLEN]; /* Name */ ! 125: struct { ! 126: long _n_zeroes; /* If name[0-3] zero, */ ! 127: long _n_offset; /* string table offset */ ! 128: } _n_n; ! 129: char *_n_nptr[2]; ! 130: } _n; ! 131: long n_value; /* Value */ ! 132: short n_scnum; /* Section number */ ! 133: unsigned short n_type; /* Type */ ! 134: char n_sclass; /* Storage class */ ! 135: char n_numaux; /* Auxilliary entries */ ! 136: } SYMENT; ! 137: ! 138: #define SYMESZ 18 /* sizeof(SYMENT) */ ! 139: #define n_name _n._n_name ! 140: #define n_zeroes _n._n_n._n_zeroes ! 141: #define n_offset _n._n_n._n_offset ! 142: ! 143: /* Special section numbers */ ! 144: #define N_UNDEF 0 /* undefined symbol */ ! 145: #define N_ABS -1 /* absolute symbol */ ! 146: #define N_DEBUG -2 /* special debugging symbol */ ! 147: #define N_TV -3 /* symbol needs transfer vector (preload) */ ! 148: #define P_TV -4 /* symbol needs transfer vector (postload) */ ! 149: ! 150: /* Storage classes. */ ! 151: #define C_EFCN -1 /* end of function */ ! 152: #define C_NULL 0 /* none given */ ! 153: #define C_AUTO 1 /* automatic variable */ ! 154: #define C_EXT 2 /* External */ ! 155: #define C_STAT 3 /* Static */ ! 156: #define C_REG 4 /* register variable */ ! 157: #define C_EXTDEF 5 /* External definition */ ! 158: #define C_LABEL 6 /* label */ ! 159: #define C_ULABEL 7 /* undefined label */ ! 160: #define C_MOS 8 /* member of structure */ ! 161: #define C_ARG 9 /* function argument */ ! 162: #define C_STRTAG 10 /* structure tag */ ! 163: #define C_MOU 11 /* member of union */ ! 164: #define C_UNTAG 12 /* union tag */ ! 165: #define C_TPDEF 13 /* typedef */ ! 166: #define C_USTATIC 14 /* undefined static */ ! 167: #define C_ENTAG 15 /* enum tag */ ! 168: #define C_MOE 16 /* member of enum */ ! 169: #define C_REGPARM 17 /* register parm */ ! 170: #define C_FIELD 18 /* bit field */ ! 171: #define C_BLOCK 100 /* .bb or .eb */ ! 172: #define C_FCN 101 /* .bf or .ef */ ! 173: #define C_EOS 102 /* end of structure */ ! 174: #define C_FILE 103 /* file name */ ! 175: ! 176: /* is x a tag */ ! 177: #define ISTAG(x) (C_STRTAG==(x) || C_UNTAG==(x) || C_ENTAG==(x)) ! 178: ! 179: /* fundimental type */ ! 180: #define T_NULL 0 ! 181: #define T_ARG 1 ! 182: #define T_CHAR 2 ! 183: #define T_SHORT 3 ! 184: #define T_INT 4 ! 185: #define T_LONG 5 ! 186: #define T_FLOAT 6 ! 187: #define T_DOUBLE 7 ! 188: #define T_STRUCT 8 ! 189: #define T_UNION 9 ! 190: #define T_ENUM 10 ! 191: #define T_MOE 11 /* member of enumeration */ ! 192: #define T_UCHAR 12 ! 193: #define T_USHORT 13 ! 194: #define T_UINT 14 ! 195: #define T_ULONG 15 ! 196: ! 197: /* Derived Types in n_type */ ! 198: #define DT_NON 0 /* non derived type */ ! 199: #define DT_PTR 0x10 /* pointer */ ! 200: #define DT_FCN 0x20 /* function */ ! 201: #define DT_ARY 0x30 /* array */ ! 202: ! 203: /* Type packing constants */ ! 204: #define N_BTMASK 0x15 /* Mask for basic type */ ! 205: #define N_TMASK 0x30 /* Derived type mask */ ! 206: #define N_TSHIFT 2 /* Shift to get at more derivations */ ! 207: ! 208: /* Type processing macros */ ! 209: #define BTYPE(x) ((x) & N_BTMASK) /* Basic type of x */ ! 210: #define ISPTR(x) (DT_PTR == ((x) & N_TMASK)) /* Is x a pointer */ ! 211: #define ISFCN(x) (DT_FCN == ((x) & N_TMASK)) /* Is x a function */ ! 212: #define ISARY(x) (DT_ARY == ((x) & N_TMASK)) /* Is x an array */ ! 213: #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|DT_PTR|((x)&N_BTMASK)) ! 214: #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) ! 215: ! 216: /* Aux symbols */ ! 217: typedef union auxent { ! 218: struct { ! 219: long x_tagndx; /* struct, union or enum tag index */ ! 220: union { ! 221: struct { ! 222: unsigned short x_lnno; /* declaration line */ ! 223: unsigned short x_size; /* size */ ! 224: } x_lnsz; ! 225: long x_fsize; /* size of function */ ! 226: } x_misc; ! 227: union { ! 228: struct { /* if ISFCN tag or .bb */ ! 229: long x_lnnoptr; /* ptr to fcn line # */ ! 230: long x_endndx; /* index past block */ ! 231: } x_fcn; ! 232: struct { /* if ISARY */ ! 233: unsigned short x_dimen[DIMNUM]; ! 234: } x_ary; ! 235: } x_fcnary; ! 236: unsigned short x_tvndx; /* tv index */ ! 237: } x_sym; ! 238: struct { ! 239: char x_fname[FILNMLEN]; ! 240: } x_file; ! 241: struct { ! 242: long x_scnlen; /* section length */ ! 243: unsigned short x_nreloc; /* reloc entrys */ ! 244: unsigned short x_nlinno; /* line number entries */ ! 245: } x_scn; ! 246: } AUXENT; ! 247: ! 248: #define AUXESZ 18 /* sizeof(auxent) */ ! 249: /* end of coff.h */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.