target-lm32: Update VMStateDescription to LM32CPU
Add a vmstate_lm32_cpu referencing the previous VMStateDescription as a
sub-struct and hook it up to CPUClass::vmsd. Drop cpu_{save,load}().
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
			
			
This commit is contained in:
		
							parent
							
								
									e6f010cc27
								
							
						
					
					
						commit
						0ad6773f11
					
				| 
						 | 
					@ -71,6 +71,10 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ENV_OFFSET offsetof(LM32CPU, env)
 | 
					#define ENV_OFFSET offsetof(LM32CPU, env)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CONFIG_USER_ONLY
 | 
				
			||||||
 | 
					extern const struct VMStateDescription vmstate_lm32_cpu;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void lm32_cpu_do_interrupt(CPUState *cpu);
 | 
					void lm32_cpu_do_interrupt(CPUState *cpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +85,7 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
 | 
				
			||||||
    cc->reset = lm32_cpu_reset;
 | 
					    cc->reset = lm32_cpu_reset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cc->do_interrupt = lm32_cpu_do_interrupt;
 | 
					    cc->do_interrupt = lm32_cpu_do_interrupt;
 | 
				
			||||||
 | 
					    cpu_class_set_vmsd(cc, &vmstate_lm32_cpu);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const TypeInfo lm32_cpu_type_info = {
 | 
					static const TypeInfo lm32_cpu_type_info = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -211,8 +211,6 @@ static inline CPULM32State *cpu_init(const char *cpu_model)
 | 
				
			||||||
#define cpu_gen_code cpu_lm32_gen_code
 | 
					#define cpu_gen_code cpu_lm32_gen_code
 | 
				
			||||||
#define cpu_signal_handler cpu_lm32_signal_handler
 | 
					#define cpu_signal_handler cpu_lm32_signal_handler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CPU_SAVE_VERSION 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
 | 
					int cpu_lm32_handle_mmu_fault(CPULM32State *env, target_ulong address, int rw,
 | 
				
			||||||
                              int mmu_idx);
 | 
					                              int mmu_idx);
 | 
				
			||||||
#define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
 | 
					#define cpu_handle_mmu_fault cpu_lm32_handle_mmu_fault
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
#include "hw/hw.h"
 | 
					#include "hw/hw.h"
 | 
				
			||||||
#include "hw/boards.h"
 | 
					#include "hw/boards.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const VMStateDescription vmstate_cpu = {
 | 
					static const VMStateDescription vmstate_env = {
 | 
				
			||||||
    .name = "cpu",
 | 
					    .name = "env",
 | 
				
			||||||
    .version_id = CPU_SAVE_VERSION,
 | 
					    .version_id = 1,
 | 
				
			||||||
    .minimum_version_id = 1,
 | 
					    .minimum_version_id = 1,
 | 
				
			||||||
    .minimum_version_id_old = 1,
 | 
					    .minimum_version_id_old = 1,
 | 
				
			||||||
    .fields      = (VMStateField[]) {
 | 
					    .fields      = (VMStateField[]) {
 | 
				
			||||||
| 
						 | 
					@ -22,12 +22,13 @@ static const VMStateDescription vmstate_cpu = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cpu_save(QEMUFile *f, void *opaque)
 | 
					const VMStateDescription vmstate_lm32_cpu = {
 | 
				
			||||||
{
 | 
					    .name = "cpu",
 | 
				
			||||||
    vmstate_save_state(f, &vmstate_cpu, opaque);
 | 
					    .version_id = 1,
 | 
				
			||||||
}
 | 
					    .minimum_version_id = 1,
 | 
				
			||||||
 | 
					    .minimum_version_id_old = 1,
 | 
				
			||||||
int cpu_load(QEMUFile *f, void *opaque, int version_id)
 | 
					    .fields      = (VMStateField[]) {
 | 
				
			||||||
{
 | 
					        VMSTATE_STRUCT(env, LM32CPU, 1, vmstate_env, CPULM32State),
 | 
				
			||||||
    return vmstate_load_state(f, &vmstate_cpu, opaque, version_id);
 | 
					        VMSTATE_END_OF_LIST()
 | 
				
			||||||
}
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue