From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1wl-0000Vg-GH for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SX1we-0005c3-Bl for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35570 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SX1we-0005b8-3K for qemu-devel@nongnu.org; Tue, 22 May 2012 23:09:04 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 23 May 2012 05:07:38 +0200 Message-Id: <1337742502-28565-16-git-send-email-afaerber@suse.de> In-Reply-To: <1337742502-28565-1-git-send-email-afaerber@suse.de> References: <1337742502-28565-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-next 15/59] cpus: Pass CPUState to cpu_is_stopped() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcelo Tosatti , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "open list:X86" , Avi Kivity CPUArchState is no longer needed there. Also change the return type to bool. Signed-off-by: Andreas F=C3=A4rber --- cpu-all.h | 1 - cpus.c | 4 +--- include/qemu/cpu.h | 11 +++++++++++ target-i386/kvm.c | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index 3a93c0c..af85e7d 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -443,7 +443,6 @@ void cpu_watchpoint_remove_all(CPUArchState *env, int= mask); #define SSTEP_NOTIMER 0x4 /* Do not Timers while single stepping */ =20 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)= ; =20 #define CPU_LOG_TB_OUT_ASM (1 << 0) diff --git a/cpus.c b/cpus.c index fca4eb2..753277d 100644 --- a/cpus.c +++ b/cpus.c @@ -404,10 +404,8 @@ void cpu_synchronize_all_post_init(void) } } =20 -int cpu_is_stopped(CPUArchState *env) +bool cpu_is_stopped(CPUState *cpu) { - CPUState *cpu =3D ENV_GET_CPU(env); - return !runstate_is_running() || cpu->stopped; } =20 diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h index 83378c5..4e62032 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); =20 +/** + * 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); + =20 #endif diff --git a/target-i386/kvm.c b/target-i386/kvm.c index e9e2241..92ad338 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1530,7 +1530,7 @@ int kvm_arch_put_registers(CPUX86State *env, int le= vel) CPUState *cpu =3D ENV_GET_CPU(env); int ret; =20 - assert(cpu_is_stopped(env) || qemu_cpu_is_self(cpu)); + assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 ret =3D kvm_getput_regs(env, 1); if (ret < 0) { @@ -1588,7 +1588,7 @@ int kvm_arch_get_registers(CPUX86State *env) CPUState *cpu =3D ENV_GET_CPU(env); int ret; =20 - assert(cpu_is_stopped(env) || qemu_cpu_is_self(cpu)); + assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 ret =3D kvm_getput_regs(env, 0); if (ret < 0) { --=20 1.7.7