Alexandre Julliard : winedos: Always run the BIOS tick timer.

Alexandre Julliard julliard at winehq.org
Tue Sep 29 11:09:04 CDT 2009


Module: wine
Branch: master
Commit: 68dd560860c8284dfa851d2e643f30e0001c3584
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68dd560860c8284dfa851d2e643f30e0001c3584

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Sep 28 19:55:39 2009 +0200

winedos: Always run the BIOS tick timer.

---

 dlls/kernel32/dosmem.c         |    1 -
 dlls/kernel32/instr.c          |    7 -------
 dlls/kernel32/kernel_private.h |    1 -
 dlls/winedos/dosmem.c          |   23 ++++++++++++++++++++---
 dlls/winedos/winedos.spec      |    3 ---
 5 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/dlls/kernel32/dosmem.c b/dlls/kernel32/dosmem.c
index f162139..d8ea03b 100644
--- a/dlls/kernel32/dosmem.c
+++ b/dlls/kernel32/dosmem.c
@@ -115,7 +115,6 @@ BOOL load_winedos(void)
                 GET_ADDR(outport);
                 GET_ADDR(EmulateInterruptPM);
                 GET_ADDR(CallBuiltinHandler);
-                GET_ADDR(BiosTick);
 #undef GET_ADDR
             }
             RtlRemoveVectoredExceptionHandler( dosmem_handler );
diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c
index 7fdc4cd..7f5ddc4 100644
--- a/dlls/kernel32/instr.c
+++ b/dlls/kernel32/instr.c
@@ -106,13 +106,6 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel )
 {
     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;
         return TRUE;
     }
diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h
index 386bab2..a65d93f 100644
--- a/dlls/kernel32/kernel_private.h
+++ b/dlls/kernel32/kernel_private.h
@@ -137,7 +137,6 @@ extern struct winedos_exports
     void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum );
     DWORD (WINAPI *inport)( int port, int size );
     void (WINAPI *outport)( int port, int size, DWORD val );
-    void (* BiosTick)(WORD timer);
 } winedos;
 
 /* returns directory handle for named objects */
diff --git a/dlls/winedos/dosmem.c b/dlls/winedos/dosmem.c
index d453da3..06823f8 100644
--- a/dlls/winedos/dosmem.c
+++ b/dlls/winedos/dosmem.c
@@ -224,10 +224,25 @@ static void DOSMEM_FillBiosSegments(void)
  *
  * 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();
-    if (pBiosData) pBiosData->Ticks++;
+    BIOSDATA *pBiosData = arg;
+    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.
      */
     DOSMEM_InitMemory(DOSMEM_dosmem + reserve);
+
+    CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL ));
     return TRUE;
 }
 
diff --git a/dlls/winedos/winedos.spec b/dlls/winedos/winedos.spec
index 98f9048..6847874 100644
--- a/dlls/winedos/winedos.spec
+++ b/dlls/winedos/winedos.spec
@@ -11,6 +11,3 @@
 @ cdecl FreeDosBlock(ptr) DOSMEM_FreeBlock
 @ cdecl AllocDosBlock(long ptr) DOSMEM_AllocBlock
 @ cdecl ResizeDosBlock(ptr long long) DOSMEM_ResizeBlock
-
-# BIOS functions
-@ cdecl BiosTick(long)




More information about the wine-cvs mailing list