On Mon, Feb 18, 2013 at 08:42:28PM +0100, Andreas Färber wrote: > In comparison to DeviceClass::vmsd, CPU VMState is split in two, > "cpu_common" and "cpu", and uses cpu_index as instance_id instead of -1. > Therefore add a CPU-specific CPUClass::vmsd field. > > Unlike the legacy CPUArchState registration, rather register CPUState. > > Signed-off-by: Juan Quintela <quint...@redhat.com> > Signed-off-by: Andreas Färber <afaer...@suse.de> > --- [...] > @@ -266,6 +268,7 @@ CPUState *qemu_get_cpu(int index) > void cpu_exec_init(CPUArchState *env) > { > CPUState *cpu = ENV_GET_CPU(env); > + CPUClass *cc = CPU_GET_CLASS(cpu); > CPUArchState **penv; > int cpu_index; > > @@ -290,11 +293,15 @@ void cpu_exec_init(CPUArchState *env) > #if defined(CONFIG_USER_ONLY) > cpu_list_unlock(); > #endif > -#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) > vmstate_register(NULL, cpu_index, &vmstate_cpu_common, env);
Now vmstate_cpu_common is registered even if CPU_SAVE_VERSION isn't defined and cc->vmsd is NULL. Is this intentional? > +#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) > register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION, > cpu_save, cpu_load, env); > + assert(cc->vmsd == NULL); > #endif > + if (cc->vmsd != NULL) { > + vmstate_register(NULL, cpu_index, cc->vmsd, cpu); > + } > } > [...] -- Eduardo