Commit 7d8cfeb9 authored by Alexandre Julliard's avatar Alexandre Julliard

Removed IP_reg, SP_reg and FL_reg definitions to avoid potential

aliasing optimization problems.
parent bdf83bc5
......@@ -31,22 +31,22 @@ void DEBUG_SetRegister( enum debug_regs reg, int val )
case REG_EFL: EFL_reg(&DEBUG_context) = val; break;
case REG_EIP: EIP_reg(&DEBUG_context) = val; break;
case REG_ESP: ESP_reg(&DEBUG_context) = val; break;
case REG_AX: AX_reg(&DEBUG_context) = val; break;
case REG_BX: BX_reg(&DEBUG_context) = val; break;
case REG_CX: CX_reg(&DEBUG_context) = val; break;
case REG_DX: DX_reg(&DEBUG_context) = val; break;
case REG_SI: SI_reg(&DEBUG_context) = val; break;
case REG_DI: DI_reg(&DEBUG_context) = val; break;
case REG_BP: BP_reg(&DEBUG_context) = val; break;
case REG_FL: FL_reg(&DEBUG_context) = val; break;
case REG_IP: IP_reg(&DEBUG_context) = val; break;
case REG_SP: SP_reg(&DEBUG_context) = val; break;
case REG_CS: CS_reg(&DEBUG_context) = val; break;
case REG_DS: DS_reg(&DEBUG_context) = val; break;
case REG_ES: ES_reg(&DEBUG_context) = val; break;
case REG_SS: SS_reg(&DEBUG_context) = val; break;
case REG_FS: FS_reg(&DEBUG_context) = val; break;
case REG_GS: GS_reg(&DEBUG_context) = val; break;
case REG_AX: SET_LOWORD(EAX_reg(&DEBUG_context),val); break;
case REG_BX: SET_LOWORD(EBX_reg(&DEBUG_context),val); break;
case REG_CX: SET_LOWORD(ECX_reg(&DEBUG_context),val); break;
case REG_DX: SET_LOWORD(EDX_reg(&DEBUG_context),val); break;
case REG_SI: SET_LOWORD(ESI_reg(&DEBUG_context),val); break;
case REG_DI: SET_LOWORD(EDI_reg(&DEBUG_context),val); break;
case REG_BP: SET_LOWORD(EBP_reg(&DEBUG_context),val); break;
case REG_FL: SET_LOWORD(EFL_reg(&DEBUG_context),val); break;
case REG_IP: SET_LOWORD(EIP_reg(&DEBUG_context),val); break;
case REG_SP: SET_LOWORD(ESP_reg(&DEBUG_context),val); break;
}
}
......@@ -105,22 +105,22 @@ int DEBUG_GetRegister( enum debug_regs reg )
case REG_EFL: return EFL_reg(&DEBUG_context);
case REG_EIP: return EIP_reg(&DEBUG_context);
case REG_ESP: return ESP_reg(&DEBUG_context);
case REG_AX: return AX_reg(&DEBUG_context);
case REG_BX: return BX_reg(&DEBUG_context);
case REG_CX: return CX_reg(&DEBUG_context);
case REG_DX: return DX_reg(&DEBUG_context);
case REG_SI: return SI_reg(&DEBUG_context);
case REG_DI: return DI_reg(&DEBUG_context);
case REG_BP: return BP_reg(&DEBUG_context);
case REG_FL: return FL_reg(&DEBUG_context);
case REG_IP: return IP_reg(&DEBUG_context);
case REG_SP: return SP_reg(&DEBUG_context);
case REG_CS: return CS_reg(&DEBUG_context);
case REG_DS: return DS_reg(&DEBUG_context);
case REG_ES: return ES_reg(&DEBUG_context);
case REG_SS: return SS_reg(&DEBUG_context);
case REG_FS: return FS_reg(&DEBUG_context);
case REG_GS: return GS_reg(&DEBUG_context);
case REG_AX: return LOWORD(EAX_reg(&DEBUG_context));
case REG_BX: return LOWORD(EBX_reg(&DEBUG_context));
case REG_CX: return LOWORD(ECX_reg(&DEBUG_context));
case REG_DX: return LOWORD(EDX_reg(&DEBUG_context));
case REG_SI: return LOWORD(ESI_reg(&DEBUG_context));
case REG_DI: return LOWORD(EDI_reg(&DEBUG_context));
case REG_BP: return LOWORD(EBP_reg(&DEBUG_context));
case REG_FL: return LOWORD(EFL_reg(&DEBUG_context));
case REG_IP: return LOWORD(EIP_reg(&DEBUG_context));
case REG_SP: return LOWORD(ESP_reg(&DEBUG_context));
}
return 0; /* should not happen */
}
......@@ -199,9 +199,9 @@ void DEBUG_InfoRegisters(void)
if (dbg_mode == 16)
{
fprintf( stderr,"\n IP:%04x SP:%04x BP:%04x FLAGS:%04x(%s)\n",
IP_reg(&DEBUG_context), SP_reg(&DEBUG_context),
BP_reg(&DEBUG_context), FL_reg(&DEBUG_context),
DEBUG_Flags(FL_reg(&DEBUG_context), flag));
LOWORD(EIP_reg(&DEBUG_context)), LOWORD(ESP_reg(&DEBUG_context)),
LOWORD(EBP_reg(&DEBUG_context)), LOWORD(EFL_reg(&DEBUG_context)),
DEBUG_Flags(LOWORD(EFL_reg(&DEBUG_context)), flag));
fprintf( stderr," AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
AX_reg(&DEBUG_context), BX_reg(&DEBUG_context),
CX_reg(&DEBUG_context), DX_reg(&DEBUG_context),
......
......@@ -211,7 +211,7 @@ static void DEBUG_DoBackTrace(int noisy)
is16 = FALSE;
} else {
frames[0].cs = addr.seg = cs;
frames[0].eip = addr.off = IP_reg(&DEBUG_context);
frames[0].eip = addr.off = LOWORD(EIP_reg(&DEBUG_context));
if (noisy)
frames[0].frame = DEBUG_PrintAddress( &addr, 16, TRUE );
else
......
......@@ -520,9 +520,9 @@ void WINAPI ASPI_DOS_func(CONTEXT86 *context)
ASPI_SendASPICommand(ptrSRB, ASPI_DOS);
/* simulate a normal RETF sequence as required by DPMI CallRMProcFar */
IP_reg(context) = *(stack++);
CS_reg(context) = *(stack++);
SP_reg(context) += 2*sizeof(WORD);
EIP_reg(context) = *(stack++);
CS_reg(context) = *(stack++);
ESP_reg(context) += 2*sizeof(WORD);
}
......
......@@ -208,10 +208,10 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
return (FARPROC16)(SEGPTR)MAKELONG(((char*)fun-(char*)dll->funs),dll->funhandle);
}
#define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context)+4)))
#define CALLER1REF (*(DWORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context))+4)))
void WINAPI SNOOP16_Entry(CONTEXT86 *context) {
DWORD ordinal=0;
DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5;
DWORD entry=(DWORD)PTR_SEG_OFF_TO_LIN(CS_reg(context),LOWORD(EIP_reg(context)))-5;
WORD xcs = CS_reg(context);
SNOOP16_DLL *dll = firstdll;
SNOOP16_FUN *fun = NULL;
......@@ -254,10 +254,10 @@ void WINAPI SNOOP16_Entry(CONTEXT86 *context) {
ret->dll = dll;
ret->args = NULL;
ret->ordinal = ordinal;
ret->origSP = SP_reg(context);
ret->origSP = LOWORD(ESP_reg(context));
IP_reg(context)= LOWORD(fun->origfun);
CS_reg(context)= HIWORD(fun->origfun);
EIP_reg(context)= LOWORD(fun->origfun);
CS_reg(context) = HIWORD(fun->origfun);
DPRINTF("Call %s.%ld: %s(",dll->name,ordinal,fun->name);
......@@ -265,19 +265,19 @@ void WINAPI SNOOP16_Entry(CONTEXT86 *context) {
max = fun->nrofargs;
if (max>16) max=16;
for (i=max;i--;)
DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8+sizeof(WORD)*i),i?",":"");
DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8+sizeof(WORD)*i),i?",":"");
if (max!=fun->nrofargs)
DPRINTF(" ...");
} else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(SystemHeap,0,16*sizeof(WORD));
memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8),sizeof(WORD)*16);
memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),LOWORD(ESP_reg(context)))+8),sizeof(WORD)*16);
}
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
}
void WINAPI SNOOP16_Return(CONTEXT86 *context) {
SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5);
SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(CS_reg(context),LOWORD(EIP_reg(context)))-5);
/* We haven't found out the nrofargs yet. If we called a cdecl
* function it is too late anyway and we can just set '0' (which
......@@ -285,10 +285,10 @@ void WINAPI SNOOP16_Return(CONTEXT86 *context) {
* If pascal -> everything ok.
*/
if (ret->dll->funs[ret->ordinal].nrofargs<0) {
ret->dll->funs[ret->ordinal].nrofargs=(SP_reg(context)-ret->origSP-4)/2;
ret->dll->funs[ret->ordinal].nrofargs=(LOWORD(ESP_reg(context))-ret->origSP-4)/2;
}
IP_reg(context) = LOWORD(ret->origreturn);
CS_reg(context) = HIWORD(ret->origreturn);
EIP_reg(context) = LOWORD(ret->origreturn);
CS_reg(context) = HIWORD(ret->origreturn);
if (ret->args) {
int i,max;
......
......@@ -580,11 +580,6 @@ typedef HANDLE *PHANDLE;
#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
#define IP_reg(context) (*(WORD*)&EIP_reg(context))
#define SP_reg(context) (*(WORD*)&ESP_reg(context))
#define FL_reg(context) (*(WORD*)&EFL_reg(context))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
#define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
......
......@@ -660,8 +660,8 @@ static BOOL NE_InitDLL( TDB* pTask, NE_MODULE *pModule )
pModule->cs = 0; /* Don't initialize it twice */
TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n",
CS_reg(&context), IP_reg(&context), DS_reg(&context),
TRACE_(dll)("Calling LibMain, cs:ip=%04lx:%04lx ds=%04lx di=%04x cx=%04x\n",
CS_reg(&context), EIP_reg(&context), DS_reg(&context),
DI_reg(&context), CX_reg(&context) );
Callbacks->CallRegisterShortProc( &context, 0 );
return TRUE;
......@@ -693,7 +693,7 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
ES_reg(&context) = ds; /* who knows ... */
CS_reg(&context) = HIWORD(entryPoint);
IP_reg(&context) = LOWORD(entryPoint);
EIP_reg(&context) = LOWORD(entryPoint);
EBP_reg(&context) = OFFSETOF( NtCurrentTeb()->cur_stack )
+ (WORD)&((STACK16FRAME*)0)->bp;
......@@ -704,8 +704,8 @@ static void NE_CallDllEntryPoint( NE_MODULE *pModule, DWORD dwReason )
*(DWORD *)(stack - 14) = 0; /* dwReserved1 */
*(WORD *) (stack - 16) = 0; /* wReserved2 */
TRACE_(dll)("Calling DllEntryPoint, cs:ip=%04lx:%04x\n",
CS_reg(&context), IP_reg(&context));
TRACE_(dll)("Calling DllEntryPoint, cs:ip=%04lx:%04lx\n",
CS_reg(&context), EIP_reg(&context));
Callbacks->CallRegisterShortProc( &context, 16 );
}
......
......@@ -174,11 +174,11 @@ void WINAPI HandleParamError( CONTEXT86 *context )
to error handler (location at [bp-2]) */
WORD *stack = PTR_SEG_OFF_TO_LIN( SS_reg( context ),
BP_reg( context ));
SP_reg( context ) = BP_reg( context ) - 2;
BP_reg( context ) = stack[0] & 0xfffe;
LOWORD(EBP_reg( context )) );
ESP_reg( context ) = LOWORD(EBP_reg( context )) - 2;
EBP_reg( context ) = stack[0] & 0xfffe;
IP_reg( context ) = stack[-1];
EIP_reg( context ) = stack[-1];
EAX_reg( context ) = ECX_reg( context ) = EDX_reg( context ) = 0;
ES_reg( context) = 0;
......
......@@ -132,9 +132,9 @@ static void do_lret(CONTEXT86*ctx)
{
WORD *stack = CTX_SEG_OFF_TO_LIN(ctx, SS_reg(ctx), ESP_reg(ctx));
IP_reg(ctx) = *(stack++);
CS_reg(ctx) = *(stack++);
SP_reg(ctx) += 2*sizeof(WORD);
EIP_reg(ctx) = *(stack++);
CS_reg(ctx) = *(stack++);
ESP_reg(ctx) += 2*sizeof(WORD);
}
static void do_strategy(CONTEXT86*ctx, int id, int extra)
......@@ -522,17 +522,17 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
memset(&ctx, 0, sizeof(ctx));
/* ES:BX points to request for strategy routine */
ES_reg(&ctx) = HIWORD(DOS_LOLSeg);
BX_reg(&ctx) = ALLDEV_OFS;
ES_reg(&ctx) = HIWORD(DOS_LOLSeg);
EBX_reg(&ctx) = ALLDEV_OFS;
/* call strategy routine */
CS_reg(&ctx) = SELECTOROF(dev);
IP_reg(&ctx) = dhdr->strategy;
EIP_reg(&ctx) = dhdr->strategy;
DPMI_CallRMProc(&ctx, 0, 0, 0);
/* call interrupt routine */
CS_reg(&ctx) = SELECTOROF(dev);
IP_reg(&ctx) = dhdr->interrupt;
EIP_reg(&ctx) = dhdr->interrupt;
DPMI_CallRMProc(&ctx, 0, 0, 0);
/* completed, copy request back */
......
......@@ -173,9 +173,9 @@ static void INT_SetRealModeContext( REALMODECALL *call, CONTEXT86 *context )
call->esi = ESI_reg(context);
call->edi = EDI_reg(context);
call->ebp = EBP_reg(context);
call->fl = FL_reg(context);
call->ip = IP_reg(context);
call->sp = SP_reg(context);
call->fl = LOWORD(EFL_reg(context));
call->ip = LOWORD(EIP_reg(context));
call->sp = LOWORD(ESP_reg(context));
call->cs = CS_reg(context);
call->ds = DS_reg(context);
call->es = ES_reg(context);
......@@ -277,7 +277,7 @@ int DPMI_CallRMProc( CONTEXT86 *context, LPWORD stack, int args, int iret )
EAX_reg(context), EBX_reg(context), ECX_reg(context), EDX_reg(context) );
TRACE("ESI=%08lx EDI=%08lx ES=%04lx DS=%04lx CS:IP=%04lx:%04x, %d WORD arguments, %s\n",
ESI_reg(context), EDI_reg(context), ES_reg(context), DS_reg(context),
CS_reg(context), IP_reg(context), args, iret?"IRET":"FAR" );
CS_reg(context), LOWORD(EIP_reg(context)), args, iret?"IRET":"FAR" );
callrmproc_again:
......@@ -286,23 +286,23 @@ callrmproc_again:
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);
EIP_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);
EIP_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);
EIP_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);
return INT_RealModeInterrupt( LOWORD(EIP_reg(context))/4, context);
}
/* shortcut for RMCBs */
......@@ -324,7 +324,7 @@ callrmproc_again:
if (!SS_reg(context)) {
alloc = 1; /* allocate default stack */
stack16 = addr = DOSMEM_GetBlock( pModule->self, 64, (UINT16 *)&(SS_reg(context)) );
SP_reg(context) = 64-2;
ESP_reg(context) = 64-2;
stack16 += 32-1;
if (!addr) {
ERR("could not allocate default stack\n");
......@@ -333,7 +333,7 @@ callrmproc_again:
} else {
stack16 = CTX_SEG_OFF_TO_LIN(context, SS_reg(context), ESP_reg(context));
}
SP_reg(context) -= (args + (iret?1:0)) * sizeof(WORD);
ESP_reg(context) -= (args + (iret?1:0)) * sizeof(WORD);
#else
if (!already) {
stack16 = (LPWORD) CURRENT_STACK16;
......@@ -343,14 +343,14 @@ callrmproc_again:
/* push flags if iret */
if (iret) {
stack16--; args++;
*stack16 = FL_reg(context);
*stack16 = LOWORD(EFL_reg(context));
}
#ifdef MZ_SUPPORTED
/* push return address (return to interrupt wrapper) */
*(--stack16) = DPMI_wrap_seg;
*(--stack16) = 0;
/* adjust stack */
SP_reg(context) -= 2*sizeof(WORD);
ESP_reg(context) -= 2*sizeof(WORD);
#endif
already = 1;
}
......@@ -360,7 +360,7 @@ callrmproc_again:
DPMI_CallRMCBProc(context, CurrRMCB, pModule->lpDosTask?pModule->lpDosTask->dpmi_flag:0);
/* check if we returned to where we thought we would */
if ((CS_reg(context) != DPMI_wrap_seg) ||
(IP_reg(context) != 0)) {
(LOWORD(EIP_reg(context)) != 0)) {
/* we need to continue at different address in real-mode space,
so we need to set it all up for real mode again */
goto callrmproc_again;
......@@ -370,12 +370,12 @@ callrmproc_again:
#if 0 /* this was probably unnecessary */
/* push call address */
*(--stack16) = CS_reg(context);
*(--stack16) = IP_reg(context);
*(--stack16) = LOWORD(EIP_reg(context));
/* adjust stack */
SP_reg(context) -= 2*sizeof(WORD);
ESP_reg(context) -= 2*sizeof(WORD);
/* set initial CS:IP to the wrapper's "lret" */
CS_reg(context) = DPMI_wrap_seg;
IP_reg(context) = 2;
EIP_reg(context) = 2;
#endif
TRACE("entering real mode...\n");
DOSVM_Enter( context );
......@@ -386,7 +386,7 @@ callrmproc_again:
seg_addr = PTR_SEG_OFF_TO_SEGPTR( sel, 0 );
CS_reg(context) = HIWORD(seg_addr);
IP_reg(context) = LOWORD(seg_addr);
EIP_reg(context) = LOWORD(seg_addr);
EBP_reg(context) = OFFSETOF( NtCurrentTeb()->cur_stack )
+ (WORD)&((STACK16FRAME*)0)->bp;
Callbacks->CallRegisterShortProc(context, args*sizeof(WORD));
......@@ -452,7 +452,7 @@ static void CallRMProc( CONTEXT86 *context, int iret )
return;
}
INT_GetRealModeContext(p, &context16);
DPMI_CallRMProc( &context16, ((LPWORD)PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context)))+3,
DPMI_CallRMProc( &context16, ((LPWORD)PTR_SEG_OFF_TO_LIN(SS_reg(context), LOWORD(ESP_reg(context))))+3,
CX_reg(context), iret );
INT_SetRealModeContext(p, &context16);
}
......@@ -519,12 +519,12 @@ static void AllocRMCB( CONTEXT86 *context )
NewRMCB->proc_sel = DS_reg(context);
NewRMCB->regs_ofs = DI_reg(context);
NewRMCB->regs_sel = ES_reg(context);
CX_reg(context) = HIWORD(NewRMCB->address);
DX_reg(context) = LOWORD(NewRMCB->address);
SET_LOWORD( ECX_reg(context), HIWORD(NewRMCB->address) );
SET_LOWORD( EDX_reg(context), LOWORD(NewRMCB->address) );
}
else
{
AX_reg(context) = 0x8015; /* callback unavailable */
SET_LOWORD( EAX_reg(context), 0x8015 ); /* callback unavailable */
SET_CFLAG(context);
}
}
......@@ -575,7 +575,7 @@ static void FreeRMCB( CONTEXT86 *context )
CX_reg(context), DX_reg(context));
if (DPMI_FreeRMCB(MAKELONG(DX_reg(context), CX_reg(context)))) {
AX_reg(context) = 0x8024; /* invalid callback address */
SET_LOWORD( EAX_reg(context), 0x8024 ); /* invalid callback address */
SET_CFLAG(context);
}
}
......@@ -621,8 +621,8 @@ static void StartPM( CONTEXT86 *context, LPDOSTASK lpDosTask )
pm_ctx = *context;
CS_reg(&pm_ctx) = lpDosTask->dpmi_sel;
/* our mode switch wrapper expects the new CS in DX, and the new SS in AX */
AX_reg(&pm_ctx) = ss;
DX_reg(&pm_ctx) = cs;
EAX_reg(&pm_ctx) = ss;
EDX_reg(&pm_ctx) = cs;
DS_reg(&pm_ctx) = ds;
ES_reg(&pm_ctx) = es;
FS_reg(&pm_ctx) = 0;
......@@ -775,10 +775,10 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
{
case 0x0000: /* Allocate LDT descriptors */
TRACE("allocate LDT descriptors (%d)\n",CX_reg(context));
if (!(AX_reg(context) = AllocSelectorArray16( CX_reg(context) )))
if (!(EAX_reg(context) = AllocSelectorArray16( CX_reg(context) )))
{
TRACE("failed\n");
AX_reg(context) = 0x8011; /* descriptor unavailable */
EAX_reg(context) = 0x8011; /* descriptor unavailable */
SET_CFLAG(context);
}
TRACE("success, array starts at 0x%04x\n",AX_reg(context));
......@@ -788,7 +788,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
TRACE("free LDT descriptor (0x%04x)\n",BX_reg(context));
if (FreeSelector16( BX_reg(context) ))
{
AX_reg(context) = 0x8022; /* invalid selector */
EAX_reg(context) = 0x8022; /* invalid selector */
SET_CFLAG(context);
}
else
......@@ -818,36 +818,35 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
case 0xe000: entryPoint = 190; break; /* __E000H */
case 0xf000: entryPoint = 194; break; /* __F000H */
default:
AX_reg(context) = DOSMEM_AllocSelector(BX_reg(context));
EAX_reg(context) = DOSMEM_AllocSelector(BX_reg(context));
break;
}
if (entryPoint)
AX_reg(context) = LOWORD(NE_GetEntryPoint(
GetModuleHandle16( "KERNEL" ),
entryPoint ));
EAX_reg(context) = LOWORD(NE_GetEntryPoint( GetModuleHandle16( "KERNEL" ),
entryPoint ));
}
break;
case 0x0003: /* Get next selector increment */
TRACE("get selector increment (__AHINCR)\n");
AX_reg(context) = __AHINCR;
EAX_reg(context) = __AHINCR;
break;
case 0x0004: /* Lock selector (not supported) */
FIXME("lock selector not supported\n");
AX_reg(context) = 0; /* FIXME: is this a correct return value? */
EAX_reg(context) = 0; /* FIXME: is this a correct return value? */
break;
case 0x0005: /* Unlock selector (not supported) */
FIXME("unlock selector not supported\n");
AX_reg(context) = 0; /* FIXME: is this a correct return value? */
EAX_reg(context) = 0; /* FIXME: is this a correct return value? */
break;
case 0x0006: /* Get selector base address */
TRACE("get selector base address (0x%04x)\n",BX_reg(context));
if (!(dw = GetSelectorBase( BX_reg(context) )))
{
AX_reg(context) = 0x8022; /* invalid selector */
EAX_reg(context) = 0x8022; /* invalid selector */
SET_CFLAG(context);
}
else
......
......@@ -1130,7 +1130,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
if (scan) {
/* return pending scancode */
AL_reg(context) = scan;
FL_reg(context) &= ~0x40; /* clear ZF */
EFL_reg(context) &= ~0x40; /* clear ZF */
scan = 0;
} else {
char ascii;
......@@ -1138,13 +1138,13 @@ void WINAPI DOS3Call( CONTEXT86 *context )
CONSOLE_GetKeystroke(&scan,&ascii);
/* return ASCII code */
AL_reg(context) = ascii;
FL_reg(context) &= ~0x40; /* clear ZF */
EFL_reg(context) &= ~0x40; /* clear ZF */
/* return scan code on next call only if ascii==0 */
if (ascii) scan = 0;
} else {
/* nothing pending, clear everything */
AL_reg(context) = 0;
FL_reg(context) |= 0x40; /* set ZF */
EFL_reg(context) |= 0x40; /* set ZF */
scan = 0; /* just in case */
}
}
......
......@@ -59,14 +59,14 @@ static void MouseRelay(LPDOSTASK lpDosTask,CONTEXT86 *context,void *mdata)
MCALLDATA *data = (MCALLDATA *)mdata;
CONTEXT86 ctx = *context;
AX_reg(&ctx) = data->mask;
BX_reg(&ctx) = data->but;
CX_reg(&ctx) = data->x;
DX_reg(&ctx) = data->y;
SI_reg(&ctx) = data->mx;
DI_reg(&ctx) = data->my;
CS_reg(&ctx) = SELECTOROF(data->proc);
IP_reg(&ctx) = OFFSETOF(data->proc);
EAX_reg(&ctx) = data->mask;
EBX_reg(&ctx) = data->but;
ECX_reg(&ctx) = data->x;
EDX_reg(&ctx) = data->y;
ESI_reg(&ctx) = data->mx;
EDI_reg(&ctx) = data->my;
CS_reg(&ctx) = SELECTOROF(data->proc);
EIP_reg(&ctx) = OFFSETOF(data->proc);
free(data);
DPMI_CallRMProc(&ctx, NULL, 0, 0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment