winedos / Fix FPU emulation

Jukka Heinonen jhei at iki.fi
Wed Aug 20 12:02:44 CDT 2003


After a patch that changed relay code handling,
builtin interrupt handlers now see CS:IP that points
to instruction following the invoking int opcode.
This works both in real and protected mode, but
naturally only with software interrupts. 

If builtin handler is chained to, interrupt handlers see 
CS:IP that points to Wine interrupt stub. This can be
easily changed so that CS:IP points to original int opcode
(just pop IRET record in interrupts.c), but I don't really
know if this would be useful.






Changelog:
  Make FPU emulation use CS:IP when determining
  location of calling software interrupt.




Index: dlls/winedos/fpu.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/fpu.c,v
retrieving revision 1.2
diff -u -r1.2 fpu.c
--- dlls/winedos/fpu.c	18 Aug 2003 20:04:27 -0000	1.2
+++ dlls/winedos/fpu.c	20 Aug 2003 16:50:13 -0000
@@ -222,8 +222,7 @@
  */
 static void FPU_ModifyCode(CONTEXT86 *context, BYTE Opcode)
 {
-    WORD *stack = CTX_SEG_OFF_TO_LIN(context, context->SegSs, context->Esp);
-    BYTE *code =  CTX_SEG_OFF_TO_LIN(context, stack[1], stack[0]);
+    BYTE *code = CTX_SEG_OFF_TO_LIN(context, context->SegCs, context->Eip);
 
     /*
      * All *NIX systems should have a real or kernel emulated FPU.
@@ -232,9 +231,10 @@
     code[-2] = 0x9b;          /* The fwait instruction */
     code[-1] = Opcode;        /* Insert the opcode     */
 
-    if ( stack[0] < 2 ) FIXME("Backed up over a segment boundry in FPU code.\n");
+    if ( ISV86(context) && LOWORD(context->Eip) < 2 )
+        FIXME("Backed up over a real mode segment boundary in FPU code.\n");
 
-    stack[0] -= 2;             /* back up the return address 2 bytes */
+    context->Eip -= 2; /* back up the return address 2 bytes */
 
     TRACE("Modified code in FPU int call to 0x9b 0x%x\n",Opcode);
 }




-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list