From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uojo4-0004Mr-2T for qemu-devel@nongnu.org; Mon, 17 Jun 2013 20:29:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uojo1-00079B-Qj for qemu-devel@nongnu.org; Mon, 17 Jun 2013 20:29:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38623 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uojo1-000791-KH for qemu-devel@nongnu.org; Mon, 17 Jun 2013 20:29:53 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 18 Jun 2013 02:29:42 +0200 Message-Id: <1371515385-32203-4-git-send-email-afaerber@suse.de> In-Reply-To: <1371515385-32203-1-git-send-email-afaerber@suse.de> References: <1371515385-32203-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-cpu v3 3/6] cpu: Introduce VMSTATE_CPU() macro for CPUState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , quintela@redhat.com To be used to embed common CPU state into CPU subclasses. Signed-off-by: Andreas F=C3=A4rber --- exec.c | 5 ++--- include/qom/cpu.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/exec.c b/exec.c index 5b8b40d..0bee004 100644 --- a/exec.c +++ b/exec.c @@ -246,7 +246,7 @@ static int cpu_common_post_load(void *opaque, int ver= sion_id) return 0; } =20 -static const VMStateDescription vmstate_cpu_common =3D { +const VMStateDescription vmstate_cpu_common =3D { .name =3D "cpu_common", .version_id =3D 1, .minimum_version_id =3D 1, @@ -258,8 +258,7 @@ static const VMStateDescription vmstate_cpu_common =3D= { VMSTATE_END_OF_LIST() } }; -#else -#define vmstate_cpu_common vmstate_dummy + #endif =20 CPUState *qemu_get_cpu(int index) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 397219b..3e8cc47 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -378,4 +378,18 @@ void cpu_reset_interrupt(CPUState *cpu, int mask); */ void cpu_resume(CPUState *cpu); =20 +#ifdef CONFIG_SOFTMMU +extern const struct VMStateDescription vmstate_cpu_common; +#else +#define vmstate_cpu_common vmstate_dummy +#endif + +#define VMSTATE_CPU() { = \ + .name =3D "parent_obj", = \ + .size =3D sizeof(CPUState), = \ + .vmsd =3D &vmstate_cpu_common, = \ + .flags =3D VMS_STRUCT, = \ + .offset =3D 0, = \ +} + #endif --=20 1.8.1.4