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

[Xen-changelog] [xen master] tools/libxc: Correct use of X86_XSS_MASK in guest xstate generation



commit 4e4689e74d012b737bbca820cfe52c689c7d9cef
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Apr 19 18:27:05 2016 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed Apr 20 14:48:23 2016 +0100

    tools/libxc: Correct use of X86_XSS_MASK in guest xstate generation
    
    c/s 75f9455e "tools/libxc: Calculate xstate cpuid leaf from guest 
information"
    incorrectly inverted the shift and mask when using X86_XSS_MASK.  Luckily, 
the
    mask is currently zero, avoiding incorrect calculations.
    
    While adjusting this, use an explcit uint32_t cast rather than masking 
against
    0xffffffff.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_cpuid_x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 6d14904..84f4e08 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -460,7 +460,7 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
     {
     case 0:
         /* EAX: low 32bits of xfeature_enabled_mask */
-        regs[0] = guest_xfeature_mask & 0xFFFFFFFF;
+        regs[0] = (uint32_t)guest_xfeature_mask;
         /* EDX: high 32bits of xfeature_enabled_mask */
         regs[3] = guest_xfeature_mask >> 32;
         /* ECX: max size required by all HW features */
@@ -487,8 +487,8 @@ static void xc_cpuid_config_xsave(xc_interface *xch,
 
         if ( test_bit(X86_FEATURE_XSAVES, info->featureset) )
         {
-            regs[2] = guest_xfeature_mask & X86_XSS_MASK & 0xFFFFFFFF;
-            regs[3] = (guest_xfeature_mask >> 32) & X86_XSS_MASK;
+            regs[2] = (uint32_t)(guest_xfeature_mask & X86_XSS_MASK);
+            regs[3] = (guest_xfeature_mask & X86_XSS_MASK) >> 32;
         }
         else
             regs[2] = regs[3] = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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