The last relay patch made it possible to simplify raw mode switch handling. Some rather complex code can now be deleted. Changelog: Remove unnecessary __wine_call_from_16_regs call frame management code from raw mode switch handler. Index: dlls/winedos/dosexe.h =================================================================== RCS file: /home/wine/wine/dlls/winedos/dosexe.h,v retrieving revision 1.28 diff -u -r1.28 dosexe.h --- dlls/winedos/dosexe.h 30 Jun 2003 02:03:48 -0000 1.28 +++ dlls/winedos/dosexe.h 20 Aug 2003 16:47:56 -0000 @@ -28,7 +28,6 @@ #include "miscemu.h" struct _DOSEVENT; -struct _STACK16FRAME; /* amount of space reserved for relay stack */ #define DOSVM_RELAY_DATA_SIZE 4096 @@ -256,8 +255,6 @@ /* relay.c */ void DOSVM_RelayHandler( CONTEXT86 * ); -void DOSVM_SaveCallFrame( CONTEXT86 *, struct _STACK16FRAME * ); -void DOSVM_RestoreCallFrame( CONTEXT86 *, struct _STACK16FRAME * ); void DOSVM_BuildCallFrame( CONTEXT86 *, DOSRELAY, LPVOID ); /* soundblaster.c */ Index: dlls/winedos/relay.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/relay.c,v retrieving revision 1.3 diff -u -r1.3 relay.c --- dlls/winedos/relay.c 19 Aug 2003 00:59:23 -0000 1.3 +++ dlls/winedos/relay.c 20 Aug 2003 16:37:31 -0000 @@ -172,81 +172,6 @@ /********************************************************************** - * DOSVM_SaveCallFrame - * - * Save current call frame. This routine must be called from DOSRELAY - * called using DOSVM_BuildCallFrame before the relay modifies stack - * pointer. This routine makes sure that the relay can return safely - * to application context and that no memory is leaked. - * - * Note: If DOSVM_BuildCallFrame was called using 32-bit CS or SS, - * old values of CS and SS will be lost. This does not matter - * since this routine is only used by Raw Mode Switch. - */ -void DOSVM_SaveCallFrame( CONTEXT86 *context, STACK16FRAME *frame ) -{ - *frame = *CURRENT_STACK16; - - /* - * If context is using allocated stack, release it. - */ - if (context->SegSs == DOSVM_dpmi_segments->relay_data_sel) - { - RELAY_Stack16 *stack = RELAY_GetPointer( context->Esp ); - - if (!stack->inuse || - stack->stack_bottom != RELAY_MAGIC || - stack->stack_top != RELAY_MAGIC) - ERR( "Stack corrupted!\n" ); - - stack->inuse = 0; - } -} - - -/********************************************************************** - * DOSVM_RestoreCallFrame - * - * Restore saved call frame to currect stack. This routine must always - * be called after DOSVM_SaveCallFrame has been called and before returning - * from DOSRELAY. - */ -void DOSVM_RestoreCallFrame( CONTEXT86 *context, STACK16FRAME *frame ) -{ - /* - * Allocate separate stack for relay call. - */ - RELAY_MakeShortContext( context ); - - /* - * After this function returns to relay code, protected mode - * 16 bit stack will contain STACK16FRAME and single WORD - * (EFlags, see next comment). - */ - NtCurrentTeb()->cur_stack = - MAKESEGPTR( context->SegSs, - context->Esp - sizeof(STACK16FRAME) - sizeof(WORD) ); - - /* - * After relay code returns to glue function, protected - * mode 16 bit stack will contain interrupt return record: - * IP, CS and EFlags. Since EFlags is ignored, it won't - * need to be initialized. - */ - context->Esp -= 3 * sizeof(WORD); - - /* - * Restore stack frame so that relay code won't be confused. - * It should be noted that relay code overwrites IP and CS - * in STACK16FRAME with values taken from current CONTEXT86. - * These values are what is returned to glue function - * (see previous comment). - */ - *CURRENT_STACK16 = *frame; -} - - -/********************************************************************** * DOSVM_BuildCallFrame * * Modifies the context so that return to context calls DOSRELAY and Index: dlls/winedos/int31.c =================================================================== RCS file: /home/wine/wine/dlls/winedos/int31.c,v retrieving revision 1.27 diff -u -r1.27 int31.c --- dlls/winedos/int31.c 8 Jul 2003 21:11:52 -0000 1.27 +++ dlls/winedos/int31.c 20 Aug 2003 16:37:39 -0000 @@ -675,11 +675,11 @@ /********************************************************************** - * RawModeSwitch (WINEDOS.@) + * DOSVM_RawModeSwitchHandler * * DPMI Raw Mode Switch handler */ -void WINAPI DOSVM_RawModeSwitch( CONTEXT86 *context ) +void WINAPI DOSVM_RawModeSwitchHandler( CONTEXT86 *context ) { CONTEXT86 rm_ctx; int ret; @@ -764,23 +764,6 @@ SET_AX( context, 0x8024 ); /* invalid callback address */ SET_CFLAG(context); } -} - - -/********************************************************************** - * DOSVM_RawModeSwitchHandler - * - * DPMI Raw Mode Switch handler. - * This routine does all the stack manipulation tricks needed - * to return from protected mode interrupt using modified - * code and stack pointers. - */ -void WINAPI DOSVM_RawModeSwitchHandler( CONTEXT86 *context ) -{ - STACK16FRAME frame; - DOSVM_SaveCallFrame( context, &frame ); - DOSVM_RawModeSwitch( context ); - DOSVM_RestoreCallFrame( context, &frame ); } -- Jukka Heinonen <http://www.iki.fi/jhei/>