Am 18.05.2012 04:56, schrieb 陳韋任: >>> This is a mix of two ways of doing the same thing. You should only use >>> VMState for new code. >>> >> >> did you mean I should not use QEMUFile? > > I guess what Andreas means is there are two ways to do cpu_save/cpu_load, > the one you wrote is the old style. For the brand new target, you should use > VMState completely.
Exactly what I meant. Although I'm working towards making that even easier by leveraging code from Juan's vmstate series and having the CPUs just store a pointer to their VMStateDescription like devices do. Andreas > You can take target-lm32/machine.c as an example. > > --- > 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); > } > --- > > Leave to vmstate_save_state/vmstate_load_state (savevm.c) do the real > things. > > Regards, > chenwj > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg