summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Färber2012-05-02 23:38:39 +0200
committerAndreas Färber2012-10-31 01:02:44 +0100
commit2fa45344a92444439c081cad2342ffc048c381ad (patch)
tree1e5c6a879afe898251e82fc004e64f02d71d0b6e
parentcpu: Move stopped field to CPUState (diff)
downloadqemu-2fa45344a92444439c081cad2342ffc048c381ad.tar.gz
qemu-2fa45344a92444439c081cad2342ffc048c381ad.tar.xz
qemu-2fa45344a92444439c081cad2342ffc048c381ad.zip
cpus: Pass CPUState to cpu_is_stopped()
CPUArchState is no longer needed there. Also change the return type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--cpu-all.h1
-rw-r--r--cpus.c4
-rw-r--r--include/qemu/cpu.h11
-rw-r--r--target-i386/kvm.c4
4 files changed, 14 insertions, 6 deletions
diff --git a/cpu-all.h b/cpu-all.h
index 6606432944..d19ec127e1 100644
--- 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 4654f0878b..0721a96831 100644
--- 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;
}
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 83378c54ae..4e62032463 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -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
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index c13f196e05..a3491a4fa1 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -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) {