[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Patch] Fix up Xsave in pv_cpuid()



Hi, Keir,

This patch will fix wrong logic in determining Xsave return value in pv_cpuid().
I am sorry I made some mistakes in my last patch.

Signed-off-by:  Shan Haitao <haitao.shan@xxxxxxxxx>


diff -r 2dab09bcec81 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Sun Sep 18 00:25:57 2011 +0100
+++ b/xen/arch/x86/traps.c      Sat Oct 08 04:24:40 2011 +0800
@@ -768,16 +768,18 @@ static void pv_cpuid(struct cpu_user_reg

     if ( current->domain->domain_id != 0 )
     {
+        unsigned int cpuid_leaf = a, sub_leaf = c;
+
         if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
             domain_cpuid(current->domain, a, c, &a, &b, &c, &d);

-        switch ( a )
+        switch ( cpuid_leaf )
         {
         case 0xd:
         {
-            unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+            unsigned int _eax, _ebx, _ecx, _edx;
             /* EBX value of main leaf 0 depends on enabled xsave features */
-            if ( c == 0 && current->arch.xcr0 )
+            if ( sub_leaf == 0 && current->arch.xcr0 )
             {
                 /* reset EBX to default value first */
                 b = XSTATE_AREA_MIN_SIZE;
@@ -785,8 +787,8 @@ static void pv_cpuid(struct cpu_user_reg
                 {
                     if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
                         continue;
-                    domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
-                                 &_edx);
+                    domain_cpuid(current->domain, cpuid_leaf, sub_leaf,
+                                 &_eax, &_ebx, &_ecx, &_edx);
                     if ( (_eax + _ebx) > b )
                         b = _eax + _ebx;
                 }

Attachment: pv_cpuid_xsave_fix.patch
Description: Binary data

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.