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-unstable] xen/libxc: Clean up pv_cpuid switch state

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xen/libxc: Clean up pv_cpuid switch statements.
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sun, 17 Jul 2011 12:55:12 +0100
Delivery-date: Sun, 17 Jul 2011 04:56:05 -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 1310803786 -3600
# Node ID 7effe4eacf2139d4a3c86afd25d59c9cb8a82aeb
# Parent  867bb675b57b54e81013b2f2aa2665fb0e882af8
xen/libxc: Clean up pv_cpuid switch statements.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 867bb675b57b -r 7effe4eacf21 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c        Sat Jul 16 09:05:45 2011 +0100
+++ b/tools/libxc/xc_cpuid_x86.c        Sat Jul 16 09:09:46 2011 +0100
@@ -438,7 +438,7 @@
     do_domctl(xch, &domctl);
     xfeature_mask = domctl.u.vcpuextstate.xfeature_mask;
 
-    if ( (input[0] & 0x7fffffff) == 1 )
+    if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
         clear_bit(X86_FEATURE_VME, regs[3]);
         clear_bit(X86_FEATURE_PSE, regs[3]);
@@ -451,7 +451,7 @@
 
     switch ( input[0] )
     {
-    case 1:
+    case 0x00000001:
         if ( !xen_64bit || strstr(brand, "AMD") )
             clear_bit(X86_FEATURE_SEP, regs[3]);
         clear_bit(X86_FEATURE_DS, regs[3]);
@@ -478,7 +478,7 @@
         set_bit(X86_FEATURE_HYPERVISOR, regs[2]);
         break;
 
-    case 7:
+    case 0x00000007:
         if ( input[1] == 0 )
             regs[1] &= (bitmaskof(X86_FEATURE_FSGSBASE) |
                         bitmaskof(X86_FEATURE_ERMS));
@@ -516,8 +516,8 @@
         clear_bit(X86_FEATURE_TOPOEXT, regs[2]);
         break;
 
-    case 5: /* MONITOR/MWAIT */
-    case 0xa: /* Architectural Performance Monitor Features */
+    case 0x00000005: /* MONITOR/MWAIT */
+    case 0x0000000a: /* Architectural Performance Monitor Features */
     case 0x0000000b: /* Extended Topology Enumeration */
     case 0x8000000a: /* SVM revision and features */
     case 0x8000001b: /* Instruction Based Sampling */
diff -r 867bb675b57b -r 7effe4eacf21 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Sat Jul 16 09:05:45 2011 +0100
+++ b/xen/arch/x86/traps.c      Sat Jul 16 09:09:46 2011 +0100
@@ -777,7 +777,7 @@
         : "=a" (a), "=b" (b), "=c" (c), "=d" (d)
         : "0" (a), "1" (b), "2" (c), "3" (d) );
 
-    if ( (regs->eax & 0x7fffffff) == 1 )
+    if ( (regs->eax & 0x7fffffff) == 0x00000001 )
     {
         /* Modify Feature Information. */
         __clear_bit(X86_FEATURE_VME, &d);
@@ -787,9 +787,10 @@
         __clear_bit(X86_FEATURE_PGE, &d);
         __clear_bit(X86_FEATURE_PSE36, &d);
     }
+
     switch ( (uint32_t)regs->eax )
     {
-    case 1:
+    case 0x00000001:
         /* Modify Feature Information. */
         if ( !cpu_has_sep )
             __clear_bit(X86_FEATURE_SEP, &d);
@@ -821,7 +822,8 @@
            __clear_bit(X86_FEATURE_X2APIC % 32, &c);
         __set_bit(X86_FEATURE_HYPERVISOR % 32, &c);
         break;
-    case 7:
+
+    case 0x00000007:
         if ( regs->ecx == 0 )
             b &= (cpufeat_mask(X86_FEATURE_FSGSBASE) |
                   cpufeat_mask(X86_FEATURE_ERMS));
@@ -829,6 +831,12 @@
             b = 0;
         a = c = d = 0;
         break;
+
+    case 0x0000000d: /* XSAVE */
+        if ( !xsave_enabled(current) )
+            goto unsupported;
+        break;
+
     case 0x80000001:
         /* Modify Feature Information. */
         if ( is_pv_32bit_vcpu(current) )
@@ -855,19 +863,18 @@
         __clear_bit(X86_FEATURE_NODEID_MSR % 32, &c);
         __clear_bit(X86_FEATURE_TOPOEXT % 32, &c);
         break;
-    case 0xd: /* XSAVE */
-        if ( xsave_enabled(current) )
-            break;
-        /* fall through */
-    case 5: /* MONITOR/MWAIT */
-    case 0xa: /* Architectural Performance Monitor Features */
+
+    case 0x00000005: /* MONITOR/MWAIT */
+    case 0x0000000a: /* Architectural Performance Monitor Features */
     case 0x0000000b: /* Extended Topology Enumeration */
     case 0x8000000a: /* SVM revision and features */
     case 0x8000001b: /* Instruction Based Sampling */
     case 0x8000001c: /* Light Weight Profiling */
     case 0x8000001e: /* Extended topology reporting */
+    unsupported:
         a = b = c = d = 0;
         break;
+
     default:
         (void)cpuid_hypervisor_leaves(regs->eax, 0, &a, &b, &c, &d);
         break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xen/libxc: Clean up pv_cpuid switch statements., Xen patchbot-unstable <=