dis.h

Go to the documentation of this file.
00001  /*
00002  ** @(#) dis.h, Ver. 2.1 created 00:00:00 87/09/01
00003  */
00004 
00005  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00006   *                                                         *
00007   *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
00008   *                                                         *
00009   * Permission to copy and  redistribute is hereby granted, *
00010   * provided full source code,  with all copyright notices, *
00011   * accompanies any redistribution.                         *
00012   *                                                         *
00013   * This file contains declarations and definitions used by *
00014   * the 8088 disassembler program. The program was designed *
00015   * for execution on a machine of its own type (i.e., it is *
00016   * not designed as a cross-disassembler);  consequently, A *
00017   * SIXTEEN-BIT INTEGER SIZE HAS BEEN ASSUMED. This assump- *
00018   * tion is not particularly important,  however, except in *
00019   * the machine-specific  portions of the code  (i.e.,  the *
00020   * handler  routines and the optab[] array).  It should be *
00021   * possible to override this assumption,  for execution on *
00022   * 32-bit machines,  by use of a  pre-processor  directive *
00023   * (see below); however, this has not been tested.         *
00024   *                                                         *
00025   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00026 
00027 #include <sys/types.h>
00028 #include <a.out.h>      /* Object file format definitions   */
00029 #include <fcntl.h>      /* System file-control definitions  */
00030 #include <unistd.h>
00031 #include <string.h>
00032 #include <stdlib.h>
00033 #include <stdio.h>      /* System standard I/O definitions  */
00034 
00035 #define MAXSYM 1500     /* Maximum entries in symbol table  */
00036 
00037 extern struct nlist     /* Array to hold the symbol table   */
00038    symtab[MAXSYM];
00039 
00040 extern struct reloc     /* Array to hold relocation table   */
00041    relo[MAXSYM];
00042 
00043 extern int symptr;      /* Index into the symtab[] array    */
00044 extern int relptr;      /* Index into the relo[] array      */
00045 
00046 struct opcode           /* Format for opcode data records   */
00047 {
00048    char *text;          /* Pointer to mnemonic text   */
00049    void (*func)();      /* Pointer to handler routine */
00050    unsigned min;        /* Minimum # of object bytes  */
00051    unsigned max;        /* Maximum # of object bytes  */
00052 };
00053 
00054 extern struct opcode    /* Array to hold the opcode table   */
00055   optab[256];
00056 
00057 extern char *REGS[];    /* Table of register names          */
00058 extern char *REGS0[];   /* Mode 0 register name table       */
00059 extern char *REGS1[];   /* Mode 1 register name table       */
00060 
00061 #define AL REGS[0]      /* CPU register manifests           */
00062 #define CL REGS[1]
00063 #define DL REGS[2]
00064 #define BL REGS[3]
00065 #define AH REGS[4]
00066 #define CH REGS[5]
00067 #define DH REGS[6]
00068 #define BH REGS[7]
00069 #define AX REGS[8]
00070 #define CX REGS[9]
00071 #define DX REGS[10]
00072 #define BX REGS[11]
00073 #define SP REGS[12]
00074 #define BP REGS[13]
00075 #define SI REGS[14]
00076 #define DI REGS[15]
00077 #define ES REGS[16]
00078 #define CS REGS[17]
00079 #define SS REGS[18]
00080 #define DS REGS[19]
00081 #define BX_SI REGS0[0]
00082 #define BX_DI REGS0[1]
00083 #define BP_SI REGS0[2]
00084 #define BP_DI REGS0[3]
00085 
00086 extern int symrank[6][6];     /* Symbol type/rank matrix    */
00087 extern unsigned long PC;      /* Current program counter    */
00088 extern int segflg;      /* Flag: segment override in effect */
00089 extern int objflg;      /* Flag: output object as a comment */
00090 
00091 #define OBJMAX 8        /* Size of the object code buffer   */
00092 
00093 extern unsigned char    /* Internal buffer for object code  */
00094    objbuf[OBJMAX];
00095 
00096 extern int objptr;      /* Index into the objbuf[] array    */
00097 
00098 extern char ADD[],      /* Opcode family mnemonic strings   */
00099             OR[],
00100             ADC[],
00101             SBB[],
00102             AND[],
00103             SUB[],
00104             XOR[],
00105             CMP[],
00106             NOT[],
00107             NEG[],
00108             MUL[],
00109             DIV[],
00110             MOV[],
00111             ESC[],
00112             TEST[],
00113             AMBIG[];
00114 
00115 extern char *OPFAM[];   /* Indexed mnemonic family table    */
00116 extern struct exec HDR; /* Holds the object file's header   */
00117 
00118 #define LOOK_ABS 0      /* Arguments to lookup() function   */
00119 #define LOOK_REL 1
00120 #define LOOK_LNG 2
00121 
00122 #define TR_STD 0        /* Arguments to mtrans() function   */
00123 #define TR_SEG 8
00124 
00125                         /* Macro for byte input primitive   */
00126 #define FETCH(p)  ++PC; p = getchar() & 0xff; objbuf[objptr++] = p
00127 
00128 
00129 /* disfp.c */
00130 _PROTOTYPE(void eshand, (int j ));
00131 _PROTOTYPE(void fphand, (int j ));
00132 _PROTOTYPE(void inhand, (int j ));
00133 
00134 /* dishand.c */
00135 _PROTOTYPE(void objini, (int j ));
00136 _PROTOTYPE(void objout, (void));
00137 _PROTOTYPE(void badseq, (int j, int k ));
00138 _PROTOTYPE(void dfhand, (int j ));
00139 _PROTOTYPE(void sbhand, (int j ));
00140 _PROTOTYPE(void aohand, (int j ));
00141 _PROTOTYPE(void sjhand, (int j ));
00142 _PROTOTYPE(void imhand, (int j ));
00143 _PROTOTYPE(void mvhand, (int j ));
00144 _PROTOTYPE(void mshand, (int j ));
00145 _PROTOTYPE(void pohand, (int j ));
00146 _PROTOTYPE(void cihand, (int j ));
00147 _PROTOTYPE(void mihand, (int j ));
00148 _PROTOTYPE(void mqhand, (int j ));
00149 _PROTOTYPE(void tqhand, (int j ));
00150 _PROTOTYPE(void rehand, (int j ));
00151 _PROTOTYPE(void mmhand, (int j ));
00152 _PROTOTYPE(void srhand, (int j ));
00153 _PROTOTYPE(void aahand, (int j ));
00154 _PROTOTYPE(void iohand, (int j ));
00155 _PROTOTYPE(void ljhand, (int j ));
00156 _PROTOTYPE(void mahand, (int j ));
00157 _PROTOTYPE(void mjhand, (int j ));
00158 
00159 /* dismain.c */
00160 _PROTOTYPE(void main, (int argc, char **argv ));
00161 
00162 /* distabs.c */
00163 _PROTOTYPE(char *getnam, (int k ));
00164 _PROTOTYPE(int lookext, (long off, long loc, char *buf ));
00165 _PROTOTYPE(char *lookup, (long addr, int type, int kind, long ext ));
00166 _PROTOTYPE(char *mtrans, (int c, int m, int type ));
00167 _PROTOTYPE(void mtrunc, (char *a ));

Generated on Fri Apr 14 22:56:48 2006 for minix by  doxygen 1.4.6