[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/7] target-i386: Eliminate unnecessary get_cpuid_ven
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 3/7] target-i386: Eliminate unnecessary get_cpuid_vendor() function |
Date: |
Mon, 9 Mar 2015 17:40:47 -0300 |
The function was used in only two places. In one of them, the function
made the code less readable by requiring temporary te[bcd]x variables.
In the other one we can simply inline the existing code.
Reviewed-by: Andreas Färber <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/cpu.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 80e9b9d..2f3a450 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2213,14 +2213,6 @@ void x86_cpudef_setup(void)
}
}
-static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx,
- uint32_t *ecx, uint32_t *edx)
-{
- *ebx = env->cpuid_vendor1;
- *edx = env->cpuid_vendor2;
- *ecx = env->cpuid_vendor3;
-}
-
void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx)
@@ -2254,7 +2246,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
switch(index) {
case 0:
*eax = env->cpuid_level;
- get_cpuid_vendor(env, ebx, ecx, edx);
+ *ebx = env->cpuid_vendor1;
+ *edx = env->cpuid_vendor2;
+ *ecx = env->cpuid_vendor3;
break;
case 1:
*eax = env->cpuid_version;
@@ -2447,11 +2441,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
* So dont set it here for Intel to make Linux guests happy.
*/
if (cs->nr_cores * cs->nr_threads > 1) {
- uint32_t tebx, tecx, tedx;
- get_cpuid_vendor(env, &tebx, &tecx, &tedx);
- if (tebx != CPUID_VENDOR_INTEL_1 ||
- tedx != CPUID_VENDOR_INTEL_2 ||
- tecx != CPUID_VENDOR_INTEL_3) {
+ if (env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1 ||
+ env->cpuid_vendor2 != CPUID_VENDOR_INTEL_2 ||
+ env->cpuid_vendor3 != CPUID_VENDOR_INTEL_3) {
*ecx |= 1 << 1; /* CmpLegacy bit */
}
}
--
2.1.0
- [Qemu-devel] [PULL 0/7] X86 patches, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 2/7] target-i386: Simplify listflags() function, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 1/7] target-i386: Move topology.h to include/hw/i386, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 3/7] target-i386: Eliminate unnecessary get_cpuid_vendor() function,
Eduardo Habkost <=
- [Qemu-devel] [PULL 4/7] target-i386: Remove unused APIC ID default code, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 5/7] target-i386: Move CPUX86State::cpuid_apic_id to X86CPU::apic_id, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 6/7] target-i386: Move APIC ID compatibility code to pc.c, Eduardo Habkost, 2015/03/09
- [Qemu-devel] [PULL 7/7] target-i386: Require APIC ID to be explicitly set before CPU realize, Eduardo Habkost, 2015/03/09
- Re: [Qemu-devel] [PULL 0/7] X86 patches, Peter Maydell, 2015/03/10
- Re: [Qemu-devel] [PULL 0/7] X86 patches, Eduardo Habkost, 2015/03/10