diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2014-04-30 13:48:33 -0300 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-06-25 18:04:15 +0200 |
commit | a42d9938a162c3e3c9e441d1927dca5bd59167d9 (patch) | |
tree | 2a4eaa3204d32b1291183fc924111caa75a90286 /target-i386 | |
parent | 27418adf32b9cd164d464fffc4fc0505d6b2b15d (diff) |
target-i386: Make TCG feature filtering more readable
Instead of an #ifdef in the middle of the code, just set
TCG_EXT2_FEATURES to a different value depending on TARGET_X86_64.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/cpu.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 5e12556aa6..27666c7749 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -572,9 +572,17 @@ struct X86CPUDefinition { CPUID_EXT_X2APIC, CPUID_EXT_TSC_DEADLINE_TIMER, CPUID_EXT_XSAVE, CPUID_EXT_OSXSAVE, CPUID_EXT_AVX, CPUID_EXT_F16C, CPUID_EXT_RDRAND */ + +#ifdef TARGET_X86_64 +#define TCG_EXT2_X86_64_FEATURES (CPUID_EXT2_SYSCALL | CPUID_EXT2_LM) +#else +#define TCG_EXT2_X86_64_FEATURES 0 +#endif + #define TCG_EXT2_FEATURES ((TCG_FEATURES & CPUID_EXT2_AMD_ALIASES) | \ CPUID_EXT2_NX | CPUID_EXT2_MMXEXT | CPUID_EXT2_RDTSCP | \ - CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_PDPE1GB) + CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT | CPUID_EXT2_PDPE1GB | \ + TCG_EXT2_X86_64_FEATURES) #define TCG_EXT3_FEATURES (CPUID_EXT3_LAHF_LM | CPUID_EXT3_SVM | \ CPUID_EXT3_CR8LEG | CPUID_EXT3_ABM | CPUID_EXT3_SSE4A) #define TCG_SVM_FEATURES 0 @@ -2594,11 +2602,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) if (!kvm_enabled()) { env->features[FEAT_1_EDX] &= TCG_FEATURES; env->features[FEAT_1_ECX] &= TCG_EXT_FEATURES; - env->features[FEAT_8000_0001_EDX] &= (TCG_EXT2_FEATURES -#ifdef TARGET_X86_64 - | CPUID_EXT2_SYSCALL | CPUID_EXT2_LM -#endif - ); + env->features[FEAT_8000_0001_EDX] &= TCG_EXT2_FEATURES; env->features[FEAT_8000_0001_ECX] &= TCG_EXT3_FEATURES; env->features[FEAT_SVM] &= TCG_SVM_FEATURES; } else { |