target/hexagon: Add vmstate representation
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Brian Cain committed
Jun 22, 2026 at 15:28 UTC
05b4e47b7463bf0cf8a395c63f94869dfdf8b22d
3 files changed
+39
target/hexagon/cpu.c
+3
@@ -382,6 +382,9 @@ static void hexagon_cpu_class_init(ObjectClass *c, const void *data)
382
cc->gdb_stop_before_watchpoint = true;
383
cc->gdb_core_xml_file = "hexagon-core.xml";
384
cc->disas_set_info = hexagon_cpu_disas_set_info;
385
+#ifndef CONFIG_USER_ONLY
386
+ dc->vmsd = &vmstate_hexagon_cpu;
387
+#endif
388
cc->tcg_ops = &hexagon_tcg_ops;
389
}
390
target/hexagon/internal.h
+4
@@ -31,4 +31,8 @@ void hexagon_debug(CPUHexagonState *env);
31
32
extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
33
34
+#ifndef CONFIG_USER_ONLY
35
+extern const VMStateDescription vmstate_hexagon_cpu;
36
+#endif
37
+
38
#endif
target/hexagon/machine.c
new
+32
@@ -0,0 +1,32 @@
1
+/*
2
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
3
+ *
4
+ * SPDX-License-Identifier: GPL-2.0-or-later
5
+ */
6
+
7
+#include "qemu/osdep.h"
8
+#include "migration/vmstate.h"
9
+#include "cpu.h"
10
+
11
+const VMStateDescription vmstate_hexagon_cpu = {
12
+ .name = "cpu",
13
+ .version_id = 1,
14
+ .minimum_version_id = 1,
15
+ .fields = (const VMStateField[]) {
16
+ VMSTATE_UINT32_ARRAY(env.gpr, HexagonCPU, TOTAL_PER_THREAD_REGS),
17
+ VMSTATE_UINT32_ARRAY(env.pred, HexagonCPU, NUM_PREGS),
18
+ VMSTATE_UINT32_ARRAY(env.t_sreg, HexagonCPU, NUM_SREGS),
19
+ VMSTATE_UINT32_ARRAY(env.greg, HexagonCPU, NUM_GREGS),
20
+ VMSTATE_UINT32(env.next_PC, HexagonCPU),
21
+ VMSTATE_UINT32(env.tlb_lock_state, HexagonCPU),
22
+ VMSTATE_UINT32(env.k0_lock_state, HexagonCPU),
23
+ VMSTATE_UINT32(env.tlb_lock_count, HexagonCPU),
24
+ VMSTATE_UINT32(env.k0_lock_count, HexagonCPU),
25
+ VMSTATE_UINT32(env.threadId, HexagonCPU),
26
+ VMSTATE_UINT32(env.cause_code, HexagonCPU),
27
+ VMSTATE_UINT32(env.wait_next_pc, HexagonCPU),
28
+ VMSTATE_UINT64(env.t_cycle_count, HexagonCPU),
29
+
30
+ VMSTATE_END_OF_LIST()
31
+ },
32
+};