This patch contains scripts for applying stress on host or guest at
[kvmfornfv.git] / qemu / target-alpha / machine.c
1 #include "qemu/osdep.h"
2 #include "hw/hw.h"
3 #include "hw/boards.h"
4
5 static int get_fpcr(QEMUFile *f, void *opaque, size_t size)
6 {
7     CPUAlphaState *env = opaque;
8     cpu_alpha_store_fpcr(env, qemu_get_be64(f));
9     return 0;
10 }
11
12 static void put_fpcr(QEMUFile *f, void *opaque, size_t size)
13 {
14     CPUAlphaState *env = opaque;
15     qemu_put_be64(f, cpu_alpha_load_fpcr(env));
16 }
17
18 static const VMStateInfo vmstate_fpcr = {
19     .name = "fpcr",
20     .get = get_fpcr,
21     .put = put_fpcr,
22 };
23
24 static VMStateField vmstate_env_fields[] = {
25     VMSTATE_UINTTL_ARRAY(ir, CPUAlphaState, 31),
26     VMSTATE_UINTTL_ARRAY(fir, CPUAlphaState, 31),
27     /* Save the architecture value of the fpcr, not the internally
28        expanded version.  Since this architecture value does not
29        exist in memory to be stored, this requires a but of hoop
30        jumping.  We want OFFSET=0 so that we effectively pass ENV
31        to the helper functions, and we need to fill in the name by
32        hand since there's no field of that name.  */
33     {
34         .name = "fpcr",
35         .version_id = 0,
36         .size = sizeof(uint64_t),
37         .info = &vmstate_fpcr,
38         .flags = VMS_SINGLE,
39         .offset = 0
40     },
41     VMSTATE_UINTTL(pc, CPUAlphaState),
42     VMSTATE_UINTTL(unique, CPUAlphaState),
43     VMSTATE_UINTTL(lock_addr, CPUAlphaState),
44     VMSTATE_UINTTL(lock_value, CPUAlphaState),
45     /* Note that lock_st_addr is not saved; it is a temporary
46        used during the execution of the st[lq]_c insns.  */
47
48     VMSTATE_UINT8(ps, CPUAlphaState),
49     VMSTATE_UINT8(intr_flag, CPUAlphaState),
50     VMSTATE_UINT8(pal_mode, CPUAlphaState),
51     VMSTATE_UINT8(fen, CPUAlphaState),
52
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 = 2,
75     .minimum_version_id = 2,
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 };