Skip to content

Commit 0ab2229

Browse files
bonziniMichael Tokarev
authored andcommitted
target/i386: fix xsave.flat from kvm-unit-tests
xsave.flat checks that "executing the XSETBV instruction causes a general- protection fault (#GP) if ECX = 0 and EAX[2:1] has the value 10b". QEMU allows that option, so the test fails. Add the condition. Cc: [email protected] Fixes: 8925443 ("target/i386: implement XSAVE and XRSTOR of AVX registers", 2022-10-18) Reported-by: Thomas Huth <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 7604bbc) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 9075bc0 commit 0ab2229

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

target/i386/tcg/fpu_helper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,6 +3010,11 @@ void helper_xsetbv(CPUX86State *env, uint32_t ecx, uint64_t mask)
30103010
goto do_gpf;
30113011
}
30123012

3013+
/* SSE can be disabled, but only if AVX is disabled too. */
3014+
if ((mask & (XSTATE_SSE_MASK | XSTATE_YMM_MASK)) == XSTATE_YMM_MASK) {
3015+
goto do_gpf;
3016+
}
3017+
30133018
/* Disallow enabling unimplemented features. */
30143019
cpu_x86_cpuid(env, 0x0d, 0, &ena_lo, &dummy, &dummy, &ena_hi);
30153020
ena = ((uint64_t)ena_hi << 32) | ena_lo;

0 commit comments

Comments
 (0)