qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH qom-next 16/59] cpus: Pass CPUState to cpu_can_run()


From: Andreas Färber
Subject: [Qemu-devel] [PATCH qom-next 16/59] cpus: Pass CPUState to cpu_can_run()
Date: Wed, 23 May 2012 05:07:39 +0200

CPUArchState is no longer needed there.

Also change its return type to bool.

Signed-off-by: Andreas Färber <address@hidden>
---
 cpus.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/cpus.c b/cpus.c
index 753277d..c0f253e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -422,17 +422,15 @@ static void do_vm_stop(RunState state)
     }
 }
 
-static int cpu_can_run(CPUArchState *env)
+static bool cpu_can_run(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     if (cpu->stop) {
-        return 0;
+        return false;
     }
     if (cpu->stopped || !runstate_is_running()) {
-        return 0;
+        return false;
     }
-    return 1;
+    return true;
 }
 
 static bool cpu_thread_is_idle(CPUArchState *env)
@@ -758,7 +756,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
     qemu_cond_signal(&qemu_cpu_cond);
 
     while (1) {
-        if (cpu_can_run(env)) {
+        if (cpu_can_run(cpu)) {
             r = kvm_cpu_exec(env);
             if (r == EXCP_DEBUG) {
                 cpu_handle_guest_debug(env);
@@ -1150,7 +1148,7 @@ static void tcg_exec_all(void)
         qemu_clock_enable(vm_clock,
                           (env->singlestep_enabled & SSTEP_NOTIMER) == 0);
 
-        if (cpu_can_run(env)) {
+        if (cpu_can_run(cpu)) {
             r = tcg_cpu_exec(env);
             if (r == EXCP_DEBUG) {
                 cpu_handle_guest_debug(env);
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]