DPMI RawModeSwitch support added

Jukka Heinonen jhei at iki.fi
Sun May 5 04:59:09 CDT 2002


This patch requires the previous RawModeSwitch patch.
It seems to work at least with pkunzip (most other protected
mode programs require more from DPMI).

The patch does some potentially nasty things in memory/instr.c:
- indirect jump to RawModeSwitch routine using interrupt handler.
- directly calling interrupt handler so that I don't 
  have to worry about relay code.


Changelog:
  Added support for DPMI RawModeSwitch.


Index: include/callback.h
===================================================================
RCS file: /home/wine/wine/include/callback.h,v
retrieving revision 1.47
diff -u -r1.47 callback.h
--- include/callback.h  10 Mar 2002 00:02:34 -0000      1.47
+++ include/callback.h  5 May 2002 09:49:49 -0000
@@ -32,6 +32,7 @@
     void (WINAPI *CallRMProc)( CONTEXT86 *context, int iret );
     void (WINAPI *AllocRMCB)( CONTEXT86 *context );
     void (WINAPI *FreeRMCB)( CONTEXT86 *context );
+    void (WINAPI *RawModeSwitch)( CONTEXT86 *context );
 
     /* I/O functions */
     void (WINAPI *SetTimer)( unsigned ticks );



Index: msdos/int2f.c
===================================================================
RCS file: /home/wine/wine/msdos/int2f.c,v
retrieving revision 1.40
diff -u -r1.40 int2f.c
--- msdos/int2f.c       10 Mar 2002 00:18:35 -0000      1.40
+++ msdos/int2f.c       5 May 2002 09:50:32 -0000
@@ -356,9 +356,6 @@
         break;
 
     case 0x87: /* DPMI installation check */
-#if 1   /* DPMI still breaks pkunzip */
-        if (ISV86(context)) break; /* so bail out for now if in v86 mode */
-#endif
         {
            SYSTEM_INFO si;
            GetSystemInfo(&si);



Index: msdos/dpmi.c
===================================================================
RCS file: /home/wine/wine/msdos/dpmi.c,v
retrieving revision 1.61
diff -u -r1.61 dpmi.c
--- msdos/dpmi.c        10 Mar 2002 00:18:35 -0000      1.61
+++ msdos/dpmi.c        5 May 2002 09:50:59 -0000
@@ -65,6 +65,7 @@
     GET_ADDR(CallRMProc);
     GET_ADDR(AllocRMCB);
     GET_ADDR(FreeRMCB);
+    GET_ADDR(RawModeSwitch);
     GET_ADDR(SetTimer);
     GET_ADDR(GetTimer);
     GET_ADDR(inport);
@@ -190,6 +191,15 @@
     else Dosvm.FreeRMCB( context );
 }
 
+static void RawModeSwitch( CONTEXT86 *context )
+{
+    if (!Dosvm.RawModeSwitch)
+    {
+      ERR("could not setup real-mode calls\n");
+      return;
+    }
+    else Dosvm.RawModeSwitch( context );
+}
 
 /**********************************************************************
  *         INT_Int31Handler (WPROCS.149)
@@ -206,6 +216,11 @@
      */
     DWORD dw;
     BYTE *ptr;
+
+    if (context->SegCs == DOSMEM_dpmi_sel) { 
+        RawModeSwitch( context );
+        return;
+    }
 
     RESET_CFLAG(context);
     switch(AX_reg(context))



Index: memory/instr.c
===================================================================
RCS file: /home/wine/wine/memory/instr.c,v
retrieving revision 1.14
diff -u -r1.14 instr.c
--- memory/instr.c      10 Mar 2002 00:18:34 -0000      1.14
+++ memory/instr.c      5 May 2002 09:51:32 -0000
@@ -684,7 +684,11 @@
             break;  /* Unable to emulate it */
             
         case 0xcd: /* int <XX> */
-            if (long_op)
+           if (instr[1] == 0x31 && context->SegCs == DOSMEM_dpmi_sel) 
+            {
+               INT_Int31Handler( context );
+           } 
+            else if (long_op)
             {
                 ERR("int xx from 32-bit code is not supported.\n");
                 break;  /* Unable to emulate it */



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



More information about the wine-patches mailing list