xref: /qemu/target/openrisc/machine.c (revision 930c3d0074ad0a5e26560f2133f82d803369bec3)
1 /*
2  * OpenRISC Machine
3  *
4  * Copyright (c) 2011-2012 Jia Liu <proljc@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "qemu/osdep.h"
21 #include "qemu-common.h"
22 #include "cpu.h"
23 #include "hw/hw.h"
24 #include "hw/boards.h"
25 #include "migration/cpu.h"
26 
27 static const VMStateDescription vmstate_env = {
28     .name = "env",
29     .version_id = 2,
30     .minimum_version_id = 2,
31     .fields = (VMStateField[]) {
32         VMSTATE_UINTTL_ARRAY(gpr, CPUOpenRISCState, 32),
33         VMSTATE_UINTTL(pc, CPUOpenRISCState),
34         VMSTATE_UINTTL(npc, CPUOpenRISCState),
35         VMSTATE_UINTTL(ppc, CPUOpenRISCState),
36         VMSTATE_UINTTL(jmp_pc, CPUOpenRISCState),
37         VMSTATE_UINTTL(lock_addr, CPUOpenRISCState),
38         VMSTATE_UINTTL(lock_value, CPUOpenRISCState),
39         VMSTATE_UINTTL(epcr, CPUOpenRISCState),
40         VMSTATE_UINTTL(eear, CPUOpenRISCState),
41         VMSTATE_UINT32(sr, CPUOpenRISCState),
42         VMSTATE_UINT32(vr, CPUOpenRISCState),
43         VMSTATE_UINT32(upr, CPUOpenRISCState),
44         VMSTATE_UINT32(cpucfgr, CPUOpenRISCState),
45         VMSTATE_UINT32(dmmucfgr, CPUOpenRISCState),
46         VMSTATE_UINT32(immucfgr, CPUOpenRISCState),
47         VMSTATE_UINT32(esr, CPUOpenRISCState),
48         VMSTATE_UINT32(fpcsr, CPUOpenRISCState),
49         VMSTATE_END_OF_LIST()
50     }
51 };
52 
53 const VMStateDescription vmstate_openrisc_cpu = {
54     .name = "cpu",
55     .version_id = 1,
56     .minimum_version_id = 1,
57     .fields = (VMStateField[]) {
58         VMSTATE_CPU(),
59         VMSTATE_STRUCT(env, OpenRISCCPU, 1, vmstate_env, CPUOpenRISCState),
60         VMSTATE_END_OF_LIST()
61     }
62 };
63