i386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable

The reg switch will be moved to a separate function, so store the entry
pointer in a variable.

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Eduardo Habkost 2012-10-04 17:48:55 -03:00 committed by Marcelo Tosatti
parent 8c723b7958
commit 47111e2cfa
1 changed files with 5 additions and 4 deletions

View File

@ -140,19 +140,20 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
for (i = 0; i < cpuid->nent; ++i) { for (i = 0; i < cpuid->nent; ++i) {
if (cpuid->entries[i].function == function && if (cpuid->entries[i].function == function &&
cpuid->entries[i].index == index) { cpuid->entries[i].index == index) {
struct kvm_cpuid_entry2 *entry = &cpuid->entries[i];
found = true; found = true;
switch (reg) { switch (reg) {
case R_EAX: case R_EAX:
ret = cpuid->entries[i].eax; ret = entry->eax;
break; break;
case R_EBX: case R_EBX:
ret = cpuid->entries[i].ebx; ret = entry->ebx;
break; break;
case R_ECX: case R_ECX:
ret = cpuid->entries[i].ecx; ret = entry->ecx;
break; break;
case R_EDX: case R_EDX:
ret = cpuid->entries[i].edx; ret = entry->edx;
break; break;
} }
} }