winedos: Always run the BIOS tick timer.

This commit is contained in:
Alexandre Julliard 2009-09-28 19:55:39 +02:00
parent 404aecb8da
commit 68dd560860
5 changed files with 20 additions and 15 deletions

View File

@ -115,7 +115,6 @@ BOOL load_winedos(void)
GET_ADDR(outport); GET_ADDR(outport);
GET_ADDR(EmulateInterruptPM); GET_ADDR(EmulateInterruptPM);
GET_ADDR(CallBuiltinHandler); GET_ADDR(CallBuiltinHandler);
GET_ADDR(BiosTick);
#undef GET_ADDR #undef GET_ADDR
} }
RtlRemoveVectoredExceptionHandler( dosmem_handler ); RtlRemoveVectoredExceptionHandler( dosmem_handler );

View File

@ -106,13 +106,6 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel )
{ {
if (*sel == 0x40) if (*sel == 0x40)
{ {
static WORD sys_timer = 0;
if (!sys_timer)
{
if (!winedos.BiosTick) load_winedos();
if (winedos.BiosTick)
sys_timer = CreateSystemTimer( 55, winedos.BiosTick );
}
*sel = DOSMEM_BiosDataSeg; *sel = DOSMEM_BiosDataSeg;
return TRUE; return TRUE;
} }

View File

@ -137,7 +137,6 @@ extern struct winedos_exports
void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum ); void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
DWORD (WINAPI *inport)( int port, int size ); DWORD (WINAPI *inport)( int port, int size );
void (WINAPI *outport)( int port, int size, DWORD val ); void (WINAPI *outport)( int port, int size, DWORD val );
void (* BiosTick)(WORD timer);
} winedos; } winedos;
/* returns directory handle for named objects */ /* returns directory handle for named objects */

View File

@ -224,10 +224,25 @@ static void DOSMEM_FillBiosSegments(void)
* *
* Increment the BIOS tick counter. Called by timer signal handler. * Increment the BIOS tick counter. Called by timer signal handler.
*/ */
void BiosTick( WORD timer ) static void CALLBACK BiosTick( LPVOID arg, DWORD low, DWORD high )
{ {
BIOSDATA *pBiosData = DOSVM_BiosData(); BIOSDATA *pBiosData = arg;
if (pBiosData) pBiosData->Ticks++; pBiosData->Ticks++;
}
/***********************************************************************
* timer_thread
*/
static DWORD CALLBACK timer_thread( void *arg )
{
LARGE_INTEGER when;
HANDLE timer;
if (!(timer = CreateWaitableTimerA( NULL, FALSE, NULL ))) return 0;
when.u.LowPart = when.u.HighPart = 0;
SetWaitableTimer( timer, &when, 55 /* actually 54.925 */, BiosTick, arg, FALSE );
for (;;) SleepEx( INFINITE, TRUE );
} }
/*********************************************************************** /***********************************************************************
@ -488,6 +503,8 @@ BOOL DOSMEM_InitDosMemory(void)
* Set DOS memory base and initialize conventional memory. * Set DOS memory base and initialize conventional memory.
*/ */
DOSMEM_InitMemory(DOSMEM_dosmem + reserve); DOSMEM_InitMemory(DOSMEM_dosmem + reserve);
CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL ));
return TRUE; return TRUE;
} }

View File

@ -11,6 +11,3 @@
@ cdecl FreeDosBlock(ptr) DOSMEM_FreeBlock @ cdecl FreeDosBlock(ptr) DOSMEM_FreeBlock
@ cdecl AllocDosBlock(long ptr) DOSMEM_AllocBlock @ cdecl AllocDosBlock(long ptr) DOSMEM_AllocBlock
@ cdecl ResizeDosBlock(ptr long long) DOSMEM_ResizeBlock @ cdecl ResizeDosBlock(ptr long long) DOSMEM_ResizeBlock
# BIOS functions
@ cdecl BiosTick(long)