From patchwork Wed Oct 31 00:59:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 195692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 75DE62C0085 for ; Wed, 31 Oct 2012 12:57:19 +1100 (EST) Received: from localhost ([::1]:36114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMgJ-00010w-U6 for incoming@patchwork.ozlabs.org; Tue, 30 Oct 2012 21:01:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMff-0007yn-R2 for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTMfb-0005Ii-1u for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:39 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52377 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTMfa-0005Hc-OB for qemu-devel@nongnu.org; Tue, 30 Oct 2012 21:00:34 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 3B295A3E85; Wed, 31 Oct 2012 02:00:33 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2012 01:59:44 +0100 Message-Id: <1351645206-3041-14-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1351645206-3041-1-git-send-email-afaerber@suse.de> References: <1351645206-3041-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: "open list:X86" , Marcelo Tosatti , =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws, Avi Kivity Subject: [Qemu-devel] [PATCH 13/35] cpus: Pass CPUState to cpu_is_stopped() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CPUArchState is no longer needed there. Also change the return type to bool. Signed-off-by: Andreas Färber --- cpu-all.h | 1 - cpus.c | 4 +--- include/qemu/cpu.h | 11 +++++++++++ target-i386/kvm.c | 4 ++-- 4 Dateien geändert, 14 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/cpu-all.h b/cpu-all.h index 6606432..d19ec12 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 4654f08..0721a96 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 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); +/** + * 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 c13f196..a3491a4 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) {