source: trunk/minix/commands/dis88/disfp.c@ 10

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

Minix 3.1.2a

File size: 5.5 KB
RevLine 
[9]1static char *sccsid =
2 "@(#) disfp.c, Ver. 2.1 created 00:00:00 87/09/01";
3
4 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5 * *
6 * Copyright (C) 1987 G. M. Harding, all rights reserved *
7 * *
8 * Permission to copy and redistribute is hereby granted, *
9 * provided full source code, with all copyright notices, *
10 * accompanies any redistribution. *
11 * *
12 * This file contains handler routines for the numeric op- *
13 * codes of the 8087 co-processor, as well as a few other *
14 * opcodes which are related to 8087 emulation. *
15 * *
16 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17
18#include "dis.h" /* Disassembler declarations */
19
20#define FPINT0 0xd8 /* Floating-point interrupts */
21#define FPINT1 0xd9
22#define FPINT2 0xda
23#define FPINT3 0xdb
24#define FPINT4 0xdc
25#define FPINT5 0xdd
26#define FPINT6 0xde
27#define FPINT7 0xdf
28
29 /* Test for floating opcodes */
30#define ISFLOP(x) \
31 (((x) >= FPINT0) && ((x) <= FPINT7))
32
33
34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
35 * *
36 * This is the handler for the escape family of opcodes. *
37 * These opcodes place the contents of a specified memory *
38 * location on the system bus, for access by a peripheral *
39 * or by a co-processor such as the 8087. (The 8087 NDP is *
40 * accessed only via bus escapes.) Due to a bug in the *
41 * PC/IX assembler, the "esc" mnemonic is not recognized; *
42 * consequently, escape opcodes are disassembled as .byte *
43 * directives, with the appropriate mnemonic and operand *
44 * included as a comment. FOR NOW, those escape sequences *
45 * corresponding to 8087 opcodes are treated as simple *
46 * escapes. *
47 * *
48 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
49
50void
51eshand(j)
52
53 register int j; /* Pointer to optab[] entry */
54
55{/* * * * * * * * * * START OF eshand() * * * * * * * * * */
56
57 register char *a;
58 register int k;
59
60 objini(j);
61
62 FETCH(k);
63
64 a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
65
66 mtrunc(a);
67
68 printf("\t.byte\t0x%02.2x\t\t| esc\t%s\n",j,a);
69
70 for (k = 1; k < objptr; ++k)
71 printf("\t.byte\t0x%02.2x\n",objbuf[k]);
72
73}/* * * * * * * * * * * END OF eshand() * * * * * * * * * * */
74
75
76 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
77 * *
78 * This is the handler routine for floating-point opcodes. *
79 * Since PC/IX must accommodate systems with and without *
80 * 8087 co-processors, it allows floating-point operations *
81 * to be initiated in either of two ways: by a software *
82 * interrput whose type is in the range 0xd8 through 0xdf, *
83 * or by a CPU escape sequence, which is invoked by an op- *
84 * code in the same range. In either case, the subsequent *
85 * byte determines the actual numeric operation to be per- *
86 * formed. However, depending on the method of access, *
87 * either one or two code bytes will precede that byte, *
88 * and the fphand() routine has no way of knowing whether *
89 * it was invoked by interrupt or by an escape sequence. *
90 * Therefore, unlike all of the other handler routines ex- *
91 * cept dfhand(), fphand() does not initialize the object *
92 * buffer, leaving that chore to the caller. *
93 * *
94 * FOR NOW, fphand() does not disassemble floating-point *
95 * opcodes to floating mnemonics, but simply outputs the *
96 * object code as .byte directives. *
97 * *
98 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
99
100void
101fphand(j)
102
103 register int j; /* Pointer to optab[] entry */
104
105{/* * * * * * * * * * START OF fphand() * * * * * * * * * */
106
107 register int k;
108
109 segflg = 0;
110
111 FETCH(k);
112
113 printf("\t.byte\t0x%02.2x\t\t| 8087 code sequence\n",
114 objbuf[0]);
115
116 for (k = 1; k < objptr; ++k)
117 printf("\t.byte\t0x%02.2x\n",objbuf[k]);
118
119/* objout(); FOR NOW */
120
121}/* * * * * * * * * * * END OF fphand() * * * * * * * * * * */
122
123
124 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
125 * *
126 * This is the handler for variable software interrupt *
127 * opcodes. It is included in this file because PC/IX im- *
128 * plements its software floating-point emulation by means *
129 * of interrupts. Any interrupt in the range 0xd8 through *
130 * 0xdf is an NDP-emulation interrupt, and is specially *
131 * handled by the assembler. *
132 * *
133 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
134
135void
136inhand(j)
137
138 register int j; /* Pointer to optab[] entry */
139
140{/* * * * * * * * * * START OF inhand() * * * * * * * * * */
141
142 register int k;
143
144 objini(j);
145
146 FETCH(k);
147
148 if (ISFLOP(k))
149 {
150 fphand(k);
151 return;
152 }
153
154 printf("%s\t%d\n",optab[j].text,k);
155
156 objout();
157
158}/* * * * * * * * * * * END OF inhand() * * * * * * * * * * */
159
160
161
Note: See TracBrowser for help on using the repository browser.