[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86: Replace ad-hoc bitmaskof() macro with single cpufeat_mask() defn.
# HG changeset patch # User Keir Fraser <keir@xxxxxxx> # Date 1307021674 -3600 # Node ID c72869c8ae02deaba538cb78efff04ace1455918 # Parent 221f431092c04df90ed017f7471ce9641356d40d x86: Replace ad-hoc bitmaskof() macro with single cpufeat_mask() defn. Signed-off-by: Keir Fraser <keir@xxxxxxx> --- diff -r 221f431092c0 -r c72869c8ae02 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Wed Jun 01 16:50:16 2011 +0100 +++ b/xen/arch/x86/hvm/hvm.c Thu Jun 02 14:34:34 2011 +0100 @@ -2380,7 +2380,6 @@ return rc ? len : 0; /* fake a copy_from_user() return code */ } -#define bitmaskof(idx) (1U << ((idx) & 31)) void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { @@ -2407,7 +2406,7 @@ /* Fix up OSXSAVE. */ if ( xsave_enabled(v) ) *ecx |= (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_OSXSAVE) ? - bitmaskof(X86_FEATURE_OSXSAVE) : 0; + cpufeat_mask(X86_FEATURE_OSXSAVE) : 0; break; case 0xb: /* Fix the x2APIC identifier. */ @@ -2438,7 +2437,7 @@ tsc_mode == TSC_MODE_DEFAULT and host_tsc_is_safe() returns 1 */ if ( v->domain->arch.tsc_mode != TSC_MODE_DEFAULT || !host_tsc_is_safe() ) - *edx &= ~bitmaskof(X86_FEATURE_RDTSCP); + *edx &= ~cpufeat_mask(X86_FEATURE_RDTSCP); break; } } @@ -2467,7 +2466,7 @@ fixed_range_base = (uint64_t *)v->arch.hvm_vcpu.mtrr.fixed_ranges; hvm_cpuid(1, &cpuid[0], &cpuid[1], &cpuid[2], &cpuid[3]); - mtrr = !!(cpuid[3] & bitmaskof(X86_FEATURE_MTRR)); + mtrr = !!(cpuid[3] & cpufeat_mask(X86_FEATURE_MTRR)); switch ( msr ) { @@ -2579,7 +2578,7 @@ (uint32_t)msr_content, (uint32_t)(msr_content >> 32)); hvm_cpuid(1, &cpuid[0], &cpuid[1], &cpuid[2], &cpuid[3]); - mtrr = !!(cpuid[3] & bitmaskof(X86_FEATURE_MTRR)); + mtrr = !!(cpuid[3] & cpufeat_mask(X86_FEATURE_MTRR)); switch ( msr ) { diff -r 221f431092c0 -r c72869c8ae02 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Wed Jun 01 16:50:16 2011 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Thu Jun 02 14:34:34 2011 +0100 @@ -1190,7 +1190,6 @@ vmcb_set_cr0(vmcb, vmcb_get_cr0(vmcb) & ~X86_CR0_TS); } -#define bitmaskof(idx) (1U << ((idx) & 31)) static void svm_cpuid_intercept( unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) diff -r 221f431092c0 -r c72869c8ae02 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Wed Jun 01 16:50:16 2011 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Jun 02 14:34:34 2011 +0100 @@ -1487,7 +1487,6 @@ } } -#define bitmaskof(idx) (1U << ((idx) & 31)) static void vmx_cpuid_intercept( unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) @@ -1504,9 +1503,9 @@ /* SYSCALL is visible iff running in long mode. */ hvm_get_segment_register(v, x86_seg_cs, &cs); if ( cs.attr.fields.l ) - *edx |= bitmaskof(X86_FEATURE_SYSCALL); + *edx |= cpufeat_mask(X86_FEATURE_SYSCALL); else - *edx &= ~(bitmaskof(X86_FEATURE_SYSCALL)); + *edx &= ~(cpufeat_mask(X86_FEATURE_SYSCALL)); break; } diff -r 221f431092c0 -r c72869c8ae02 xen/include/asm-x86/cpufeature.h --- a/xen/include/asm-x86/cpufeature.h Wed Jun 01 16:50:16 2011 +0100 +++ b/xen/include/asm-x86/cpufeature.h Thu Jun 02 14:34:34 2011 +0100 @@ -146,6 +146,7 @@ #define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) +#define cpufeat_mask(idx) (1u << ((idx) & 31)) #ifdef __i386__ #define cpu_has_vme boot_cpu_has(X86_FEATURE_VME) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |