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.
oldstable
Jukka Heinonen 2003-08-25 01:01:01 +00:00 committed by Alexandre Julliard
parent 3be5d62b29
commit be3b2569c7
8 changed files with 32 additions and 21 deletions

View File

@ -547,6 +547,7 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
/* 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);

View File

@ -82,6 +82,8 @@ DOSASPI_PostProc( SRB_ExecSCSICmd *lpPRB )
/* 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);

View File

@ -88,7 +88,14 @@ extern struct DPMI_segments *DOSVM_dpmi_segments;
# 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)

View File

@ -61,9 +61,6 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
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 @@ void WINAPI DOSVM_Wait( CONTEXT86 *waitctx )
*/
if (!ISV86(&context))
{
context.EFlags |= 0x00020000;
context.EFlags |= V86_FLAG;
context.SegSs = 0xffff;
context.Esp = 0;
}
@ -580,8 +577,8 @@ static WINE_EXCEPTION_FILTER(exception_handler)
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
{

View File

@ -696,7 +696,12 @@ void WINAPI DOSVM_RawModeSwitchHandler( CONTEXT86 *context )
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);
@ -721,6 +726,12 @@ void WINAPI DOSVM_RawModeSwitchHandler( CONTEXT86 *context )
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",
context->SegCs, context->Eip);

View File

@ -139,6 +139,12 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
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;

View File

@ -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);

View File

@ -574,7 +574,7 @@ static DWORD WINAPI MZ_DOSVM( LPVOID lpExtra )
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 );