From patchwork Wed May 12 21:25:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 99115 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CLRV2u029363 for ; Wed, 12 May 2010 21:27:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757964Ab0ELV11 (ORCPT ); Wed, 12 May 2010 17:27:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16802 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757942Ab0ELV1M (ORCPT ); Wed, 12 May 2010 17:27:12 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLRA4G030518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 May 2010 17:27:10 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR9Mo025582; Wed, 12 May 2010 17:27:09 -0400 Received: from amt.cnet (vpn2-10-158.ams2.redhat.com [10.36.10.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR34R021869; Wed, 12 May 2010 17:27:08 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 90B1A65607C; Wed, 12 May 2010 18:26:08 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o4CLQ4R0028649; Wed, 12 May 2010 18:26:04 -0300 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Marcelo Tosatti , Avi Kivity Subject: [PATCH 07/12] add cpu_is_stopped helper Date: Wed, 12 May 2010 18:25:01 -0300 Message-Id: <3ae9501c5bfe874017a385ca437583f5cf66a40a.1273699506.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 21:27:31 +0000 (UTC) diff --git a/cpu-all.h b/cpu-all.h index 9efb8a9..47a5722 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -821,6 +821,7 @@ void cpu_watchpoint_remove_all(CPUState *env, int mask); void cpu_single_step(CPUState *env, int enabled); void cpu_reset(CPUState *s); +int cpu_is_stopped(CPUState *env); void run_on_cpu(CPUState *env, void (*func)(void *data), void *data); #define CPU_LOG_TB_OUT_ASM (1 << 0) diff --git a/cpus.c b/cpus.c index af87007..826886c 100644 --- a/cpus.c +++ b/cpus.c @@ -91,6 +91,11 @@ void cpu_synchronize_all_post_init(void) } } +int cpu_is_stopped(CPUState *env) +{ + return !vm_running || env->stopped; +} + static void do_vm_stop(int reason) { if (vm_running) {