winedos / Some V86 flag cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is just a minor cleanup that fixes a few small bugs.




Changelog:
  Make all users of DOSVM_Enter explicitly set V86 flag.
  Fix mouse relay stack usage in protected mode.
  Raw mode switch now handles interrupt flag correctly.




Index: dlls/winedos/devices.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/devices.c,v
retrieving revision 1.8
diff -u -r1.8 devices.c
--- dlls/winedos/devices.c	2 May 2003 20:12:52 -0000	1.8
+++ dlls/winedos/devices.c	24 Aug 2003 18:57:56 -0000
@@ -547,6 +547,7 @@
 
   /* prepare to call device driver */
   memset(&ctx, 0, sizeof(ctx));
+  ctx.EFlags |= V86_FLAG;
 
   /* ES:BX points to request for strategy routine */
   ctx.SegEs = HIWORD(DOS_LOLSeg);




Index: dlls/winedos/dosaspi.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosaspi.c,v
retrieving revision 1.8
diff -u -r1.8 dosaspi.c
--- dlls/winedos/dosaspi.c	18 Nov 2002 22:53:39 -0000	1.8
+++ dlls/winedos/dosaspi.c	24 Aug 2003 18:57:57 -0000
@@ -82,6 +82,8 @@
 
 		/* Zero everything */
 		memset(&ctx, 0, sizeof(ctx));
+                ctx.EFlags |= V86_FLAG;
+
 		/* CS:IP is routine to call */
 		ctx.SegCs = SELECTOROF(lpSRB16->cmd.SRB_PostProc);
 		ctx.Eip   = OFFSETOF(lpSRB16->cmd.SRB_PostProc);




Index: dlls/winedos/dosexe.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v
retrieving revision 1.29
diff -u -r1.29 dosexe.h
--- dlls/winedos/dosexe.h	20 Aug 2003 18:17:23 -0000	1.29
+++ dlls/winedos/dosexe.h	24 Aug 2003 18:57:59 -0000
@@ -88,7 +88,14 @@
 # define MZ_SUPPORTED
 #endif /* linux-i386 */
 
+/*
+ * Declare some CONTEXT86.EFlags bits.
+ * IF_MASK is only pushed into real mode stack.
+ */
 #define V86_FLAG 0x00020000
+#define IF_MASK  0x00000200
+#define VIF_MASK 0x00080000
+#define VIP_MASK 0x00100000
 
 #define BIOS_DATA ((void *)0x400)
 




Index: dlls/winedos/dosvm.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosvm.c,v
retrieving revision 1.46
diff -u -r1.46 dosvm.c
--- dlls/winedos/dosvm.c	12 Aug 2003 23:50:55 -0000	1.46
+++ dlls/winedos/dosvm.c	24 Aug 2003 18:58:02 -0000
@@ -61,9 +61,6 @@
 WORD DOSVM_psp = 0;
 WORD DOSVM_retval = 0;
 
-#ifdef HAVE_SYS_VM86_H
-# include <sys/vm86.h>
-#endif
 #ifdef HAVE_SYS_MMAN_H
 # include <sys/mman.h>
 #endif
@@ -416,7 +413,7 @@
          */
         if (!ISV86(&context))
         {
-            context.EFlags |= 0x00020000;
+            context.EFlags |= V86_FLAG;
             context.SegSs = 0xffff;
             context.Esp = 0;
         }
@@ -580,8 +577,8 @@
 
 int WINAPI DOSVM_Enter( CONTEXT86 *context )
 {
-  /* Some callers forget to turn V86_FLAG on. */
-  context->EFlags |= V86_FLAG;
+  if (!ISV86(context))
+      ERR( "Called with protected mode context!\n" );
 
   __TRY
   {




Index: dlls/winedos/int31.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int31.c,v
retrieving revision 1.29
diff -u -r1.29 int31.c
--- dlls/winedos/int31.c	23 Aug 2003 23:30:51 -0000	1.29
+++ dlls/winedos/int31.c	24 Aug 2003 18:58:04 -0000
@@ -696,7 +696,12 @@
   rm_ctx.Ebp    = context->Ebp;
   rm_ctx.SegFs  = 0;
   rm_ctx.SegGs  = 0;
-  rm_ctx.EFlags = context->EFlags; /* at least we need the IF flag */
+
+  /* Copy interrupt state. */
+  if (NtCurrentTeb()->dpmi_vif)
+      rm_ctx.EFlags = V86_FLAG | VIF_MASK;
+  else
+      rm_ctx.EFlags = V86_FLAG;
 
   /* enter real mode again */
   TRACE("re-entering real mode at %04lx:%04lx\n",rm_ctx.SegCs,rm_ctx.Eip);
@@ -720,6 +725,12 @@
   context->Ebp     = rm_ctx.Ebp;
   context->SegFs   = 0;
   context->SegGs   = 0;
+
+  /* Copy interrupt state. */
+  if (rm_ctx.EFlags & VIF_MASK)
+      NtCurrentTeb()->dpmi_vif = 1;
+  else
+      NtCurrentTeb()->dpmi_vif = 0;
 
   /* Return to new address and hope that we didn't mess up */
   TRACE("re-entering protected mode at %04lx:%08lx\n",




Index: dlls/winedos/int33.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int33.c,v
retrieving revision 1.10
diff -u -r1.10 int33.c
--- dlls/winedos/int33.c	8 Jul 2003 21:11:52 -0000	1.10
+++ dlls/winedos/int33.c	24 Aug 2003 18:58:06 -0000
@@ -139,6 +139,12 @@
   MCALLDATA *data = (MCALLDATA *)mdata;
   CONTEXT86 ctx = *context;
 
+  if (!ISV86(&ctx))
+  {
+      ctx.EFlags |= V86_FLAG;
+      ctx.SegSs = 0; /* Allocate new stack. */
+  }
+
   ctx.Eax   = data->mask;
   ctx.Ebx   = data->but;
   ctx.Ecx   = data->x;




Index: dlls/winedos/interrupts.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/interrupts.c,v
retrieving revision 1.19
diff -u -r1.19 interrupts.c
--- dlls/winedos/interrupts.c	18 Aug 2003 19:52:28 -0000	1.19
+++ dlls/winedos/interrupts.c	24 Aug 2003 18:58:08 -0000
@@ -26,19 +26,6 @@
 
 #include "thread.h"
 
-#ifdef HAVE_SYS_VM86_H
-# include <sys/vm86.h>
-#endif
-
-#ifndef IF_MASK
-#define IF_MASK 0x00000200
-#endif
-
-#ifndef VIF_MASK
-#define VIF_MASK 0x00080000
-#endif
-
-
 WINE_DEFAULT_DEBUG_CHANNEL(int);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
 




Index: dlls/winedos/module.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/module.c,v
retrieving revision 1.35
diff -u -r1.35 module.c
--- dlls/winedos/module.c	30 Jun 2003 02:03:48 -0000	1.35
+++ dlls/winedos/module.c	24 Aug 2003 18:58:11 -0000
@@ -574,7 +574,7 @@
   context.Esp    = init_sp;
   context.SegDs  = DOSVM_psp;
   context.SegEs  = DOSVM_psp;
-  context.EFlags = 0x00080000;  /* virtual interrupt flag */
+  context.EFlags = V86_FLAG | VIF_MASK;
   DOSVM_SetTimer(0x10000);
   ret = DOSVM_Enter( &context );
 



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


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux