summary refs log tree commit diff stats
path: root/os-win32.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2013-04-13 14:31:54 +0200
committerAurelien Jarno <aurelien@aurel32.net>2013-04-13 14:31:54 +0200
commit75312e745ad1b672cbabdc3022f6e7c8eff69b00 (patch)
tree5f2c92a22dbe0d149065123ea0827f5cdb76f752 /os-win32.c
parentd640045a3ede028293b83e57e9ae1ce4f81044b8 (diff)
parent0727b867542eea7fedfd2c53568e9782627fd3bd (diff)
downloadfocaccia-qemu-75312e745ad1b672cbabdc3022f6e7c8eff69b00.tar.gz
focaccia-qemu-75312e745ad1b672cbabdc3022f6e7c8eff69b00.zip
Merge branch 'mingw' of git://qemu.weilnetz.de/qemu
* 'mingw' of git://qemu.weilnetz.de/qemu:
  qemu-timer: move timeBeginPeriod/timeEndPeriod to os-win32
  Release SMP restriction on Windows
  Ensure good ordering of memory instruction in cpu_exec
  Check effective suspension of TCG thread
Diffstat (limited to 'os-win32.c')
-rw-r--r--os-win32.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/os-win32.c b/os-win32.c
index 9673a81c7d..50b7f6f885 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -23,6 +23,7 @@
  * THE SOFTWARE.
  */
 #include <windows.h>
+#include <mmsystem.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
@@ -67,27 +68,19 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type)
     return TRUE;
 }
 
-void os_setup_early_signal_handling(void)
+static TIMECAPS mm_tc;
+
+static void os_undo_timer_resolution(void)
 {
-    /* Note: cpu_interrupt() is currently not SMP safe, so we force
-       QEMU to run on a single CPU */
-    HANDLE h;
-    DWORD_PTR mask, smask;
-    int i;
+    timeEndPeriod(mm_tc.wPeriodMin);
+}
 
+void os_setup_early_signal_handling(void)
+{
     SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE);
-
-    h = GetCurrentProcess();
-    if (GetProcessAffinityMask(h, &mask, &smask)) {
-        for(i = 0; i < 32; i++) {
-            if (mask & (1 << i))
-                break;
-        }
-        if (i != 32) {
-            mask = 1 << i;
-            SetProcessAffinityMask(h, mask);
-        }
-    }
+    timeGetDevCaps(&mm_tc, sizeof(mm_tc));
+    timeBeginPeriod(mm_tc.wPeriodMin);
+    atexit(os_undo_timer_resolution);
 }
 
 /* Look for support files in the same directory as the executable.  */