From: Zide Chen <zide.chen@intel.com>
Add a VMStateDescription to migrate APX EGPRs.
Tested-by: Xudong Hao <xudong.hao@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Co-developed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
target/i386/machine.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 265388f1fd36..84faa2f8f8d3 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -1744,6 +1744,27 @@ static const VMStateDescription vmstate_cet = {
},
};
+#ifdef TARGET_X86_64
+static bool apx_needed(void *opaque)
+{
+ X86CPU *cpu = opaque;
+ CPUX86State *env = &cpu->env;
+
+ return !!(env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_APX);
+}
+
+static const VMStateDescription vmstate_apx = {
+ .name = "cpu/apx",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = apx_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT64_ARRAY(env.egprs, X86CPU, EGPR_NUM),
+ VMSTATE_END_OF_LIST()
+ }
+};
+#endif
+
const VMStateDescription vmstate_x86_cpu = {
.name = "cpu",
.version_id = 12,
@@ -1895,6 +1916,9 @@ const VMStateDescription vmstate_x86_cpu = {
&vmstate_triple_fault,
&vmstate_pl0_ssp,
&vmstate_cet,
+#ifdef TARGET_X86_64
+ &vmstate_apx,
+#endif
NULL
}
};
--
2.34.1