~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/krnl386.exe16/fpu.c

Version: ~ [ wine-1.5.31 ] ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * DOS interrupt 34->3e handlers.  All FPU interrupt code should be
  3  * moved into this file.
  4  *
  5  * Copyright 2002 Robert 'Admiral' Coeyman
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2.1 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the Free Software
 19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 20  */
 21 
 22 #include <stdlib.h>
 23 #include "dosexe.h"
 24 #include "wine/debug.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(int);
 27 
 28 /*
 29  *  The actual work is done by a single routine.
 30  */
 31 
 32 static void FPU_ModifyCode(CONTEXT *context, BYTE Opcode);
 33 
 34 
 35 /**********************************************************************
 36  *          DOSVM_Int34Handler
 37  *
 38  * Handler for int 34 (FLOATING POINT EMULATION - Opcode 0xd8).
 39  *
 40  *  The interrupt list isn't specific about what this interrupt
 41  *  actually does. [ interrup.m ]
 42  */
 43 void WINAPI DOSVM_Int34Handler(CONTEXT *context)
 44 {
 45     TRACE("Int 0x34 called-- FP opcode 0xd8\n");
 46     FPU_ModifyCode(context, 0xd8);
 47 }
 48 
 49 
 50 /**********************************************************************
 51  *          DOSVM_Int35Handler
 52  *
 53  * Handler for int 35 (FLOATING POINT EMULATION - Opcode 0xd9).
 54  *
 55  *  The interrupt list isn't specific about what this interrupt
 56  *  actually does. [ interrup.m ]
 57  */
 58 void WINAPI DOSVM_Int35Handler(CONTEXT *context)
 59 {
 60     TRACE("Int 0x35 called-- FP opcode 0xd9\n");
 61     FPU_ModifyCode(context, 0xd9);
 62 }
 63 
 64 
 65 /**********************************************************************
 66  *          DOSVM_Int36Handler
 67  *
 68  * Handler for int 36 (FLOATING POINT EMULATION - Opcode 0xda).
 69  *
 70  *  The interrupt list isn't specific about what this interrupt
 71  *  actually does. [ interrup.m ]
 72  */
 73 void WINAPI DOSVM_Int36Handler(CONTEXT *context)
 74 {
 75     TRACE("Int 0x36 called-- FP opcode 0xda\n");
 76     FPU_ModifyCode(context, 0xda);
 77 }
 78 
 79 
 80 /**********************************************************************
 81  *          DOSVM_Int37Handler
 82  *
 83  * Handler for int 37 (FLOATING POINT EMULATION - Opcode 0xdb).
 84  *
 85  *  The interrupt list isn't specific about what this interrupt
 86  *  actually does. [ interrup.m ]
 87  */
 88 void WINAPI DOSVM_Int37Handler(CONTEXT *context)
 89 {
 90     TRACE("Int 0x37 called-- FP opcode 0xdb\n");
 91     FPU_ModifyCode(context, 0xdb);
 92 }
 93 
 94 
 95 /**********************************************************************
 96  *          DOSVM_Int38Handler
 97  *
 98  * Handler for int 38 (FLOATING POINT EMULATION - Opcode 0xdc).
 99  *
100  *  Between versions 3.0 and 5.01, the original PC-MOS API call that
101  *  was here was moved to int 0xd4.
102  *
103  *  The interrupt list isn't specific about what this interrupt
104  *  actually does. [ interrup.m ]
105  */
106 void WINAPI DOSVM_Int38Handler(CONTEXT *context)
107 {
108     TRACE("Int 0x38 called-- FP opcode 0xdc\n");
109     FPU_ModifyCode(context, 0xdc);
110 }
111 
112 
113 /**********************************************************************
114  *          DOSVM_Int39Handler
115  *
116  * Handler for int 39 (FLOATING POINT EMULATION - Opcode 0xdd).
117  *
118  *  The interrupt list isn't specific about what this interrupt
119  *  actually does. [ interrup.m ]
120  */
121 void WINAPI DOSVM_Int39Handler(CONTEXT *context)
122 {
123     TRACE("Int 0x39 called-- FP opcode 0xdd\n");
124     FPU_ModifyCode(context, 0xdd);
125 }
126 
127 
128 /**********************************************************************
129  *          DOSVM_Int3aHandler
130  *
131  * Handler for int 3a (FLOATING POINT EMULATION - Opcode 0xde).
132  *
133  *  The interrupt list isn't specific about what this interrupt
134  *  actually does. [ interrup.m ]
135  */
136 void WINAPI DOSVM_Int3aHandler(CONTEXT *context)
137 {
138     TRACE("Int 0x3a called-- FP opcode 0xde\n");
139     FPU_ModifyCode(context, 0xde);
140 }
141 
142 
143 /**********************************************************************
144  *          DOSVM_Int3bHandler
145  *
146  * Handler for int 3B (FLOATING POINT EMULATION - Opcode 0xdf).
147  *
148  *  The interrupt list isn't specific about what this interrupt
149  *  actually does. [ interrup.m ]
150  */
151 void WINAPI DOSVM_Int3bHandler(CONTEXT *context)
152 {
153     TRACE("Int 0x3b called-- FP opcode 0xdf\n");
154     FPU_ModifyCode(context, 0xdf);
155 }
156 
157 
158 /**********************************************************************
159  *          DOSVM_Int3cHandler
160  *
161  * Handler for int 3C (FLOATING POINT EMULATION - INSTRUCTIONS WITH SEGMENT OVERRIDE).
162  *
163  *  Generated code is CD 3C xy mm ... (CD = int | 3C = this interrupt)
164  *   xy is a modified ESC code and mm is the modR/M byte.
165  *   xy byte seems to be encoded as ss011xxx  or ss000xxx
166  *   ss= segment override.
167  *     00 -> DS
168  *     01 -> SS
169  *     10 -> CS
170  *     11 -> ES
171  *
172  *  11011xxx should be the opcode instruction.
173  */
174 void WINAPI DOSVM_Int3cHandler(CONTEXT *context)
175 {
176     FIXME("Int 3C NOT Implemented\n");
177     INT_BARF(context, 0x3c);
178 }
179 
180 
181 /**********************************************************************
182  *          DOSVM_Int3dHandler
183  *
184  * Handler for int 3D (FLOATING POINT EMULATION - Standalone FWAIT).
185  *
186  *  Opcode 0x90 is a NOP.  It just fills space where the 3D was.
187  */
188 void WINAPI DOSVM_Int3dHandler(CONTEXT *context)
189 {
190     TRACE("Int 0x3d called-- Standalone FWAIT\n");
191     FPU_ModifyCode(context, 0x90);
192 }
193 
194 
195 /**********************************************************************
196  *          DOSVM_Int3eHandler
197  *
198  * FLOATING POINT EMULATION -- Borland "Shortcut" call.
199  *  The two bytes following the int 3E instruction are
200  *  the subcode and a NOP ( 0x90 ), except for subcodes DC and DE
201  *  where the second byte is the register count.
202  *
203  *  Direct access 4.0 modifies and does not restore this vector.
204  *
205  */
206 void WINAPI DOSVM_Int3eHandler(CONTEXT *context)
207 {
208     FIXME("Int 3E NOT Implemented\n");
209     INT_BARF(context, 0x3e);
210 }
211 
212 
213 /**********************************************************************
214  *          FPU_ModifyCode
215  *
216  *   This is the function that inserts the 0x9b fwait instruction
217  *   and the actual FPU opcode into the program.
218  *           -A.C.
219  *
220  *               Code thanks to Ove Kaaven
221  */
222 static void FPU_ModifyCode(CONTEXT *context, BYTE Opcode)
223 {
224     BYTE *code = CTX_SEG_OFF_TO_LIN(context, context->SegCs, context->Eip);
225 
226     /*
227      * All *NIX systems should have a real or kernel emulated FPU.
228      */
229 
230     code[-2] = 0x9b;          /* The fwait instruction */
231     code[-1] = Opcode;        /* Insert the opcode     */
232 
233     if ( ISV86(context) && LOWORD(context->Eip) < 2 )
234         FIXME("Backed up over a real mode segment boundary in FPU code.\n");
235 
236     context->Eip -= 2; /* back up the return address 2 bytes */
237 
238     TRACE("Modified code in FPU int call to 0x9b 0x%x\n",Opcode);
239 }
240 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.