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) {
if (cpuid->entries[i].function == function &&
cpuid->entries[i].index == index) {
struct kvm_cpuid_entry2 *entry = &cpuid->entries[i];
found = true;
switch (reg) {
case R_EAX:
ret = cpuid->entries[i].eax;
ret = entry->eax;
break;
case R_EBX:
ret = cpuid->entries[i].ebx;
ret = entry->ebx;
break;
case R_ECX:
ret = cpuid->entries[i].ecx;
ret = entry->ecx;
break;
case R_EDX:
ret = cpuid->entries[i].edx;
ret = entry->edx;
break;
}
}