Revision fed6c344
b/vl.c | ||
---|---|---|
3383 | 3383 |
static void block_io_signals(void); |
3384 | 3384 |
static void unblock_io_signals(void); |
3385 | 3385 |
static int tcg_has_work(void); |
3386 |
static int cpu_has_work(CPUState *env); |
|
3386 | 3387 |
|
3387 | 3388 |
static int qemu_init_main_loop(void) |
3388 | 3389 |
{ |
... | ... | |
3403 | 3404 |
return 0; |
3404 | 3405 |
} |
3405 | 3406 |
|
3407 |
static void qemu_wait_io_event_common(CPUState *env) |
|
3408 |
{ |
|
3409 |
if (env->stop) { |
|
3410 |
env->stop = 0; |
|
3411 |
env->stopped = 1; |
|
3412 |
qemu_cond_signal(&qemu_pause_cond); |
|
3413 |
} |
|
3414 |
} |
|
3415 |
|
|
3406 | 3416 |
static void qemu_wait_io_event(CPUState *env) |
3407 | 3417 |
{ |
3408 | 3418 |
while (!tcg_has_work()) |
... | ... | |
3419 | 3429 |
qemu_mutex_unlock(&qemu_fair_mutex); |
3420 | 3430 |
|
3421 | 3431 |
qemu_mutex_lock(&qemu_global_mutex); |
3422 |
if (env->stop) { |
|
3423 |
env->stop = 0; |
|
3424 |
env->stopped = 1; |
|
3425 |
qemu_cond_signal(&qemu_pause_cond); |
|
3426 |
} |
|
3432 |
qemu_wait_io_event_common(env); |
|
3433 |
} |
|
3434 |
|
|
3435 |
static void qemu_kvm_wait_io_event(CPUState *env) |
|
3436 |
{ |
|
3437 |
while (!cpu_has_work(env)) |
|
3438 |
qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000); |
|
3439 |
|
|
3440 |
qemu_wait_io_event_common(env); |
|
3427 | 3441 |
} |
3428 | 3442 |
|
3429 | 3443 |
static int qemu_cpu_exec(CPUState *env); |
... | ... | |
3449 | 3463 |
while (1) { |
3450 | 3464 |
if (cpu_can_run(env)) |
3451 | 3465 |
qemu_cpu_exec(env); |
3452 |
qemu_wait_io_event(env); |
|
3466 |
qemu_kvm_wait_io_event(env);
|
|
3453 | 3467 |
} |
3454 | 3468 |
|
3455 | 3469 |
return NULL; |
Also available in: Unified diff