arm64: LLVMLinux: Use global stack register variable for aarch64
authorMark Charlebois <charlebm@gmail.com>
Wed, 27 Aug 2014 04:29:33 +0000 (05:29 +0100)
committerWill Deacon <will.deacon@arm.com>
Mon, 8 Sep 2014 13:39:19 +0000 (14:39 +0100)
To support both Clang and GCC, use the global stack register variable vs
a local register variable.

Author: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/percpu.h

index 453a179469a34fd9ffa72ec723a6bada988d4e73..5279e573338690afbee3c7e593858baa9f7b9e42 100644 (file)
@@ -26,13 +26,13 @@ static inline void set_my_cpu_offset(unsigned long off)
 static inline unsigned long __my_cpu_offset(void)
 {
        unsigned long off;
-       register unsigned long *sp asm ("sp");
 
        /*
         * We want to allow caching the value, so avoid using volatile and
         * instead use a fake stack read to hazard against barrier().
         */
-       asm("mrs %0, tpidr_el1" : "=r" (off) : "Q" (*sp));
+       asm("mrs %0, tpidr_el1" : "=r" (off) :
+               "Q" (*(const unsigned long *)current_stack_pointer));
 
        return off;
 }