From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPahu-0003e0-W8 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPahm-0005NV-9u for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43852 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPahm-0005Mn-38 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:18 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 4 Sep 2014 19:20:11 +0200 Message-Id: <1409851213-14330-2-git-send-email-afaerber@suse.de> In-Reply-To: <1409851213-14330-1-git-send-email-afaerber@suse.de> References: <1409851213-14330-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] [PULL v2 1/3] exec: Save CPUState::exception_index field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Pavel Dovgalyuk From: Pavel Dovgaluk This patch adds a subsection with exception_index field to the VMState fo= r correct saving the CPU state. Without this patch, simulator could miss the pending exception in the sav= ed virtual machine state. Signed-off-by: Pavel Dovgalyuk Signed-off-by: Andreas F=C3=A4rber --- exec.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/exec.c b/exec.c index 5122a33..7dddcc8 100644 --- a/exec.c +++ b/exec.c @@ -430,15 +430,50 @@ static int cpu_common_post_load(void *opaque, int v= ersion_id) return 0; } =20 +static int cpu_common_pre_load(void *opaque) +{ + CPUState *cpu =3D opaque; + + cpu->exception_index =3D 0; + + return 0; +} + +static bool cpu_common_exception_index_needed(void *opaque) +{ + CPUState *cpu =3D opaque; + + return cpu->exception_index !=3D 0; +} + +static const VMStateDescription vmstate_cpu_common_exception_index =3D { + .name =3D "cpu_common/exception_index", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_INT32(exception_index, CPUState), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_cpu_common =3D { .name =3D "cpu_common", .version_id =3D 1, .minimum_version_id =3D 1, + .pre_load =3D cpu_common_pre_load, .post_load =3D cpu_common_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINT32(halted, CPUState), VMSTATE_UINT32(interrupt_request, CPUState), VMSTATE_END_OF_LIST() + }, + .subsections =3D (VMStateSubsection[]) { + { + .vmsd =3D &vmstate_cpu_common_exception_index, + .needed =3D cpu_common_exception_index_needed, + } , { + /* empty */ + } } }; =20 --=20 1.8.4.5