aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-14 09:36:13 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2006-07-14 09:36:13 +0000
commita8e5ac33d22c335b792389a5b153bfc02b04fcdc (patch)
treeeb60626db9f7bc4e1e1827852a2d899ca24632b2
parentec607da7c2f2199a486f8df243f23f509f6ab5c0 (diff)
downloadqemu-a8e5ac33d22c335b792389a5b153bfc02b04fcdc.zip
qemu-a8e5ac33d22c335b792389a5b153bfc02b04fcdc.tar.gz
qemu-a8e5ac33d22c335b792389a5b153bfc02b04fcdc.tar.bz2
win32 compilation - force process affinity on win32 as a workaround for SMP issues
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2051 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index c9992d8..77ebd35 100644
--- a/vl.c
+++ b/vl.c
@@ -517,6 +517,8 @@ static int64_t clock_freq;
static void init_get_clock(void)
{
+ LARGE_INTEGER freq;
+ int ret;
ret = QueryPerformanceFrequency(&freq);
if (ret == 0) {
fprintf(stderr, "Could not calibrate ticks\n");
@@ -5614,6 +5616,24 @@ int main(int argc, char **argv)
}
#else
SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE);
+ /* Note: cpu_interrupt() is currently not SMP safe, so we force
+ QEMU to run on a single CPU */
+ {
+ HANDLE h;
+ DWORD mask, smask;
+ int i;
+ 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);
+ }
+ }
+ }
#endif
init_timers();
init_timer_alarm();