projects/linux·commit 534e3adb

um: adjust current_thread_info() for newer gcc versions

534e3adb · Richard Weinberger <[email protected]> · 2011-04-27 15:26:54 -07:00

In some cases gcc >= 4.5.2 will optimize away current_thread_info().  To
prevent gcc from doing so the stack address has to be obtained via inline
asm.

Signed-off-by: Richard Weinberger <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
534e3adbd22efa327e6ff27cf2d8ebaad8382ecd
Parents
365a0dea

Changes

1 files changed · +4 −1

FileStatusAddDelContent
arch/um/include/asm/thread_info.hmodified+4−1View file

arch/um/include/asm/thread_info.h

View file
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;
}