1 /* 2 * CRIS virtual CPU state save/load support 3 * 4 * Copyright (c) 2012 Red Hat, Inc. 5 * Written by Juan Quintela <quintela@redhat.com> 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include "qemu/osdep.h" 22 #include "cpu.h" 23 #include "hw/hw.h" 24 #include "migration/cpu.h" 25 26 static const VMStateDescription vmstate_tlbset = { 27 .name = "cpu/tlbset", 28 .version_id = 1, 29 .minimum_version_id = 1, 30 .fields = (VMStateField[]) { 31 VMSTATE_UINT32(lo, TLBSet), 32 VMSTATE_UINT32(hi, TLBSet), 33 VMSTATE_END_OF_LIST() 34 } 35 }; 36 37 static const VMStateDescription vmstate_cris_env = { 38 .name = "env", 39 .version_id = 2, 40 .minimum_version_id = 2, 41 .fields = (VMStateField[]) { 42 VMSTATE_UINT32_ARRAY(regs, CPUCRISState, 16), 43 VMSTATE_UINT32_ARRAY(pregs, CPUCRISState, 16), 44 VMSTATE_UINT32(pc, CPUCRISState), 45 VMSTATE_UINT32(ksp, CPUCRISState), 46 VMSTATE_INT32(dslot, CPUCRISState), 47 VMSTATE_INT32(btaken, CPUCRISState), 48 VMSTATE_UINT32(btarget, CPUCRISState), 49 VMSTATE_UINT32(cc_op, CPUCRISState), 50 VMSTATE_UINT32(cc_mask, CPUCRISState), 51 VMSTATE_UINT32(cc_dest, CPUCRISState), 52 VMSTATE_UINT32(cc_src, CPUCRISState), 53 VMSTATE_UINT32(cc_result, CPUCRISState), 54 VMSTATE_INT32(cc_size, CPUCRISState), 55 VMSTATE_INT32(cc_x, CPUCRISState), 56 VMSTATE_INT32(locked_irq, CPUCRISState), 57 VMSTATE_INT32(interrupt_vector, CPUCRISState), 58 VMSTATE_INT32(fault_vector, CPUCRISState), 59 VMSTATE_INT32(trap_vector, CPUCRISState), 60 VMSTATE_UINT32_ARRAY(sregs[0], CPUCRISState, 16), 61 VMSTATE_UINT32_ARRAY(sregs[1], CPUCRISState, 16), 62 VMSTATE_UINT32_ARRAY(sregs[2], CPUCRISState, 16), 63 VMSTATE_UINT32_ARRAY(sregs[3], CPUCRISState, 16), 64 VMSTATE_UINT32(mmu_rand_lfsr, CPUCRISState), 65 VMSTATE_STRUCT_ARRAY(tlbsets[0][0], CPUCRISState, 16, 0, 66 vmstate_tlbset, TLBSet), 67 VMSTATE_STRUCT_ARRAY(tlbsets[0][1], CPUCRISState, 16, 0, 68 vmstate_tlbset, TLBSet), 69 VMSTATE_STRUCT_ARRAY(tlbsets[0][2], CPUCRISState, 16, 0, 70 vmstate_tlbset, TLBSet), 71 VMSTATE_STRUCT_ARRAY(tlbsets[0][3], CPUCRISState, 16, 0, 72 vmstate_tlbset, TLBSet), 73 VMSTATE_STRUCT_ARRAY(tlbsets[1][0], CPUCRISState, 16, 0, 74 vmstate_tlbset, TLBSet), 75 VMSTATE_STRUCT_ARRAY(tlbsets[1][1], CPUCRISState, 16, 0, 76 vmstate_tlbset, TLBSet), 77 VMSTATE_STRUCT_ARRAY(tlbsets[1][2], CPUCRISState, 16, 0, 78 vmstate_tlbset, TLBSet), 79 VMSTATE_STRUCT_ARRAY(tlbsets[1][3], CPUCRISState, 16, 0, 80 vmstate_tlbset, TLBSet), 81 VMSTATE_END_OF_LIST() 82 } 83 }; 84 85 const VMStateDescription vmstate_cris_cpu = { 86 .name = "cpu", 87 .version_id = 1, 88 .minimum_version_id = 1, 89 .fields = (VMStateField[]) { 90 VMSTATE_CPU(), 91 VMSTATE_STRUCT(env, CRISCPU, 1, vmstate_cris_env, CPUCRISState), 92 VMSTATE_END_OF_LIST() 93 } 94 }; 95