qemu/target-openrisc/machine.c
<<
>>
Prefs
   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 "hw/hw.h"
  21#include "hw/boards.h"
  22
  23static const VMStateDescription vmstate_cpu = {
  24    .name = "cpu",
  25    .fields = (VMStateField[]) {
  26        VMSTATE_UINT32_ARRAY(gpr, CPUOpenRISCState, 32),
  27        VMSTATE_UINT32(sr, CPUOpenRISCState),
  28        VMSTATE_UINT32(epcr, CPUOpenRISCState),
  29        VMSTATE_UINT32(eear, CPUOpenRISCState),
  30        VMSTATE_UINT32(esr, CPUOpenRISCState),
  31        VMSTATE_UINT32(fpcsr, CPUOpenRISCState),
  32        VMSTATE_UINT32(pc, CPUOpenRISCState),
  33        VMSTATE_UINT32(npc, CPUOpenRISCState),
  34        VMSTATE_UINT32(ppc, CPUOpenRISCState),
  35        VMSTATE_END_OF_LIST()
  36    }
  37};
  38
  39void cpu_save(QEMUFile *f, void *opaque)
  40{
  41    vmstate_save_state(f, &vmstate_cpu, opaque);
  42}
  43
  44int cpu_load(QEMUFile *f, void *opaque, int version_id)
  45{
  46    return vmstate_load_state(f, &vmstate_cpu, opaque, version_id);
  47}
  48