FPU self modifying code patches to fix bug 586.

admiral coeyman admiral at corner.net
Sun Jun 9 00:55:53 CDT 2002


I've read that all *BSD/LINUX systems have an FPU because the kernel will
emulate one if you don't have one.  Therefore, we can just use the self
modifying code solution and let the kernel do the hard stuff.
	I did not implement int 0x3c because I'm not sure what it is like yet.  I've
got a handler for it to show when it is used.
	--Admiral Coeyman
 
---
May you live as long as you wish and age but a single day.
http://www.dotguy.net/                 admiral at corner.net
Webmaster/ Linux Administrator         Computer Co-Op/CornerNet
-------------- next part --------------
Index: dlls/kernel/wprocs.spec
===================================================================
RCS file: /home/wine/wine/dlls/kernel/wprocs.spec,v
retrieving revision 1.7
diff -u -u -r1.7 wprocs.spec
--- dlls/kernel/wprocs.spec	14 Dec 2001 23:14:23 -0000	1.7
+++ dlls/kernel/wprocs.spec	9 Jun 2002 05:41:42 -0000
@@ -17,6 +17,15 @@
 142 pascal -interrupt INT_Int2aHandler() INT_Int2aHandler
 147 pascal -interrupt INT_Int2fHandler() INT_Int2fHandler
 149 pascal -interrupt INT_Int31Handler() INT_Int31Handler
+152 pascal -interrupt INT_Int34Handler() INT_Int34Handler
+153 pascal -interrupt INT_Int35Handler() INT_Int35Handler
+154 pascal -interrupt INT_Int36Handler() INT_Int36Handler
+155 pascal -interrupt INT_Int37Handler() INT_Int37Handler
+156 pascal -interrupt INT_Int38Handler() INT_Int38Handler
+157 pascal -interrupt INT_Int39Handler() INT_Int39Handler
+158 pascal -interrupt INT_Int3aHandler() INT_Int3aHandler
+159 pascal -interrupt INT_Int3bHandler() INT_Int3bHandler
+160 pascal -interrupt INT_Int3cHandler() INT_Int3cHandler
 161 pascal -interrupt INT_Int3dHandler() INT_Int3dHandler
 165 pascal -interrupt INT_Int41Handler() INT_Int41Handler
 175 pascal -interrupt INT_Int4bHandler() INT_Int4bHandler
Index: dlls/winedos/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winedos/Makefile.in,v
retrieving revision 1.13
diff -u -u -r1.13 Makefile.in
--- dlls/winedos/Makefile.in	23 May 2002 02:46:10 -0000	1.13
+++ dlls/winedos/Makefile.in	9 Jun 2002 05:41:42 -0000
@@ -21,6 +21,16 @@
 	int29.c \
 	int31.c \
 	int33.c \
+	int33.c \
+	int34.c \
+	int35.c \
+	int36.c \
+	int37.c \
+	int38.c \
+	int39.c \
+	int3a.c \
+	int3b.c \
+	int3c.c \
 	int67.c \
 	ioports.c \
 	module.c \
Index: dlls/winedos/dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.7
diff -u -u -r1.7 dosexe.h
--- dlls/winedos/dosexe.h	16 May 2002 18:34:48 -0000	1.7
+++ dlls/winedos/dosexe.h	9 Jun 2002 05:41:42 -0000
@@ -114,6 +114,35 @@
 extern void WINAPI DOSVM_Int33Message(UINT,WPARAM,LPARAM);
 extern void WINAPI DOSVM_Int33Console(MOUSE_EVENT_RECORD*);
 
+/* int34.c */
+extern void WINAPI INT_Int34Handler(CONTEXT86*);
+
+/* int35.c */
+extern void WINAPI INT_Int35Handler(CONTEXT86*);
+
+/* int36.c */
+extern void WINAPI INT_Int36Handler(CONTEXT86*);
+
+/* int37.c */
+extern void WINAPI INT_Int37Handler(CONTEXT86*);
+
+/* int38.c */
+extern void WINAPI INT_Int38Handler(CONTEXT86*);
+
+/* int39.c */
+extern void WINAPI INT_Int39Handler(CONTEXT86*);
+
+/* int3a.c */
+extern void WINAPI INT_Int3aHandler(CONTEXT86*);
+
+/* int3b.c */
+extern void WINAPI INT_Int3bHandler(CONTEXT86*);
+
+/* int3c.c */
+extern void WINAPI INT_Int3cHandler(CONTEXT86*);
+
+
+
 /* int67.c */
 extern void WINAPI DOSVM_Int67Handler(CONTEXT86*);
 extern void WINAPI EMS_Ioctl_Handler(CONTEXT86*);
