kernel: Only start the BIOS timer if there is an actual access to selector 0x40.

This commit is contained in:
Alexandre Julliard 2010-02-01 12:58:29 +01:00
parent 6c136e862b
commit 76e5c01209
3 changed files with 15 additions and 1 deletions

View File

@ -393,6 +393,7 @@ extern DOSCONF *DOSCONF_GetConfig( void );
/* dosmem.c */
extern BIOSDATA *DOSVM_BiosData( void );
extern void DOSVM_start_bios_timer(void);
/* fpu.c */
extern void WINAPI DOSVM_Int34Handler(CONTEXT86*);

View File

@ -263,6 +263,19 @@ static DWORD CALLBACK timer_thread( void *arg )
for (;;) SleepEx( INFINITE, TRUE );
}
/***********************************************************************
* DOSVM_start_bios_timer
*
* Start the BIOS ticks timer when the app accesses selector 0x40.
*/
void DOSVM_start_bios_timer(void)
{
static LONG running;
if (!InterlockedExchange( &running, 1 ))
CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL ));
}
/***********************************************************************
* DOSMEM_Collapse
*
@ -335,7 +348,6 @@ BOOL DOSMEM_InitDosMemory(void)
DOSMEM_Available());
DOSVM_InitSegments();
CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL ));
SetEvent( hRunOnce );
done = 1;

View File

@ -104,6 +104,7 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel )
{
if (*sel == 0x40)
{
DOSVM_start_bios_timer();
*sel = DOSMEM_BiosDataSeg;
return TRUE;
}