Improved shortcuts - follows jumps in trying to avoid switching to

real mode unnecessarily.
This commit is contained in:
Ove Kaaven 1999-05-17 16:05:16 +00:00 committed by Alexandre Julliard
parent a73b4278be
commit e9251b05b7

View file

@ -270,6 +270,7 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
RMCB *CurrRMCB;
int alloc = 0, already = 0;
BYTE *code;
GlobalUnlock16( GetCurrentTask() );
@ -281,6 +282,25 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
callrmproc_again:
/* there might be some code that just jumps to RMCBs or the like,
in which case following the jumps here might get us to a shortcut */
code = CTX_SEG_OFF_TO_LIN(context, CS_reg(context), EIP_reg(context));
switch (*code) {
case 0xe9: /* JMP NEAR */
IP_reg(context) += 3 + *(WORD *)(code+1);
/* yeah, I know these gotos don't look good... */
goto callrmproc_again;
case 0xea: /* JMP FAR */
IP_reg(context) = *(WORD *)(code+1);
CS_reg(context) = *(WORD *)(code+3);
/* ...but since the label is there anyway... */
goto callrmproc_again;
case 0xeb: /* JMP SHORT */
IP_reg(context) += 2 + *(signed char *)(code+1);
/* ...because of other gotos below, so... */
goto callrmproc_again;
}
/* shortcut for chaining to internal interrupt handlers */
if ((CS_reg(context) == 0xF000) && iret) {
return INT_RealModeInterrupt( IP_reg(context)/4, context);