1 #include "qemu/osdep.h" 2 #include "qemu-common.h" 3 #include "cpu.h" 4 #include "hw/hw.h" 5 #include "hw/boards.h" 6 #include "migration/cpu.h" 7 8 static int get_fpcr(QEMUFile *f, void *opaque, size_t size, 9 const VMStateField *field) 10 { 11 CPUAlphaState *env = opaque; 12 cpu_alpha_store_fpcr(env, qemu_get_be64(f)); 13 return 0; 14 } 15 16 static int put_fpcr(QEMUFile *f, void *opaque, size_t size, 17 const VMStateField *field, QJSON *vmdesc) 18 { 19 CPUAlphaState *env = opaque; 20 qemu_put_be64(f, cpu_alpha_load_fpcr(env)); 21 return 0; 22 } 23 24 static const VMStateInfo vmstate_fpcr = { 25 .name = "fpcr", 26 .get = get_fpcr, 27 .put = put_fpcr, 28 }; 29 30 static VMStateField vmstate_env_fields[] = { 31 VMSTATE_UINTTL_ARRAY(ir, CPUAlphaState, 31), 32 VMSTATE_UINTTL_ARRAY(fir, CPUAlphaState, 31), 33 /* Save the architecture value of the fpcr, not the internally 34 expanded version. Since this architecture value does not 35 exist in memory to be stored, this requires a but of hoop 36 jumping. We want OFFSET=0 so that we effectively pass ENV 37 to the helper functions, and we need to fill in the name by 38 hand since there's no field of that name. */ 39 { 40 .name = "fpcr", 41 .version_id = 0, 42 .size = sizeof(uint64_t), 43 .info = &vmstate_fpcr, 44 .flags = VMS_SINGLE, 45 .offset = 0 46 }, 47 VMSTATE_UINTTL(pc, CPUAlphaState), 48 VMSTATE_UINTTL(unique, CPUAlphaState), 49 VMSTATE_UINTTL(lock_addr, CPUAlphaState), 50 VMSTATE_UINTTL(lock_value, CPUAlphaState), 51 52 VMSTATE_UINT32(flags, CPUAlphaState), 53 VMSTATE_UINT32(pcc_ofs, CPUAlphaState), 54 55 VMSTATE_UINTTL(trap_arg0, CPUAlphaState), 56 VMSTATE_UINTTL(trap_arg1, CPUAlphaState), 57 VMSTATE_UINTTL(trap_arg2, CPUAlphaState), 58 59 VMSTATE_UINTTL(exc_addr, CPUAlphaState), 60 VMSTATE_UINTTL(palbr, CPUAlphaState), 61 VMSTATE_UINTTL(ptbr, CPUAlphaState), 62 VMSTATE_UINTTL(vptptr, CPUAlphaState), 63 VMSTATE_UINTTL(sysval, CPUAlphaState), 64 VMSTATE_UINTTL(usp, CPUAlphaState), 65 66 VMSTATE_UINTTL_ARRAY(shadow, CPUAlphaState, 8), 67 VMSTATE_UINTTL_ARRAY(scratch, CPUAlphaState, 24), 68 69 VMSTATE_END_OF_LIST() 70 }; 71 72 static const VMStateDescription vmstate_env = { 73 .name = "env", 74 .version_id = 3, 75 .minimum_version_id = 3, 76 .fields = vmstate_env_fields, 77 }; 78 79 static VMStateField vmstate_cpu_fields[] = { 80 VMSTATE_CPU(), 81 VMSTATE_STRUCT(env, AlphaCPU, 1, vmstate_env, CPUAlphaState), 82 VMSTATE_END_OF_LIST() 83 }; 84 85 const VMStateDescription vmstate_alpha_cpu = { 86 .name = "cpu", 87 .version_id = 1, 88 .minimum_version_id = 1, 89 .fields = vmstate_cpu_fields, 90 }; 91