From: Magnus Kulke <[email protected]> hflags is a cached bitmap derived from standard and special regs. We want to reconstruct this state after regs and sregs have been read from the hypervisor, similar to how it's one in other accelerators.
Signed-off-by: Magnus Kulke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Bonzini <[email protected]> --- target/i386/mshv/mshv-cpu.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/target/i386/mshv/mshv-cpu.c b/target/i386/mshv/mshv-cpu.c index bbf874f6413..8bd63bd9628 100644 --- a/target/i386/mshv/mshv-cpu.c +++ b/target/i386/mshv/mshv-cpu.c @@ -765,6 +765,16 @@ static int set_vcpu_events(const CPUState *cpu) return 0; } +static int update_hflags(CPUState *cpu) +{ + X86CPU *x86cpu = X86_CPU(cpu); + CPUX86State *env = &x86cpu->env; + + x86_update_hflags(env); + + return 0; +} + int mshv_arch_load_vcpu_state(CPUState *cpu) { int ret; @@ -779,6 +789,9 @@ int mshv_arch_load_vcpu_state(CPUState *cpu) return ret; } + /* INVARIANT: hflags are derived from regs+sregs, need to get both first */ + update_hflags(cpu); + ret = get_xc_reg(cpu); if (ret < 0) { return ret; -- 2.54.0
