Received: from eggs.gnu.org ([208.118.235.92]:57564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD1b1-0000oC-68 for qemu-devel@nongnu.org; Tue, 05 Mar 2013 18:48:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UD1az-0000oo-U0 for qemu-devel@nongnu.org; Tue, 05 Mar 2013 18:48:35 -0500 Received: from ssl.serverraum.org ([88.198.40.39]:41549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD1az-0000ok-IR for qemu-devel@nongnu.org; Tue, 05 Mar 2013 18:48:33 -0500 From: Michael Walle Date: Wed, 6 Mar 2013 00:48:10 +0100 References: <1361816570-8707-1-git-send-email-afaerber@suse.de> <1361816570-8707-7-git-send-email-afaerber@suse.de> In-Reply-To: <1361816570-8707-7-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201303060048.10591.michael@walle.cc> Subject: Re: [Qemu-devel] [PATCH qom-cpu v3 6/6] target-lm32: Update VMStateDescription to LM32CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?q?F=C3=A4rber?= Cc: qemu-devel@nongnu.org, ehabkost@redhat.com, quintela@redhat.com Am Montag 25 Februar 2013, 19:22:50 schrieb Andreas F=C3=A4rber: > Add a vmstate_lm32_cpu referencing the previous VMStateDescription as a > sub-struct and hook it up to CPUClass::vmsd. Drop cpu_{save,load}(). >=20 > Signed-off-by: Andreas F=C3=A4rber Acked-by: Michael Walle > --- > target-lm32/cpu-qom.h | 4 ++++ > target-lm32/cpu.c | 2 ++ > target-lm32/cpu.h | 2 -- > target-lm32/machine.c | 25 +++++++++++++------------ > 4 Dateien ge=C3=A4ndert, 19 Zeilen hinzugef=C3=BCgt(+), 14 Zeilen entfer= nt(-) >=20 > diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h > index c0b6ce5..e00cca6 100644 > --- a/target-lm32/cpu-qom.h > +++ b/target-lm32/cpu-qom.h > @@ -71,4 +71,8 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State > *env) >=20 > #define ENV_OFFSET offsetof(LM32CPU, env) >=20 > +#ifndef CONFIG_USER_ONLY > +extern const struct VMStateDescription vmstate_lm32_cpu; > +#endif > + > #endif > diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c > index a2badb5..3199102 100644 > --- a/target-lm32/cpu.c > +++ b/target-lm32/cpu.c > @@ -83,6 +83,8 @@ static void lm32_cpu_class_init(ObjectClass *oc, void > *data) >=20 > lcc->parent_reset =3D cc->reset; > cc->reset =3D lm32_cpu_reset; > + > + cpu_class_set_vmsd(cc, &vmstate_lm32_cpu); > } >=20 > static const TypeInfo lm32_cpu_type_info =3D { > diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h > index 6948d0e..e0bbe04 100644 > --- a/target-lm32/cpu.h > +++ b/target-lm32/cpu.h > @@ -212,8 +212,6 @@ static inline CPULM32State *cpu_init(const char > *cpu_model) #define cpu_gen_code cpu_lm32_gen_code > #define cpu_signal_handler cpu_lm32_signal_handler >=20 > -#define CPU_SAVE_VERSION 1 > - > int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, i= nt > rw, int mmu_idx); > #define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault > diff --git a/target-lm32/machine.c b/target-lm32/machine.c > index 6802e81..9e0919c 100644 > --- a/target-lm32/machine.c > +++ b/target-lm32/machine.c > @@ -1,9 +1,9 @@ > #include "hw/hw.h" > #include "hw/boards.h" >=20 > -static const VMStateDescription vmstate_cpu =3D { > - .name =3D "cpu", > - .version_id =3D CPU_SAVE_VERSION, > +static const VMStateDescription vmstate_env =3D { > + .name =3D "env", > + .version_id =3D 1, > .minimum_version_id =3D 1, > .minimum_version_id_old =3D 1, > .fields =3D (VMStateField[]) { > @@ -22,12 +22,13 @@ static const VMStateDescription vmstate_cpu =3D { > } > }; >=20 > -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); > -} > +const VMStateDescription vmstate_lm32_cpu =3D { > + .name =3D "cpu", > + .version_id =3D 1, > + .minimum_version_id =3D 1, > + .minimum_version_id_old =3D 1, > + .fields =3D (VMStateField[]) { > + VMSTATE_STRUCT(env, LM32CPU, 1, vmstate_env, CPULM32State), > + VMSTATE_END_OF_LIST() > + } > +};