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