Commit a8e5ac33d22c335b792389a5b153bfc02b04fcdc
1 parent
ec607da7
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
Showing
1 changed file
with
20 additions
and
0 deletions
vl.c
| ... | ... | @@ -517,6 +517,8 @@ static int64_t clock_freq; |
| 517 | 517 | |
| 518 | 518 | static void init_get_clock(void) |
| 519 | 519 | { |
| 520 | + LARGE_INTEGER freq; | |
| 521 | + int ret; | |
| 520 | 522 | ret = QueryPerformanceFrequency(&freq); |
| 521 | 523 | if (ret == 0) { |
| 522 | 524 | fprintf(stderr, "Could not calibrate ticks\n"); |
| ... | ... | @@ -5614,6 +5616,24 @@ int main(int argc, char **argv) |
| 5614 | 5616 | } |
| 5615 | 5617 | #else |
| 5616 | 5618 | SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE); |
| 5619 | + /* Note: cpu_interrupt() is currently not SMP safe, so we force | |
| 5620 | + QEMU to run on a single CPU */ | |
| 5621 | + { | |
| 5622 | + HANDLE h; | |
| 5623 | + DWORD mask, smask; | |
| 5624 | + int i; | |
| 5625 | + h = GetCurrentProcess(); | |
| 5626 | + if (GetProcessAffinityMask(h, &mask, &smask)) { | |
| 5627 | + for(i = 0; i < 32; i++) { | |
| 5628 | + if (mask & (1 << i)) | |
| 5629 | + break; | |
| 5630 | + } | |
| 5631 | + if (i != 32) { | |
| 5632 | + mask = 1 << i; | |
| 5633 | + SetProcessAffinityMask(h, mask); | |
| 5634 | + } | |
| 5635 | + } | |
| 5636 | + } | |
| 5617 | 5637 | #endif |
| 5618 | 5638 | init_timers(); |
| 5619 | 5639 | init_timer_alarm(); | ... | ... |