source: trunk/minix/commands/dis88/dis.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 5.5 KB
Line 
1 /*
2 ** @(#) dis.h, Ver. 2.1 created 00:00:00 87/09/01
3 */
4
5 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6 * *
7 * Copyright (C) 1987 G. M. Harding, all rights reserved *
8 * *
9 * Permission to copy and redistribute is hereby granted, *
10 * provided full source code, with all copyright notices, *
11 * accompanies any redistribution. *
12 * *
13 * This file contains declarations and definitions used by *
14 * the 8088 disassembler program. The program was designed *
15 * for execution on a machine of its own type (i.e., it is *
16 * not designed as a cross-disassembler); consequently, A *
17 * SIXTEEN-BIT INTEGER SIZE HAS BEEN ASSUMED. This assump- *
18 * tion is not particularly important, however, except in *
19 * the machine-specific portions of the code (i.e., the *
20 * handler routines and the optab[] array). It should be *
21 * possible to override this assumption, for execution on *
22 * 32-bit machines, by use of a pre-processor directive *
23 * (see below); however, this has not been tested. *
24 * *
25 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26
27#include <sys/types.h>
28#include <a.out.h> /* Object file format definitions */
29#include <fcntl.h> /* System file-control definitions */
30#include <unistd.h>
31#include <string.h>
32#include <stdlib.h>
33#include <stdio.h> /* System standard I/O definitions */
34
35#define MAXSYM 1500 /* Maximum entries in symbol table */
36
37extern struct nlist /* Array to hold the symbol table */
38 symtab[MAXSYM];
39
40extern struct reloc /* Array to hold relocation table */
41 relo[MAXSYM];
42
43extern int symptr; /* Index into the symtab[] array */
44extern int relptr; /* Index into the relo[] array */
45
46struct opcode /* Format for opcode data records */
47{
48 char *text; /* Pointer to mnemonic text */
49 void (*func)(); /* Pointer to handler routine */
50 unsigned min; /* Minimum # of object bytes */
51 unsigned max; /* Maximum # of object bytes */
52};
53
54extern struct opcode /* Array to hold the opcode table */
55 optab[256];
56
57extern char *REGS[]; /* Table of register names */
58extern char *REGS0[]; /* Mode 0 register name table */
59extern char *REGS1[]; /* Mode 1 register name table */
60
61#define AL REGS[0] /* CPU register manifests */
62#define CL REGS[1]
63#define DL REGS[2]
64#define BL REGS[3]
65#define AH REGS[4]
66#define CH REGS[5]
67#define DH REGS[6]
68#define BH REGS[7]
69#define AX REGS[8]
70#define CX REGS[9]
71#define DX REGS[10]
72#define BX REGS[11]
73#define SP REGS[12]
74#define BP REGS[13]
75#define SI REGS[14]
76#define DI REGS[15]
77#define ES REGS[16]
78#define CS REGS[17]
79#define SS REGS[18]
80#define DS REGS[19]
81#define BX_SI REGS0[0]
82#define BX_DI REGS0[1]
83#define BP_SI REGS0[2]
84#define BP_DI REGS0[3]
85
86extern int symrank[6][6]; /* Symbol type/rank matrix */
87extern unsigned long PC; /* Current program counter */
88extern int segflg; /* Flag: segment override in effect */
89extern int objflg; /* Flag: output object as a comment */
90
91#define OBJMAX 8 /* Size of the object code buffer */
92
93extern unsigned char /* Internal buffer for object code */
94 objbuf[OBJMAX];
95
96extern int objptr; /* Index into the objbuf[] array */
97
98extern char ADD[], /* Opcode family mnemonic strings */
99 OR[],
100 ADC[],
101 SBB[],
102 AND[],
103 SUB[],
104 XOR[],
105 CMP[],
106 NOT[],
107 NEG[],
108 MUL[],
109 DIV[],
110 MOV[],
111 ESC[],
112 TEST[],
113 AMBIG[];
114
115extern char *OPFAM[]; /* Indexed mnemonic family table */
116extern struct exec HDR; /* Holds the object file's header */
117
118#define LOOK_ABS 0 /* Arguments to lookup() function */
119#define LOOK_REL 1
120#define LOOK_LNG 2
121
122#define TR_STD 0 /* Arguments to mtrans() function */
123#define TR_SEG 8
124
125 /* Macro for byte input primitive */
126#define FETCH(p) ++PC; p = getchar() & 0xff; objbuf[objptr++] = p
127
128
129/* disfp.c */
130_PROTOTYPE(void eshand, (int j ));
131_PROTOTYPE(void fphand, (int j ));
132_PROTOTYPE(void inhand, (int j ));
133
134/* dishand.c */
135_PROTOTYPE(void objini, (int j ));
136_PROTOTYPE(void objout, (void));
137_PROTOTYPE(void badseq, (int j, int k ));
138_PROTOTYPE(void dfhand, (int j ));
139_PROTOTYPE(void sbhand, (int j ));
140_PROTOTYPE(void aohand, (int j ));
141_PROTOTYPE(void sjhand, (int j ));
142_PROTOTYPE(void imhand, (int j ));
143_PROTOTYPE(void mvhand, (int j ));
144_PROTOTYPE(void mshand, (int j ));
145_PROTOTYPE(void pohand, (int j ));
146_PROTOTYPE(void cihand, (int j ));
147_PROTOTYPE(void mihand, (int j ));
148_PROTOTYPE(void mqhand, (int j ));
149_PROTOTYPE(void tqhand, (int j ));
150_PROTOTYPE(void rehand, (int j ));
151_PROTOTYPE(void mmhand, (int j ));
152_PROTOTYPE(void srhand, (int j ));
153_PROTOTYPE(void aahand, (int j ));
154_PROTOTYPE(void iohand, (int j ));
155_PROTOTYPE(void ljhand, (int j ));
156_PROTOTYPE(void mahand, (int j ));
157_PROTOTYPE(void mjhand, (int j ));
158
159/* dismain.c */
160_PROTOTYPE(void main, (int argc, char **argv ));
161
162/* distabs.c */
163_PROTOTYPE(char *getnam, (int k ));
164_PROTOTYPE(int lookext, (long off, long loc, char *buf ));
165_PROTOTYPE(char *lookup, (long addr, int type, int kind, long ext ));
166_PROTOTYPE(char *mtrans, (int c, int m, int type ));
167_PROTOTYPE(void mtrunc, (char *a ));
Note: See TracBrowser for help on using the repository browser.