Commit e54d4d15 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Added MZ_Current() (returns current LPDOSTASK) and DOSVM_Wait()

(DOSVM idle message loop), and fields hConInput and hConOutput.
parent 8903e536
......@@ -30,7 +30,7 @@ typedef struct _DOSTASK {
HMODULE16 hModule;
char mm_name[128];
int mm_fd;
HANDLE hReadPipe,hXPipe;
HANDLE hReadPipe,hXPipe,hConInput,hConOutput;
int read_pipe,write_pipe;
pid_t task;
int sig_sent;
......@@ -67,7 +67,9 @@ extern BOOL MZ_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmdline, LPCSTR
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, LPSTARTUPINFOA startup,
LPPROCESS_INFORMATION info );
extern LPDOSTASK MZ_Current( void );
extern int DOSVM_Enter( PCONTEXT context );
extern void DOSVM_Wait( int read_pipe, HANDLE hObject );
extern void DOSVM_QueueEvent( int irq, int priority, void (*relay)(LPDOSTASK,PCONTEXT,void*), void *data );
extern void DOSVM_PIC_ioport_out( WORD port, BYTE val );
extern void DOSVM_SetTimer( unsigned ticks );
......
......@@ -182,7 +182,7 @@ static BOOL MZ_InitMemory( LPDOSTASK lpDosTask, NE_MODULE *pModule )
{
int x;
if (lpDosTask->img_ofs) return TRUE; /* already allocated */
if (lpDosTask->img) return TRUE; /* already allocated */
/* allocate 1MB+64K shared memory */
lpDosTask->img_ofs=START_OFFSET;
......@@ -330,7 +330,7 @@ static void MZ_InitTimer( LPDOSTASK lpDosTask, int ver )
int func;
struct timeval tim;
/* start dosmod timer at 55Hz */
/* start dosmod timer at 55ms (18.2Hz) */
func=DOSMOD_SET_TIMER;
tim.tv_sec=0; tim.tv_usec=54925;
write(lpDosTask->write_pipe,&func,sizeof(func));
......@@ -370,14 +370,17 @@ BOOL MZ_InitTask( LPDOSTASK lpDosTask )
lpDosTask->write_pipe=write_fd[1];
/* if we have a mapping file, use it */
fname=lpDosTask->mm_name; farg=NULL;
if (!fname[0]) {
/* otherwise, map our own memory image */
sprintf(fproc,"/proc/%d/mem",getpid());
sprintf(arg,"%ld",(unsigned long)lpDosTask->img);
fname=fproc; farg=arg;
}
lpDosTask->hConInput=GetStdHandle(STD_INPUT_HANDLE);
lpDosTask->hConOutput=GetStdHandle(STD_OUTPUT_HANDLE);
/* if we have a mapping file, use it */
fname=lpDosTask->mm_name; farg=NULL;
if (!fname[0]) {
/* otherwise, map our own memory image */
sprintf(fproc,"/proc/%d/mem",getpid());
sprintf(arg,"%ld",(unsigned long)lpDosTask->img);
fname=fproc; farg=arg;
}
TRACE(module,"Loading DOS VM support module (hmodule=%04x)\n",lpDosTask->hModule);
if ((child=fork())<0) {
......@@ -541,6 +544,19 @@ void MZ_KillModule( LPDOSTASK lpDosTask )
#endif
}
LPDOSTASK MZ_Current( void )
{
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
GlobalUnlock16( GetCurrentTask() );
if (pModule)
return pModule->lpDosTask;
return NULL;
}
#else /* !MZ_SUPPORTED */
BOOL MZ_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmdline, LPCSTR env,
......@@ -553,4 +569,9 @@ BOOL MZ_CreateProcess( HFILE hFile, OFSTRUCT *ofs, LPCSTR cmdline, LPCSTR env,
return FALSE;
}
LPDOSTASK *MZ_Current( void )
{
return NULL;
}
#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