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

[Xen-changelog] [xen master] x86: fix get_cpu_info() when built with clang



commit c26b88bf644011396b4e4f6f15901a66b87d8c19
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Feb 10 14:51:25 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 10 14:51:25 2016 +0100

    x86: fix get_cpu_info() when built with clang
    
    Clang understands the GCCism in use here, but still complains that sp is
    unintialised.  In such cases, resort to the older version of this code, 
which
    directly reads %rsp into the temporary variable.
    
    Note that we still keep the GCCism in the default case, as it causes GCC to
    create rather better assembly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/asm-x86/current.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h
index f011d2d..15b99ff 100644
--- a/xen/include/asm-x86/current.h
+++ b/xen/include/asm-x86/current.h
@@ -47,7 +47,13 @@ struct cpu_info {
 
 static inline struct cpu_info *get_cpu_info(void)
 {
+#ifdef __clang__
+    /* Clang complains that sp in the else case is not initialised. */
+    unsigned long sp;
+    asm ( "mov %%rsp, %0" : "=r" (sp) );
+#else
     register unsigned long sp asm("rsp");
+#endif
 
     return (struct cpu_info *)((sp & ~(STACK_SIZE-1)) + STACK_SIZE) - 1;
 }
--
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®.