Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 8174/1: Use global stack register variable for percpu

Using global current_stack_pointer works on both clang and gcc.
current_stack_pointer is an unsigned long and needs to be cast
as a pointer to dereference.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Mark Charlebois and committed by
Russell King
ccbd2da5 f6c9cbf0

+2 -2
+2 -2
arch/arm/include/asm/percpu.h
··· 30 30 static inline unsigned long __my_cpu_offset(void) 31 31 { 32 32 unsigned long off; 33 - register unsigned long *sp asm ("sp"); 34 33 35 34 /* 36 35 * Read TPIDRPRW. 37 36 * We want to allow caching the value, so avoid using volatile and 38 37 * instead use a fake stack read to hazard against barrier(). 39 38 */ 40 - asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : "Q" (*sp)); 39 + asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) 40 + : "Q" (*(const unsigned long *)current_stack_pointer)); 41 41 42 42 return off; 43 43 }