On Sat, Apr 16, 2011 at 01:03:13AM +0200, Richard Weinberger wrote:
> In some cases gcc-4.6 will optimize away current_thread_info().
> To prevent gcc from doing so the stack address has to be obtained
> via inline asm.
> 
> LKML-Reference: http://marc.info/?i=201104132150.05623.rich...@nod.at
> 
> Signed-off-by: Richard Weinberger <rich...@nod.at>

Acked-by: Kirill A. Shutemov <kir...@shutemov.name>

Also reproducible with gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4).

> ---
>  arch/um/include/asm/thread_info.h |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/um/include/asm/thread_info.h 
> b/arch/um/include/asm/thread_info.h
> index e2cf786..5bd1bad 100644
> --- a/arch/um/include/asm/thread_info.h
> +++ b/arch/um/include/asm/thread_info.h
> @@ -49,7 +49,10 @@ static inline struct thread_info *current_thread_info(void)
>  {
>       struct thread_info *ti;
>       unsigned long mask = THREAD_SIZE - 1;
> -     ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
> +     void *p;
> +
> +     asm volatile ("" : "=r" (p) : "0" (&ti));
> +     ti = (struct thread_info *) (((unsigned long)p) & ~mask);
>       return ti;
>  }
>  
> -- 
> 1.6.6.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
 Kirill A. Shutemov

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to