Interrupts / DeviceIoControl cleanup

Jukka Heinonen jhei at iki.fi
Tue Nov 12 10:46:10 CST 2002


This patch removes the last user of INT_Int31Handler and removes
direct calls to some other handlers, too. After this patch,
INT_Int31Handler can finally be removed (I shall prepare a separate
patch for this). Also, the patch contains two-line fix for raw mode switch
wrapper. The infrastructure in this patch should make converting
DOS3Call and other similar functions that call interrupt handlers easier.


Changelog:
  DeviceIoControl now calls winedos interrupt handlers.
  Fixed RawModeSwitch.


Index: dlls/winedos/interrupts.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/interrupts.c,v
retrieving revision 1.6
diff -u -r1.6 interrupts.c
--- dlls/winedos/interrupts.c   6 Nov 2002 21:56:52 -0000       1.6
+++ dlls/winedos/interrupts.c   12 Nov 2002 16:21:28 -0000
@@ -137,6 +137,8 @@
 
   if(context->SegCs == DOSVM_dpmi_segments->int48_sel) 
     islong = FALSE;
+  else if(context->SegCs == DOSVM_dpmi_segments->dpmi_sel)
+    islong = FALSE;
   else if(DOSVM_IsDos32())
     islong = TRUE;
   else if(IS_SELECTOR_32BIT(context->SegCs)) {
@@ -289,4 +291,15 @@
 
   WARN("int%x not implemented, returning dummy handler\n", intnum );
   return DOSVM_DefaultHandler;
+}
+
+/**********************************************************************
+ *         DOSVM_CallBuiltinHandler
+ *
+ * Execute Wine interrupt handler procedure.
+ */
+void WINAPI DOSVM_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ) 
+{
+  INTPROC proc = DOSVM_GetBuiltinHandler( intnum );
+  proc( context );
 }



Index: dlls/winedos/winedos.spec
===================================================================
RCS file: /home/wine/wine/dlls/winedos/winedos.spec,v
retrieving revision 1.13
diff -u -r1.13 winedos.spec
--- dlls/winedos/winedos.spec   4 Nov 2002 23:53:43 -0000       1.13
+++ dlls/winedos/winedos.spec   12 Nov 2002 16:21:50 -0000
@@ -1,5 +1,6 @@
 @ stdcall LoadDosExe(str long) MZ_LoadImage
 @ stdcall EmulateInterruptPM(ptr long) DOSVM_EmulateInterruptPM
+@ stdcall CallBuiltinHandler(ptr long) DOSVM_CallBuiltinHandler
 
 # DPMI functions
 @ stdcall CallRMInt(ptr) DOSVM_CallRMInt



Index: include/callback.h
===================================================================
RCS file: /home/wine/wine/include/callback.h,v
retrieving revision 1.49
diff -u -r1.49 callback.h
--- include/callback.h  23 Oct 2002 22:24:10 -0000      1.49
+++ include/callback.h  12 Nov 2002 16:22:07 -0000
@@ -27,6 +27,7 @@
 typedef struct {
     void (WINAPI *LoadDosExe)( LPCSTR filename, HANDLE hFile );
     void (WINAPI *EmulateInterruptPM)( CONTEXT86 *context, BYTE intnum );
+    void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
 
     /* DPMI functions */
     void (WINAPI *CallRMInt)( CONTEXT86 *context );



Index: msdos/dpmi.c
===================================================================
RCS file: /home/wine/wine/msdos/dpmi.c,v
retrieving revision 1.69
diff -u -r1.69 dpmi.c
--- msdos/dpmi.c        23 Oct 2002 22:24:10 -0000      1.69
+++ msdos/dpmi.c        12 Nov 2002 16:22:24 -0000
@@ -75,6 +75,7 @@
     GET_ADDR(outport);
     GET_ADDR(ASPIHandler);
     GET_ADDR(EmulateInterruptPM);
+    GET_ADDR(CallBuiltinHandler);
 #undef GET_ADDR
     return TRUE;
 }



Index: win32/device.c
===================================================================
RCS file: /home/wine/wine/win32/device.c,v
retrieving revision 1.71
diff -u -r1.71 device.c
--- win32/device.c      3 Oct 2002 19:46:27 -0000       1.71
+++ win32/device.c      12 Nov 2002 16:22:51 -0000
@@ -44,6 +44,7 @@
 #include "stackframe.h"
 #include "wine/server.h"
 #include "wine/debug.h"
+#include "callback.h"
 
 /* int 13 stuff */
 #ifdef HAVE_SYS_IOCTL_H
@@ -1573,9 +1574,13 @@
 
                if(dwIoControlCode==IFS_IOCTL_21)
                {
-                       DOS3Call(&cxt); /* Call int 21h */
-               } else {
-                       INT_Int2fHandler(&cxt); /* Call int 2Fh */
+                    if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
+                        Dosvm.CallBuiltinHandler( &cxt, 0x21 );
+               } 
+                else 
+                {
+                    if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
+                        Dosvm.CallBuiltinHandler( &cxt, 0x2f );
                }
 
                CONTEXT_2_win32apieq(&cxt,pOut);
@@ -1640,7 +1645,8 @@
 
        SET_AX( context, callnum );
         SET_CX( context, parm );
-       INT_Int31Handler(context);
+        if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
+            Dosvm.CallBuiltinHandler( context, 0x31 );
 
        return LOWORD(context->Eax);
     }
@@ -1983,6 +1989,7 @@
         CONTEXT86 cxt;
         DIOC_REGISTERS *pIn  = (DIOC_REGISTERS *)lpvInBuffer;
         DIOC_REGISTERS *pOut = (DIOC_REGISTERS *)lpvOutBuffer;
+        BYTE intnum = 0;
 
         TRACE( "Control '%s': "
                "eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, "
@@ -1998,16 +2005,24 @@
 
         switch (dwIoControlCode)
         {
-        case VWIN32_DIOC_DOS_IOCTL: DOS3Call( &cxt ); break; /* Call int 21h */
-        case VWIN32_DIOC_DOS_INT13: INT_Int13Handler( &cxt ); break;
+        case VWIN32_DIOC_DOS_IOCTL: /* Call int 21h */
         case 0x10: /* Int 0x21 call, call it VWIN_DIOC_INT21 ? */
-                                   DOS3Call( &cxt ); break;
-        case VWIN32_DIOC_DOS_INT25: INT_Int25Handler( &cxt ); break;
-        case VWIN32_DIOC_DOS_INT26: INT_Int26Handler( &cxt ); break;
+        case VWIN32_DIOC_DOS_DRIVEINFO:        /* Call int 21h 730x */
+            intnum = 0x21;
+            break;
+        case VWIN32_DIOC_DOS_INT25: 
+            intnum = 0x25;
+            break;
+        case VWIN32_DIOC_DOS_INT26:
+            intnum = 0x26;
+            break;
         case 0x29: /* Int 0x31 call, call it VWIN_DIOC_INT31 ? */
-                                   INT_Int31Handler( &cxt ); break;
-        case VWIN32_DIOC_DOS_DRIVEINFO:        DOS3Call( &cxt ); break; /* Call int 21h 730x */
+            intnum = 0x31;
+            break;
         }
+
+        if(Dosvm.CallBuiltinHandler || DPMI_LoadDosSystem())
+            Dosvm.CallBuiltinHandler( &cxt, intnum );
 
         CONTEXT_2_DIOCRegs( &cxt, pOut );
     }




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



More information about the wine-patches mailing list