DOSVM now exports DPMI Raw Mode Switch routine.

This commit is contained in:
Jukka Heinonen 2002-05-05 21:06:51 +00:00 committed by Alexandre Julliard
parent b9627c1486
commit 09537b76f7
2 changed files with 22 additions and 29 deletions

View File

@ -512,31 +512,23 @@ void WINAPI DPMI_FreeInternalRMCB( FARPROC16 proc )
/* DPMI Raw Mode Switch handler */ /* DPMI Raw Mode Switch handler */
#if 0 void WINAPI DOSVM_RawModeSwitch( CONTEXT86 *context )
void WINAPI DPMI_RawModeSwitch( SIGCONTEXT *context )
{ {
LPDOSTASK lpDosTask = MZ_Current();
CONTEXT86 rm_ctx; CONTEXT86 rm_ctx;
int ret; int ret;
if (!lpDosTask) {
/* we could probably start a DPMI-only dosmod task here, but I doubt
anything other than real DOS apps want to call raw mode switch */
ERR("attempting raw mode switch without DOS task!\n");
ExitProcess(1);
}
/* initialize real-mode context as per spec */ /* initialize real-mode context as per spec */
memset(&rm_ctx, 0, sizeof(rm_ctx)); memset(&rm_ctx, 0, sizeof(rm_ctx));
rm_ctx.SegDs = AX_sig(context); rm_ctx.SegDs = AX_reg(context);
rm_ctx.SegEs = CX_sig(context); rm_ctx.SegEs = CX_reg(context);
rm_ctx.SegSs = DX_sig(context); rm_ctx.SegSs = DX_reg(context);
rm_ctx.Esp = EBX_sig(context); rm_ctx.Esp = context->Ebx;
rm_ctx.SegCs = SI_sig(context); rm_ctx.SegCs = SI_reg(context);
rm_ctx.Eip = EDI_sig(context); rm_ctx.Eip = context->Edi;
rm_ctx.Ebp = EBP_sig(context); rm_ctx.Ebp = context->Ebp;
rm_ctx.SegFs = 0; rm_ctx.SegFs = 0;
rm_ctx.SegGs = 0; rm_ctx.SegGs = 0;
rm_ctx.EFlags = EFL_sig(context); /* at least we need the IF flag */ rm_ctx.EFlags = context->EFlags; /* at least we need the IF flag */
/* enter real mode again */ /* enter real mode again */
TRACE("re-entering real mode at %04lx:%04lx\n",rm_ctx.SegCs,rm_ctx.Eip); TRACE("re-entering real mode at %04lx:%04lx\n",rm_ctx.SegCs,rm_ctx.Eip);
@ -545,26 +537,26 @@ void WINAPI DPMI_RawModeSwitch( SIGCONTEXT *context )
DOSVM_Enter will return and we will continue here */ DOSVM_Enter will return and we will continue here */
if (ret<0) { if (ret<0) {
ERR("Sync lost!\n");
/* if the sync was lost, there's no way to recover */ /* if the sync was lost, there's no way to recover */
ExitProcess(1); ExitProcess(1);
} }
/* alter protected-mode context as per spec */ /* alter protected-mode context as per spec */
DS_sig(context) = LOWORD(rm_ctx.Eax); context->SegDs = LOWORD(rm_ctx.Eax);
ES_sig(context) = LOWORD(rm_ctx.Ecx); context->SegEs = LOWORD(rm_ctx.Ecx);
SS_sig(context) = LOWORD(rm_ctx.Edx); context->SegSs = LOWORD(rm_ctx.Edx);
ESP_sig(context) = rm_ctx.Ebx; context->Esp = rm_ctx.Ebx;
CS_sig(context) = LOWORD(rm_ctx.Esi); context->SegCs = LOWORD(rm_ctx.Esi);
EIP_sig(context) = rm_ctx.Edi; context->Eip = rm_ctx.Edi;
EBP_sig(context) = rm_ctx.Ebp; context->Ebp = rm_ctx.Ebp;
FS_sig(context) = 0; context->SegFs = 0;
GS_sig(context) = 0; context->SegGs = 0;
/* Return to new address and hope that we didn't mess up */ /* Return to new address and hope that we didn't mess up */
TRACE("re-entering protected mode at %04x:%08lx\n", TRACE("re-entering protected mode at %04lx:%08lx\n",
CS_sig(context), EIP_sig(context)); context->SegCs, context->Eip);
} }
#endif
/********************************************************************** /**********************************************************************

View File

@ -15,6 +15,7 @@ debug_channels (aspi console ddraw int int21 int31 module relay)
@ stdcall CallRMProc(ptr long) DOSVM_CallRMProc @ stdcall CallRMProc(ptr long) DOSVM_CallRMProc
@ stdcall AllocRMCB(ptr) DOSVM_AllocRMCB @ stdcall AllocRMCB(ptr) DOSVM_AllocRMCB
@ stdcall FreeRMCB(ptr) DOSVM_FreeRMCB @ stdcall FreeRMCB(ptr) DOSVM_FreeRMCB
@ stdcall RawModeSwitch(ptr) DOSVM_RawModeSwitch
# I/O functions # I/O functions
@ stdcall SetTimer(long) DOSVM_SetTimer @ stdcall SetTimer(long) DOSVM_SetTimer