00001 /* 00002 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. 00003 * See the copyright notice in the ACK home directory, in the file "Copyright". 00004 */ 00005 /* $Header: /opt/proj/minix/cvsroot/src/commands/aal/out.h,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $ */ 00006 00007 #ifndef __OUT_H_INCLUDED 00008 #define __OUT_H_INCLUDED 00009 /* 00010 * output format for ACK assemblers 00011 */ 00012 #ifndef ushort 00013 #define ushort unsigned short 00014 #endif /* ushort */ 00015 00016 struct outhead { 00017 ushort oh_magic; /* magic number */ 00018 ushort oh_stamp; /* version stamp */ 00019 ushort oh_flags; /* several format flags */ 00020 ushort oh_nsect; /* number of outsect structures */ 00021 ushort oh_nrelo; /* number of outrelo structures */ 00022 ushort oh_nname; /* number of outname structures */ 00023 long oh_nemit; /* sum of all os_flen */ 00024 long oh_nchar; /* size of string area */ 00025 }; 00026 00027 #define O_MAGIC 0x0201 /* magic number of output file */ 00028 #define O_STAMP 0 /* version stamp */ 00029 #define MAXSECT 64 /* Maximum number of sections */ 00030 00031 #define HF_LINK 0x0004 /* unresolved references left */ 00032 #define HF_8086 0x0008 /* os_base specially encoded */ 00033 00034 struct outsect { 00035 long os_base; /* startaddress in machine */ 00036 long os_size; /* section size in machine */ 00037 long os_foff; /* startaddress in file */ 00038 long os_flen; /* section size in file */ 00039 long os_lign; /* section alignment */ 00040 }; 00041 00042 struct outrelo { 00043 char or_type; /* type of reference */ 00044 char or_sect; /* referencing section */ 00045 ushort or_nami; /* referenced symbol index */ 00046 long or_addr; /* referencing address */ 00047 }; 00048 00049 struct outname { 00050 union { 00051 char *on_ptr; /* symbol name (in core) */ 00052 long on_off; /* symbol name (in file) */ 00053 } on_u; 00054 #define on_mptr on_u.on_ptr 00055 #define on_foff on_u.on_off 00056 ushort on_type; /* symbol type */ 00057 ushort on_desc; /* debug info */ 00058 long on_valu; /* symbol value */ 00059 }; 00060 00061 /* 00062 * relocation type bits 00063 */ 00064 #define RELSZ 0x07 /* relocation length */ 00065 #define RELO1 1 /* 1 byte */ 00066 #define RELO2 2 /* 2 bytes */ 00067 #define RELO4 4 /* 4 bytes */ 00068 #define RELPC 0x08 /* pc relative */ 00069 #define RELBR 0x10 /* High order byte lowest address. */ 00070 #define RELWR 0x20 /* High order word lowest address. */ 00071 00072 /* 00073 * section type bits and fields 00074 */ 00075 #define S_TYP 0x007F /* undefined, absolute or relative */ 00076 #define S_EXT 0x0080 /* external flag */ 00077 #define S_ETC 0x7F00 /* for symbolic debug, bypassing 'as' */ 00078 00079 /* 00080 * S_TYP field values 00081 */ 00082 #define S_UND 0x0000 /* undefined item */ 00083 #define S_ABS 0x0001 /* absolute item */ 00084 #define S_MIN 0x0002 /* first user section */ 00085 #define S_MAX (S_TYP-1) /* last user section */ 00086 #define S_CRS S_TYP /* on_valu is symbol index which contains value */ 00087 00088 /* 00089 * S_ETC field values 00090 */ 00091 #define S_SCT 0x0100 /* section names */ 00092 #define S_LIN 0x0200 /* hll source line item */ 00093 #define S_FIL 0x0300 /* hll source file item */ 00094 #define S_MOD 0x0400 /* ass source file item */ 00095 #define S_COM 0x1000 /* Common name. */ 00096 #define S_STB 0xe000 /* entries with any of these bits set are 00097 reserved for debuggers 00098 */ 00099 00100 /* 00101 * structure format strings 00102 */ 00103 #define SF_HEAD "22222244" 00104 #define SF_SECT "44444" 00105 #define SF_RELO "1124" 00106 #define SF_NAME "4224" 00107 00108 /* 00109 * structure sizes (bytes in file; add digits in SF_*) 00110 */ 00111 #define SZ_HEAD 20 00112 #define SZ_SECT 20 00113 #define SZ_RELO 8 00114 #define SZ_NAME 12 00115 00116 /* 00117 * file access macros 00118 */ 00119 #define BADMAGIC(x) ((x).oh_magic!=O_MAGIC) 00120 #define OFF_SECT(x) SZ_HEAD 00121 #define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT)) 00122 #define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit) 00123 #define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO)) 00124 #define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME)) 00125 00126 #endif /* __OUT_H_INCLUDED */
1.4.6