From patchwork Thu Feb 10 23:11:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 82687 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 31F12B7123 for ; Fri, 11 Feb 2011 10:19:16 +1100 (EST) Received: from localhost ([127.0.0.1]:43274 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pnfn2-0005gL-S0 for incoming@patchwork.ozlabs.org; Thu, 10 Feb 2011 18:19:08 -0500 Received: from [140.186.70.92] (port=41137 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pnfgl-0002gM-Rj for qemu-devel@nongnu.org; Thu, 10 Feb 2011 18:12:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pnfgj-0003dQ-FF for qemu-devel@nongnu.org; Thu, 10 Feb 2011 18:12:39 -0500 Received: from mail.serverraum.org ([78.47.150.89]:59729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pnfgj-0003dG-7X for qemu-devel@nongnu.org; Thu, 10 Feb 2011 18:12:37 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.serverraum.org (Postfix) with ESMTP id CFCA43EEF6; Fri, 11 Feb 2011 00:12:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.serverraum.org Received: from mail.serverraum.org ([127.0.0.1]) by localhost (web.serverraum.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vChvqEGE4IPc; Fri, 11 Feb 2011 00:12:36 +0100 (CET) Received: from thanatos.fritz.box (91-66-128-56-dynip.superkabel.de [91.66.128.56]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.serverraum.org (Postfix) with ESMTPSA id 569AF3EEFA; Fri, 11 Feb 2011 00:12:36 +0100 (CET) From: Michael Walle To: qemu-devel@nongnu.org Date: Fri, 11 Feb 2011 00:11:57 +0100 Message-Id: <1297379530-23487-5-git-send-email-michael@walle.cc> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1297379530-23487-1-git-send-email-michael@walle.cc> References: <1297379530-23487-1-git-send-email-michael@walle.cc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 78.47.150.89 Cc: "Edgar E. Iglesias" , Michael Walle , Alexander Graf , Richard Henderson Subject: [Qemu-devel] [PATCH 04/17] lm32: machine state loading/saving X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds support for saving and loading the processor state. Signed-off-by: Michael Walle --- target-lm32/machine.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) create mode 100644 target-lm32/machine.c diff --git a/target-lm32/machine.c b/target-lm32/machine.c new file mode 100644 index 0000000..70ca52a --- /dev/null +++ b/target-lm32/machine.c @@ -0,0 +1,33 @@ +#include "hw/hw.h" +#include "hw/boards.h" + +static const VMStateDescription vmstate_cpu = { + .name = "cpu", + .version_id = CPU_SAVE_VERSION, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32_ARRAY(regs, CPUState, 32), + VMSTATE_UINT32(pc, CPUState), + VMSTATE_UINT32(ie, CPUState), + VMSTATE_UINT32(icc, CPUState), + VMSTATE_UINT32(dcc, CPUState), + VMSTATE_UINT32(cc, CPUState), + VMSTATE_UINT32(eba, CPUState), + VMSTATE_UINT32(dc, CPUState), + VMSTATE_UINT32(deba, CPUState), + VMSTATE_UINT32_ARRAY(bp, CPUState, 4), + VMSTATE_UINT32_ARRAY(wp, CPUState, 4), + VMSTATE_END_OF_LIST() + } +}; + +void cpu_save(QEMUFile *f, void *opaque) +{ + vmstate_save_state(f, &vmstate_cpu, opaque); +} + +int cpu_load(QEMUFile *f, void *opaque, int version_id) +{ + return vmstate_load_state(f, &vmstate_cpu, opaque, version_id); +}