target-i386: xsave: Simplify CPUID[0xD,0].{EAX,EDX} calculation

Instead of assigning individual bits in a loop, just copy the
values from ena_mask.

Backports commit 8057c621b1b17cbcb35fe67d1a09ada9055873a9 from qemu
This commit is contained in:
Eduardo Habkost 2018-02-26 04:35:11 -05:00 committed by Lioncash
parent c7195afd32
commit c35e9eb9af
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -2550,15 +2550,11 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
for (i = 2; i < ARRAY_SIZE(x86_ext_save_areas); i++) {
const ExtSaveArea *esa = &x86_ext_save_areas[i];
if ((ena_mask >> i) & 1) {
if (i < 32) {
*eax |= 1u << i;
} else {
*edx |= 1u << (i - 32);
}
*ecx = MAX(*ecx, esa->offset + esa->size);
}
}
*eax |= ena_mask & (XSTATE_FP_MASK | XSTATE_SSE_MASK);
*eax = ena_mask;
*edx = ena_mask >> 32;
*ebx = *ecx;
} else if (count == 1) {
*eax = env->features[FEAT_XSAVE];