]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpus: Pass CPUState to cpu_is_stopped()
authorAndreas Färber <afaerber@suse.de>
Wed, 2 May 2012 21:38:39 +0000 (23:38 +0200)
committerAndreas Färber <afaerber@suse.de>
Wed, 31 Oct 2012 00:02:44 +0000 (01:02 +0100)
CPUArchState is no longer needed there.

Also change the return type to bool.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu-all.h
cpus.c
include/qemu/cpu.h
target-i386/kvm.c

index 6606432944de1addb5e3b129fbe97b8e21e8669c..d19ec127e19699033cdca877e2c04b586c4e9e99 100644 (file)
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -466,7 +466,6 @@ void cpu_watchpoint_remove_all(CPUArchState *env, int mask);
 #define SSTEP_NOTIMER 0x4  /* Do not Timers while single stepping */
 
 void cpu_single_step(CPUArchState *env, int enabled);
-int cpu_is_stopped(CPUArchState *env);
 void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data);
 
 #if !defined(CONFIG_USER_ONLY)
diff --git a/cpus.c b/cpus.c
index 4654f0878b99ff3131ff4543274cf22fbb707b4a..0721a9683192229002e4432e814ea7bcb07294d5 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -430,10 +430,8 @@ void cpu_synchronize_all_post_init(void)
     }
 }
 
-int cpu_is_stopped(CPUArchState *env)
+bool cpu_is_stopped(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
-
     return !runstate_is_running() || cpu->stopped;
 }
 
index 83378c54aec66f24e5bd71fc273d578899a62971..4e6203246364c0e34180983a853c5f490c0b16ae 100644 (file)
@@ -94,5 +94,16 @@ void cpu_reset(CPUState *cpu);
  */
 bool qemu_cpu_is_self(CPUState *cpu);
 
+/**
+ * cpu_is_stopped:
+ * @cpu: The CPU to check.
+ *
+ * Checks whether the CPU is stopped.
+ *
+ * Returns: %true if run state is not running or if artificially stopped;
+ * %false otherwise.
+ */
+bool cpu_is_stopped(CPUState *cpu);
+
 
 #endif
index c13f196e058e81b9deebd8458eb6f6ee65fc8f4e..a3491a4fa1d60b957fb07e4a48099b2e874aa2f0 100644 (file)
@@ -1555,7 +1555,7 @@ int kvm_arch_put_registers(CPUX86State *env, int level)
     CPUState *cpu = ENV_GET_CPU(env);
     int ret;
 
-    assert(cpu_is_stopped(env) || qemu_cpu_is_self(cpu));
+    assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu));
 
     ret = kvm_getput_regs(env, 1);
     if (ret < 0) {
@@ -1613,7 +1613,7 @@ int kvm_arch_get_registers(CPUX86State *env)
     CPUState *cpu = ENV_GET_CPU(env);
     int ret;
 
-    assert(cpu_is_stopped(env) || qemu_cpu_is_self(cpu));
+    assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu));
 
     ret = kvm_getput_regs(env, 0);
     if (ret < 0) {