Index: dlls/winedos/dosvm.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosvm.c,v
retrieving revision 1.19
diff -u -u -r1.19 dosvm.c
--- dlls/winedos/dosvm.c	31 May 2002 23:40:54 -0000	1.19
+++ dlls/winedos/dosvm.c	9 Jun 2002 05:41:43 -0000
@@ -652,8 +652,8 @@
     /* 18 */ 0, 0, INT_Int1aHandler, 0, 0, 0, 0, 0,
     /* 20 */ DOSVM_Int20Handler, DOSVM_Int21Handler, 0, 0, 0, INT_Int25Handler, 0, 0,
     /* 28 */ 0, DOSVM_Int29Handler, INT_Int2aHandler, 0, 0, 0, 0, INT_Int2fHandler,
-    /* 30 */ 0, DOSVM_Int31Handler, 0, DOSVM_Int33Handler, 0, 0, 0, 0,
-    /* 38 */ 0, 0, 0, 0, 0, 0, 0, 0,
+    /* 30 */ 0, DOSVM_Int31Handler, 0, DOSVM_Int33Handler, INT_Int34Handler, INT_Int35Handler, INT_Int36Handler, INT_Int37Handler,
+    /* 38 */ INT_Int38Handler, INT_Int39Handler, INT_Int3aHandler, INT_Int3bHandler, INT_Int3cHandler, 0, 0, 0,
     /* 40 */ 0, 0, 0, 0, 0, 0, 0, 0,
     /* 48 */ 0, 0, 0, 0, 0, 0, 0, 0,
     /* 50 */ 0, 0, 0, 0, 0, 0, 0, 0,
Index: dlls/winedos/ioports.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/ioports.c,v
retrieving revision 1.4
diff -u -u -r1.4 ioports.c
--- dlls/winedos/ioports.c	31 May 2002 23:40:54 -0000	1.4
+++ dlls/winedos/ioports.c	9 Jun 2002 05:41:43 -0000
@@ -45,6 +45,17 @@
     case 0x3da:
         *res = (DWORD)VGA_ioport_in( port );
         break;
+    case 0x3cf:
+	/* Graphics control data register. 
+	   The index is written to the port at 0x3ce to
+ 	   select the function:
+	   0 - set/reset             1 - Enable Set/Reset
+	   2 - Color Compare         3 - Data Rotate value
+	   4 - Memory Plane to Read  5 - Mode Register 1
+	   6 - Mode Register 2       7 - Ignore Color Compare
+	   8 - Bit Mask for plane changes */
+
+	return FALSE;  /* not implemented yet */ 				
     case 0x00:
     case 0x01:
     case 0x02:
@@ -106,6 +117,16 @@
     case 0x3c9:
         VGA_ioport_out( port, (BYTE)value );
         break;
+    case 0x3ce:
+	/* Graphics Control Select Register.
+	   Selects the function for 0x3cf:
+	   0 - set/reset             1 - Enable Set/Reset
+	   2 - Color Compare         3 - Data Rotate value
+	   4 - Memory Plane to Read  5 - Mode Register 1
+	   6 - Mode Register 2       7 - Ignore Color Compare
+	   8 - Bit Mask for plane changes */
+
+	return FALSE;  /* not implemented yet. */	
     case 0x00:
     case 0x01:
     case 0x02:
Index: msdos/int3d.c
===================================================================
RCS file: /home/wine/wine/msdos/int3d.c,v
retrieving revision 1.6
diff -u -u -r1.6 int3d.c
--- msdos/int3d.c	10 Mar 2002 00:18:35 -0000	1.6
+++ msdos/int3d.c	9 Jun 2002 05:41:43 -0000
@@ -28,11 +28,37 @@
  *          INT_Int3dHandler (WPROCS.161)
  *
  * Handler for int 3d (FLOATING POINT EMULATION - STANDALONE FWAIT).
