aboutsummaryrefslogtreecommitdiffstats
path: root/target-i386/cpuid.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-06-08 16:11:05 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2011-06-20 15:24:00 -0300
commitba9bc59e1f5dc91caf35e0ef08da137b3a5e7386 (patch)
tree3c58ca29d21256503d7a88f05ff2220c6b7e26de /target-i386/cpuid.c
parent4bef75b5333799da5cf5287705250dc562a41307 (diff)
kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid
kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it does not require any CPUState reference. Changing its interface allows to call it before any VCPU is initialized. CC: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'target-i386/cpuid.c')
-rw-r--r--target-i386/cpuid.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index 79e7580c1..e1ae3af1e 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -1144,10 +1144,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
case 7:
if (kvm_enabled()) {
- *eax = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EAX);
- *ebx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EBX);
- *ecx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_ECX);
- *edx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EDX);
+ KVMState *s = env->kvm_state;
+
+ *eax = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EAX);
+ *ebx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EBX);
+ *ecx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_ECX);
+ *edx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EDX);
} else {
*eax = 0;
*ebx = 0;
@@ -1179,10 +1181,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
break;
}
if (kvm_enabled()) {
- *eax = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EAX);
- *ebx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EBX);
- *ecx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_ECX);
- *edx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EDX);
+ KVMState *s = env->kvm_state;
+
+ *eax = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EAX);
+ *ebx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EBX);
+ *ecx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_ECX);
+ *edx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EDX);
} else {
*eax = 0;
*ebx = 0;