summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2017-07-12 13:20:56 -0300
committerEduardo Habkost <ehabkost@redhat.com>2017-07-26 14:55:12 -0300
commitbfef624895673866b4beb1757725a565c7048c1f (patch)
tree2df5815747b8d431e9935f12d822bcc67a629142
parent522fd24ca030c27c591dafedd65c1dfd51e40450 (diff)
downloadfocaccia-qemu-bfef624895673866b4beb1757725a565c7048c1f.tar.gz
focaccia-qemu-bfef624895673866b4beb1757725a565c7048c1f.zip
target/i386: Use host_vendor_fms() in max_x86_cpu_initfn()
The existing code duplicated the logic in host_vendor_fms(), so
reuse the helper function instead.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170712162058.10538-3-ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--target/i386/cpu.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 89f5fb7a3f..156dc955d2 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1636,13 +1636,8 @@ static void max_x86_cpu_initfn(Object *obj)
         X86CPUDefinition host_cpudef = { };
         uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
 
-        host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);
-        x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx);
-
-        host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);
-        host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);
-        host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);
-        host_cpudef.stepping = eax & 0x0F;
+        host_vendor_fms(host_cpudef.vendor, &host_cpudef.family,
+                        &host_cpudef.model, &host_cpudef.stepping);
 
         cpu_x86_fill_model_id(host_cpudef.model_id);