+ *
+ * We'll work with the assertion that all systems have FPUs and
+ *  handle the exceptions as exceptions to the rule. This requires
+ *  getting the address in ss:sp, writing 9b 00	to that address-2
+ *  changing ss:sp to point to the address ss:sp -2 and returning.
+ *              --Robert 'Admiral' Coeyman
  */
 void WINAPI INT_Int3dHandler(CONTEXT86 *context)
 {
+    BYTE *codepointer;
+
+/* Are the addresses on the stack stored the right way around? */
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0x90 */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0x90; /* nop  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait  */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
     switch(AH_reg(context))
     {
+
     case 0x00:
         break;
 
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int34.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 34 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int34Handler (WPROCS.152)
+ *
+ * Handler for int 34 (FLOATING POINT EMULATION - Opcode 0xd8).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int34Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x34 called-- FP opcode 0xd8");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xd8 */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xd8; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int35.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 35 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int35Handler (WPROCS.153)
+ *
+ * Handler for int 35 (FLOATING POINT EMULATION - Opcode 0xd9).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int35Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x35 called-- FP opcode 0xd9");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xd9 */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xd9; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int36.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 36 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int36Handler (WPROCS.154)
+ *
+ * Handler for int 36 (FLOATING POINT EMULATION - Opcode 0xda).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int36Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x36 called-- FP opcode 0xda");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xda */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xda; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int37.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 37 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int37Handler (WPROCS.155)
+ *
+ * Handler for int 37 (FLOATING POINT EMULATION - Opcode 0xdb).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int37Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x37 called-- FP opcode 0xdb");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xdb */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xdb; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int38.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,62 @@
+/*
+ * DOS interrupt 38 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int38Handler (WPROCS.156)
+ *
+ * Handler for int 38 (FLOATING POINT EMULATION - Opcode 0xdc).
+ *
+ *  Between versions 3.0 and 5.01, the original PC-MOS API call that
+ *  was here was moved to int 0xd4.
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int38Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x38 called-- FP opcode 0xdc");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xdc */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xdc; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int39.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 39 handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int39Handler (WPROCS.157)
+ *
+ * Handler for int 39 (FLOATING POINT EMULATION - Opcode 0xdd).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int39Handler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x39 called-- FP opcode 0xdd");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xdd */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xdd; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int3a.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 3A handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int3aHandler (WPROCS.158)
+ *
+ * Handler for int 3a (FLOATING POINT EMULATION - Opcode 0xde).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int3aHandler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x3A called-- FP opcode 0xde");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xde */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xde; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int3b.c	Sat Jun  8 05:50:20 2002
@@ -0,0 +1,59 @@
+/*
+ * DOS interrupt 3B handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int3bHandler (WPROCS.159)
+ *
+ * Handler for int 3B (FLOATING POINT EMULATION - Opcode 0xdf).
+ *
+ *  The interrupt list isn't specific about what this interrupt
+ *  actually does. [ interrup.m ] 
+ */
+void WINAPI INT_Int3bHandler(CONTEXT86 *context)
+{
+    BYTE *codepointer;
+
+	TRACE("Int 0x3B called-- FP opcode 0xdf");
+
+/* this section should only execute if you have an FPU */
+   /* first I have to get the return address. */
+    BYTE *retpointer=(BYTE *)CTX_SEG_OFF_TO_LIN(context,context->SegSs,context->Esp);
+/* now I have to convert THAT to a linear address. */
+   	codepointer=(BYTE *)DOSMEM_MapDosToLinear(DOSMEM_MapRealToLinear((DWORD)*retpointer));
+    /* so that I can change the code at that location to 0x9b, 0xdf */
+	codepointer--;     /* back up one byte  */
+	*codepointer=0xdf; /* The FPU opcode  */
+	codepointer--;     /* back up two bytes */
+	*codepointer=0x9b; /* fwait prefix */
+/* Finally, we have to save the new IP in ss:sp */
+	*retpointer=DOSMEM_MapLinearToDos((LPVOID *)codepointer);
+	return;                                 /* just return here */
+/* End of the section */        
+
+}
+
--- /dev/null	Sun Jul 17 19:46:18 1994
+++ dlls/winedos/int3c.c	Sun Jun  9 01:43:36 2002
@@ -0,0 +1,50 @@
+/*
+ * DOS interrupt 3C handler.
+ * Copyright 2002 Robert 'Admiral' Coeyman
+ *
+ * X11 Friendly.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdlib.h>
+#include "msdos.h"
+#include "miscemu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(int);
+
+/**********************************************************************
+ *          INT_Int3cHandler (WPROCS.160)
+ *
+ * Handler for int 3C (FLOATING POINT EMULATION - INSTRUCTIONS WITH SEGMENT OVERRIDE).
+ *
+ *  Generated code is CD 3C xy mm ... (CD = int | 3C = this interrupt)
+ *   xy is a modified ESC code and mm is the modR/M byte.
+ *   xy byte seems to be encoded as ss011xxx  or ss000xxx
+ *   ss= segment override.
+ *	00 -> DS
+ *	01 -> SS
+ *	10 -> CS
+ *	11 -> ES
+ *
+ *  11011xxx should be the opcode instruction.
+ */
+void WINAPI INT_Int3cHandler(CONTEXT86 *context)
+{
+	FIXME("Int 3C NOT Implemented");
+	INT_BARF(context, 0x3c);
+}
+


More information about the wine-patches mailing list