@samitouri / QOSamiQemu / commits / 5cc3e4ea53

target/i386: use ESA_FEATURE_ALIGN64_MASK

Do not hardcode bit 1. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo Bonzini committed Aug 7, 2026 at 15:19 UTC 5cc3e4ea53567405a30241c69da6215124279c64
1 file changed +3 -3
target/i386/xsave_helper.c
+3 -3
@@ -382,7 +382,7 @@ int decompact_xsave_area(const void *buf, size_t buflen, CPUX86State *env)
382
383 size = eax;
384 dst_off = ebx;
385 - align64 = (ecx & (1u << 1)) != 0;
385 + align64 = (ecx & ESA_FEATURE_ALIGN64_MASK) != 0;
386 supervisor = (ecx & ESA_FEATURE_XSS_MASK) != 0;
387
388 /* Component is in the layout but unknown to the guest CPUID model */
@@ -394,7 +394,7 @@ int decompact_xsave_area(const void *buf, size_t buflen, CPUX86State *env)
394 */
395 host_cpuid(0xD, i, &eax, &ebx, &ecx, &edx);
396 size = eax;
397 - align64 = (ecx & (1u << 1)) != 0;
397 + align64 = (ecx & ESA_FEATURE_ALIGN64_MASK) != 0;
398 if (size == 0) {
399 error_report("xsave component %zu: size unknown to both "
400 "guest and host CPUID", i);
@@ -530,7 +530,7 @@ int compact_xsave_area(CPUX86State *env, void *buf, size_t buflen)
530 host_cpuid(0xD, i, &eax, &ebx, &ecx, &edx);
531 size = eax;
532 src_off = ebx;
533 - align64 = (ecx >> 1) & 1;
533 + align64 = (ecx & ESA_FEATURE_ALIGN64_MASK) != 0;
534
535 if (size == 0) {
536 /* Component in host xcr0 but unknown - shouldn't happen */