Subject: Re: [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info

From: Scott Wood <[email-masked]>
Date: Wed, 7 Jan 2015 11:59:21 -0600

On Wed, 2015-01-07 at 16:12 +1100, Anton Blanchard wrote:
> Thanks for looking into this. Does that mean we were just getting lucky
> with the previous version:
> 
> static inline struct thread_info *current_thread_info(void)
> {
>         register unsigned long sp asm("r1");
> 
>         return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
> }
>  
> ie a static register asm instead of a global one. If so the safest fix
> for now might be to just eat the overead of a register move:
> 
> static inline struct thread_info *current_thread_info(void)
> {
>         unsigned long sp;
> 
>         asm("mr %0,1": "=r"(sp));
>         return (struct thread_info *)(sp & ~(THREAD_SIZE-1));

You could avoid the register move by doing a rlwinm/rldicr in inline
asm, if it matters enough.

-Scott