WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.1-testing] x86: Replace ad-hoc bitmaskof() macro

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.1-testing] x86: Replace ad-hoc bitmaskof() macro with single cpufeat_mask() defn.
From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
Date: Mon, 13 Jun 2011 16:44:08 +0100
Delivery-date: Mon, 13 Jun 2011 08:44:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1307022182 -3600
# Node ID 30a2fcdf864ec0a259de02816ce39b5903962e4d
# Parent  43acc031eb24945973dffda2b7caf976993bbd5f
x86: Replace ad-hoc bitmaskof() macro with single cpufeat_mask() defn.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   23460:c72869c8ae02
xen-unstable date:        Thu Jun 02 14:34:34 2011 +0100
---


diff -r 43acc031eb24 -r 30a2fcdf864e xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue May 31 14:03:45 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Thu Jun 02 14:43:02 2011 +0100
@@ -2184,7 +2184,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)
 {
@@ -2211,7 +2210,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. */
@@ -2242,7 +2241,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;
     }
 }
@@ -2271,7 +2270,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 )
     {
@@ -2383,7 +2382,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 43acc031eb24 -r 30a2fcdf864e xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue May 31 14:03:45 2011 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Jun 02 14:43:02 2011 +0100
@@ -993,7 +993,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 43acc031eb24 -r 30a2fcdf864e xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue May 31 14:03:45 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Jun 02 14:43:02 2011 +0100
@@ -1479,7 +1479,6 @@
     }
 }
 
-#define bitmaskof(idx)  (1U << ((idx) & 31))
 static void vmx_cpuid_intercept(
     unsigned int *eax, unsigned int *ebx,
     unsigned int *ecx, unsigned int *edx)
@@ -1496,9 +1495,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 43acc031eb24 -r 30a2fcdf864e xen/include/asm-x86/cpufeature.h
--- a/xen/include/asm-x86/cpufeature.h  Tue May 31 14:03:45 2011 +0100
+++ b/xen/include/asm-x86/cpufeature.h  Thu Jun 02 14:43:02 2011 +0100
@@ -145,6 +145,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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.1-testing] x86: Replace ad-hoc bitmaskof() macro with single cpufeat_mask() defn., Xen patchbot-4 . 1-testing <=