qdev: split out UI portions into a new function
[qemu.git] / target-alpha / machine.c
1 #include "hw/hw.h"
2 #include "hw/boards.h"
3
4 static int get_fpcr(QEMUFile *f, void *opaque, size_t size)
5 {
6 CPUAlphaState *env = opaque;
7 cpu_alpha_store_fpcr(env, qemu_get_be64(f));
8 return 0;
9 }
10
11 static void put_fpcr(QEMUFile *f, void *opaque, size_t size)
12 {
13 CPUAlphaState *env = opaque;
14 qemu_put_be64(f, cpu_alpha_load_fpcr(env));
15 }
16
17 static const VMStateInfo vmstate_fpcr = {
18 .name = "fpcr",
19 .get = get_fpcr,
20 .put = put_fpcr,
21 };
22
23 static VMStateField vmstate_cpu_fields[] = {
24 VMSTATE_UINTTL_ARRAY(ir, CPUState, 31),
25 VMSTATE_UINTTL_ARRAY(fir, CPUState, 31),
26 /* Save the architecture value of the fpcr, not the internally
27 expanded version. Since this architecture value does not
28 exist in memory to be stored, this requires a but of hoop
29 jumping. We want OFFSET=0 so that we effectively pass ENV
30 to the helper functions, and we need to fill in the name by
31 hand since there's no field of that name. */
32 {
33 .name = "fpcr",
34 .version_id = 0,
35 .size = sizeof(uint64_t),
36 .info = &vmstate_fpcr,
37 .flags = VMS_SINGLE,
38 .offset = 0
39 },
40 VMSTATE_UINTTL(pc, CPUState),
41 VMSTATE_UINTTL(unique, CPUState),
42 VMSTATE_UINTTL(lock_addr, CPUState),
43 VMSTATE_UINTTL(lock_value, CPUState),
44 /* Note that lock_st_addr is not saved; it is a temporary
45 used during the execution of the st[lq]_c insns. */
46
47 VMSTATE_UINT8(ps, CPUState),
48 VMSTATE_UINT8(intr_flag, CPUState),
49 VMSTATE_UINT8(pal_mode, CPUState),
50 VMSTATE_UINT8(fen, CPUState),
51
52 VMSTATE_UINT32(pcc_ofs, CPUState),
53
54 VMSTATE_UINTTL(trap_arg0, CPUState),
55 VMSTATE_UINTTL(trap_arg1, CPUState),
56 VMSTATE_UINTTL(trap_arg2, CPUState),
57
58 VMSTATE_UINTTL(exc_addr, CPUState),
59 VMSTATE_UINTTL(palbr, CPUState),
60 VMSTATE_UINTTL(ptbr, CPUState),
61 VMSTATE_UINTTL(vptptr, CPUState),
62 VMSTATE_UINTTL(sysval, CPUState),
63 VMSTATE_UINTTL(usp, CPUState),
64
65 VMSTATE_UINTTL_ARRAY(shadow, CPUState, 8),
66 VMSTATE_UINTTL_ARRAY(scratch, CPUState, 24),
67
68 VMSTATE_END_OF_LIST()
69 };
70
71 static const VMStateDescription vmstate_cpu = {
72 .name = "cpu",
73 .version_id = 1,
74 .minimum_version_id = 1,
75 .minimum_version_id_old = 1,
76 .fields = vmstate_cpu_fields,
77 };
78
79 void cpu_save(QEMUFile *f, void *opaque)
80 {
81 vmstate_save_state(f, &vmstate_cpu, opaque);
82 }
83
84 int cpu_load(QEMUFile *f, void *opaque, int version_id)
85 {
86 return vmstate_load_state(f, &vmstate_cpu, opaque, version_id);
87 }