mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
target/loongarch: Add basic vmstate description of CPU.
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220606124333.2060567-21-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
398cecb9c3
commit
67ebd42a48
@ -336,6 +336,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
|
||||
cc->class_by_name = loongarch_cpu_class_by_name;
|
||||
cc->dump_state = loongarch_cpu_dump_state;
|
||||
cc->set_pc = loongarch_cpu_set_pc;
|
||||
dc->vmsd = &vmstate_loongarch_cpu;
|
||||
cc->disas_set_info = loongarch_cpu_disas_set_info;
|
||||
#ifdef CONFIG_TCG
|
||||
cc->tcg_ops = &loongarch_tcg_ops;
|
||||
|
@ -25,4 +25,6 @@ const char *loongarch_exception_name(int32_t exception);
|
||||
|
||||
void restore_fp_status(CPULoongArchState *env);
|
||||
|
||||
extern const VMStateDescription vmstate_loongarch_cpu;
|
||||
|
||||
#endif
|
||||
|
85
target/loongarch/machine.c
Normal file
85
target/loongarch/machine.c
Normal file
@ -0,0 +1,85 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* QEMU LoongArch Machine State
|
||||
*
|
||||
* Copyright (c) 2021 Loongson Technology Corporation Limited
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "migration/cpu.h"
|
||||
|
||||
/* LoongArch CPU state */
|
||||
|
||||
const VMStateDescription vmstate_loongarch_cpu = {
|
||||
.name = "cpu",
|
||||
.version_id = 0,
|
||||
.minimum_version_id = 0,
|
||||
.fields = (VMStateField[]) {
|
||||
|
||||
VMSTATE_UINTTL_ARRAY(env.gpr, LoongArchCPU, 32),
|
||||
VMSTATE_UINTTL(env.pc, LoongArchCPU),
|
||||
VMSTATE_UINT64_ARRAY(env.fpr, LoongArchCPU, 32),
|
||||
VMSTATE_UINT32(env.fcsr0, LoongArchCPU),
|
||||
VMSTATE_BOOL_ARRAY(env.cf, LoongArchCPU, 8),
|
||||
|
||||
/* Remaining CSRs */
|
||||
VMSTATE_UINT64(env.CSR_CRMD, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PRMD, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_EUEN, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MISC, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_ECFG, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_ESTAT, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_ERA, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_BADV, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_BADI, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_EENTRY, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBIDX, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBEHI, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBELO0, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBELO1, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_ASID, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PGDL, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PGDH, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PGD, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PWCL, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PWCH, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_STLBPS, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_RVACFG, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PRCFG1, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PRCFG2, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_PRCFG3, LoongArchCPU),
|
||||
VMSTATE_UINT64_ARRAY(env.CSR_SAVE, LoongArchCPU, 16),
|
||||
VMSTATE_UINT64(env.CSR_TID, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TCFG, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TVAL, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_CNTC, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TICLR, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_LLBCTL, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_IMPCTL1, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_IMPCTL2, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRENTRY, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRBADV, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRERA, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRSAVE, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRELO0, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRELO1, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBREHI, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_TLBRPRMD, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRCTL, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRINFO1, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRINFO2, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRENTRY, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRERA, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_MERRSAVE, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_CTAG, LoongArchCPU),
|
||||
VMSTATE_UINT64_ARRAY(env.CSR_DMW, LoongArchCPU, 4),
|
||||
|
||||
/* Debug CSRs */
|
||||
VMSTATE_UINT64(env.CSR_DBG, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_DERA, LoongArchCPU),
|
||||
VMSTATE_UINT64(env.CSR_DSAVE, LoongArchCPU),
|
||||
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
@ -14,6 +14,12 @@ loongarch_tcg_ss.add(files(
|
||||
))
|
||||
loongarch_tcg_ss.add(zlib)
|
||||
|
||||
loongarch_softmmu_ss = ss.source_set()
|
||||
loongarch_softmmu_ss.add(files(
|
||||
'machine.c',
|
||||
))
|
||||
|
||||
loongarch_ss.add_all(when: 'CONFIG_TCG', if_true: [loongarch_tcg_ss])
|
||||
|
||||
target_arch += {'loongarch': loongarch_ss}
|
||||
target_softmmu_arch += {'loongarch': loongarch_softmmu_ss}
|
||||
|
Loading…
Reference in New Issue
Block a user