Skip to content

Commit 534e3ad

Browse files
richardweinbergertorvalds
authored andcommitted
um: adjust current_thread_info() for newer gcc versions
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]>
1 parent 365a0de commit 534e3ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/um/include/asm/thread_info.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ static inline struct thread_info *current_thread_info(void)
4949
{
5050
struct thread_info *ti;
5151
unsigned long mask = THREAD_SIZE - 1;
52-
ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
52+
void *p;
53+
54+
asm volatile ("" : "=r" (p) : "0" (&ti));
55+
ti = (struct thread_info *) (((unsigned long)p) & ~mask);
5356
return ti;
5457
}
5558

0 commit comments

Comments
 (0)