Commit 373bd357 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Fixed DPMI_CallRMProc (I think).

parent c0fbd7e2
...@@ -66,6 +66,33 @@ static void MZ_InitPSP( LPVOID lpPSP, LPCSTR cmdline, WORD env ) ...@@ -66,6 +66,33 @@ static void MZ_InitPSP( LPVOID lpPSP, LPCSTR cmdline, WORD env )
/* FIXME: integrate the PDB stuff from Wine (loader/task.c) */ /* FIXME: integrate the PDB stuff from Wine (loader/task.c) */
} }
static char int08[]={
0xCD,0x1C, /* int $0x1c */
0x50, /* pushw %ax */
0x1E, /* pushw %ds */
0xB8,0x40,0x00, /* movw $0x40,%ax */
0x8E,0xD8, /* movw %ax,%ds */
#if 0
0x83,0x06,0x6C,0x00,0x01, /* addw $1,(0x6c) */
0x83,0x16,0x6E,0x00,0x00, /* adcw $0,(0x6e) */
#else
0x66,0xFF,0x06,0x6C,0x00, /* incl (0x6c) */
#endif
0xB0,0x20, /* movb $0x20,%al */
0xE6,0x20, /* outb %al,$0x20 */
0x1F, /* popw %ax */
0x58, /* popw %ax */
0xCF /* iret */
};
static void MZ_InitHandlers( LPDOSTASK lpDosTask )
{
WORD seg;
LPBYTE start=DOSMEM_GetBlock(lpDosTask->hModule,sizeof(int08),&seg);
memcpy(start,int08,sizeof(int08));
((SEGPTR*)(lpDosTask->img))[0x08]=PTR_SEG_OFF_TO_SEGPTR(seg,0);
}
static char enter_xms[]={ static char enter_xms[]={
/* XMS hookable entry point */ /* XMS hookable entry point */
0xEB,0x03, /* jmp entry */ 0xEB,0x03, /* jmp entry */
...@@ -121,6 +148,7 @@ static void MZ_InitDPMI( LPDOSTASK lpDosTask ) ...@@ -121,6 +148,7 @@ static void MZ_InitDPMI( LPDOSTASK lpDosTask )
lpDosTask->call_ofs = size-1; lpDosTask->call_ofs = size-1;
memcpy(start,enter_pm,sizeof(enter_pm)); memcpy(start,enter_pm,sizeof(enter_pm));
memcpy(start+sizeof(enter_pm),wrap_rm,sizeof(wrap_rm));
} }
static WORD MZ_InitEnvironment( LPDOSTASK lpDosTask, LPCSTR env, LPCSTR name ) static WORD MZ_InitEnvironment( LPDOSTASK lpDosTask, LPCSTR env, LPCSTR name )
......
...@@ -205,7 +205,7 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret ) ...@@ -205,7 +205,7 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
CS_reg(context), IP_reg(context), args ); CS_reg(context), IP_reg(context), args );
#ifdef MZ_SUPPORTED #ifdef MZ_SUPPORTED
FIXME(int31,"DPMI real-mode call using DOS VM task system, untested!\n"); FIXME(int31,"DPMI real-mode call using DOS VM task system, not fully tested\n");
if (!pModule->lpDosTask) { if (!pModule->lpDosTask) {
TRACE(int31,"creating VM86 task\n"); TRACE(int31,"creating VM86 task\n");
if (MZ_InitTask( MZ_AllocDPMITask( pModule->self ) ) < 32) { if (MZ_InitTask( MZ_AllocDPMITask( pModule->self ) ) < 32) {
...@@ -217,7 +217,8 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret ) ...@@ -217,7 +217,8 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
alloc = 1; /* allocate default stack */ alloc = 1; /* allocate default stack */
stack16 = addr = DOSMEM_GetBlock( pModule->self, 64, &(SS_reg(context)) ); stack16 = addr = DOSMEM_GetBlock( pModule->self, 64, &(SS_reg(context)) );
SP_reg(context) = 64-2; SP_reg(context) = 64-2;
if (!stack16) { stack16 += 32-1;
if (!addr) {
ERR(int31,"could not allocate default stack\n"); ERR(int31,"could not allocate default stack\n");
return 1; return 1;
} }
...@@ -225,7 +226,7 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret ) ...@@ -225,7 +226,7 @@ int DPMI_CallRMProc( CONTEXT *context, LPWORD stack, int args, int iret )
stack16 = CTX_SEG_OFF_TO_LIN(context, SS_reg(context), ESP_reg(context)); stack16 = CTX_SEG_OFF_TO_LIN(context, SS_reg(context), ESP_reg(context));
addr = NULL; /* avoid gcc warning */ addr = NULL; /* avoid gcc warning */
} }
SP_reg(context) -= args*sizeof(WORD) + (iret?1:0); SP_reg(context) -= (args + (iret?1:0)) * sizeof(WORD);
#else #else
stack16 = THREAD_STACK16(thdb); stack16 = THREAD_STACK16(thdb);
#endif #endif
......
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