qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/5] target-i386: Use X86CPU on cpu_x86_cpuid()


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 5/5] target-i386: Use X86CPU on cpu_x86_cpuid()
Date: Fri, 24 Apr 2015 15:30:09 -0300

Signed-off-by: Eduardo Habkost <address@hidden>
---
 target-i386/cpu.c         |  4 ++--
 target-i386/cpu.h         |  2 +-
 target-i386/kvm.c         | 20 ++++++++++----------
 target-i386/misc_helper.c |  3 ++-
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3305e09..cee7054 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2233,11 +2233,11 @@ void x86_cpudef_setup(void)
     }
 }
 
-void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
+void cpu_x86_cpuid(X86CPU *cpu, uint32_t index, uint32_t count,
                    uint32_t *eax, uint32_t *ebx,
                    uint32_t *ecx, uint32_t *edx)
 {
-    X86CPU *cpu = x86_env_get_cpu(env);
+    CPUX86State *env = &cpu->env;
     CPUState *cs = CPU(cpu);
 
     /* test if maximum index reached */
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 3c2055f..19c71ac 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1093,7 +1093,7 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 
 /* cpuid.c */
-void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
+void cpu_x86_cpuid(X86CPU *cpu, uint32_t index, uint32_t count,
                    uint32_t *eax, uint32_t *ebx,
                    uint32_t *ecx, uint32_t *edx);
 void cpu_clear_apic_feature(CPUX86State *env);
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 50b2978..a4cb7e3 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -553,7 +553,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         has_msr_kvm_steal_time = c->eax & (1 << KVM_FEATURE_STEAL_TIME);
     }
 
-    cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
+    cpu_x86_cpuid(cpu, 0, 0, &limit, &unused, &unused, &unused);
 
     for (i = 0; i <= limit; i++) {
         if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -570,7 +570,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             c->function = i;
             c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC |
                        KVM_CPUID_FLAG_STATE_READ_NEXT;
-            cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+            cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
             times = c->eax & 0xff;
 
             for (j = 1; j < times; ++j) {
@@ -582,7 +582,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
                 c = &cpuid_data.entries[cpuid_i++];
                 c->function = i;
                 c->flags = KVM_CPUID_FLAG_STATEFUL_FUNC;
-                cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+                cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
             }
             break;
         }
@@ -596,7 +596,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
                 c->function = i;
                 c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
                 c->index = j;
-                cpu_x86_cpuid(env, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);
+                cpu_x86_cpuid(cpu, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);
 
                 if (i == 4 && c->eax == 0) {
                     break;
@@ -618,7 +618,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         default:
             c->function = i;
             c->flags = 0;
-            cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+            cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
             break;
         }
     }
@@ -626,7 +626,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
     if (limit >= 0x0a) {
         uint32_t ver;
 
-        cpu_x86_cpuid(env, 0x0a, 0, &ver, &unused, &unused, &unused);
+        cpu_x86_cpuid(cpu, 0x0a, 0, &ver, &unused, &unused, &unused);
         if ((ver & 0xff) > 0) {
             has_msr_architectural_pmu = true;
             num_architectural_pmu_counters = (ver & 0xff00) >> 8;
@@ -641,7 +641,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
         }
     }
 
-    cpu_x86_cpuid(env, 0x80000000, 0, &limit, &unused, &unused, &unused);
+    cpu_x86_cpuid(cpu, 0x80000000, 0, &limit, &unused, &unused, &unused);
 
     for (i = 0x80000000; i <= limit; i++) {
         if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -652,12 +652,12 @@ int kvm_arch_init_vcpu(CPUState *cs)
 
         c->function = i;
         c->flags = 0;
-        cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+        cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
     }
 
     /* Call Centaur's CPUID instructions they are supported. */
     if (env->cpuid_xlevel2 > 0) {
-        cpu_x86_cpuid(env, 0xC0000000, 0, &limit, &unused, &unused, &unused);
+        cpu_x86_cpuid(cpu, 0xC0000000, 0, &limit, &unused, &unused, &unused);
 
         for (i = 0xC0000000; i <= limit; i++) {
             if (cpuid_i == KVM_MAX_CPUID_ENTRIES) {
@@ -668,7 +668,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
 
             c->function = i;
             c->flags = 0;
-            cpu_x86_cpuid(env, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
+            cpu_x86_cpuid(cpu, i, 0, &c->eax, &c->ebx, &c->ecx, &c->edx);
         }
     }
 
diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c
index 4aaf1e4..0f96c38 100644
--- a/target-i386/misc_helper.c
+++ b/target-i386/misc_helper.c
@@ -77,7 +77,8 @@ void helper_cpuid(CPUX86State *env)
 
     cpu_svm_check_intercept_param(env, SVM_EXIT_CPUID, 0);
 
-    cpu_x86_cpuid(env, (uint32_t)env->regs[R_EAX], (uint32_t)env->regs[R_ECX],
+    cpu_x86_cpuid(x86_env_get_cpu(env),
+                  (uint32_t)env->regs[R_EAX], (uint32_t)env->regs[R_ECX],
                   &eax, &ebx, &ecx, &edx);
     env->regs[R_EAX] = eax;
     env->regs[R_EBX] = ebx;
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]