From: Richard Weinberger <richard@nod.at>
To: linux-kernel@vger.kernel.org
Cc: user-mode-linux-devel@lists.sourceforge.net,
Richard Weinberger <richard@nod.at>
Subject: [PATCH] um: Adjust current_thread_info() for gcc-4.6
Date: Sat, 16 Apr 2011 01:03:13 +0200 [thread overview]
Message-ID: <1302908593-4374-1-git-send-email-richard@nod.at> (raw)
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.richard@nod.at
Signed-off-by: Richard Weinberger <richard@nod.at>
---
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
next reply other threads:[~2011-04-15 23:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-15 23:03 Richard Weinberger [this message]
2011-04-22 0:10 ` [PATCH] um: Adjust current_thread_info() for gcc-4.6 Kirill A. Shutemov
2011-04-22 9:58 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1302908593-4374-1-git-send-email-richard@nod.at \
--to=richard@nod.at \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).