Commit 76e5c012 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 6c136e86
...@@ -393,6 +393,7 @@ extern DOSCONF *DOSCONF_GetConfig( void ); ...@@ -393,6 +393,7 @@ extern DOSCONF *DOSCONF_GetConfig( void );
/* dosmem.c */ /* dosmem.c */
extern BIOSDATA *DOSVM_BiosData( void ); extern BIOSDATA *DOSVM_BiosData( void );
extern void DOSVM_start_bios_timer(void);
/* fpu.c */ /* fpu.c */
extern void WINAPI DOSVM_Int34Handler(CONTEXT86*); extern void WINAPI DOSVM_Int34Handler(CONTEXT86*);
......
...@@ -264,6 +264,19 @@ static DWORD CALLBACK timer_thread( void *arg ) ...@@ -264,6 +264,19 @@ static DWORD CALLBACK timer_thread( void *arg )
} }
/*********************************************************************** /***********************************************************************
* 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 * DOSMEM_Collapse
* *
* Helper function for internal use only. * Helper function for internal use only.
...@@ -335,7 +348,6 @@ BOOL DOSMEM_InitDosMemory(void) ...@@ -335,7 +348,6 @@ BOOL DOSMEM_InitDosMemory(void)
DOSMEM_Available()); DOSMEM_Available());
DOSVM_InitSegments(); DOSVM_InitSegments();
CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL ));
SetEvent( hRunOnce ); SetEvent( hRunOnce );
done = 1; done = 1;
......
...@@ -104,6 +104,7 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel ) ...@@ -104,6 +104,7 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel )
{ {
if (*sel == 0x40) if (*sel == 0x40)
{ {
DOSVM_start_bios_timer();
*sel = DOSMEM_BiosDataSeg; *sel = DOSMEM_BiosDataSeg;
return TRUE; return TRUE;
} }
......
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