* register long sp asm("r1") incorrect
@ 2010-02-09 15:24 Pavel Machek
2010-02-11 5:31 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2010-02-09 15:24 UTC (permalink / raw)
To: benh, paulus, linuxppc-dev, kernel list
...according to gcc docs, sp should be global, or placement in
register is not guaranteed (except at asm boundaries, but there are
none).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: register long sp asm("r1") incorrect 2010-02-09 15:24 register long sp asm("r1") incorrect Pavel Machek @ 2010-02-11 5:31 ` Benjamin Herrenschmidt 2010-02-15 7:34 ` Pavel Machek 0 siblings, 1 reply; 8+ messages in thread From: Benjamin Herrenschmidt @ 2010-02-11 5:31 UTC (permalink / raw) To: Pavel Machek; +Cc: linuxppc-dev, paulus, kernel list On Tue, 2010-02-09 at 16:24 +0100, Pavel Machek wrote: > ...according to gcc docs, sp should be global, or placement in > register is not guaranteed (except at asm boundaries, but there are > none). Sorry I'm not sure I grok what you mean. Cheers, Ben. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-11 5:31 ` Benjamin Herrenschmidt @ 2010-02-15 7:34 ` Pavel Machek 2010-02-15 19:59 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 8+ messages in thread From: Pavel Machek @ 2010-02-15 7:34 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, kernel list > On Tue, 2010-02-09 at 16:24 +0100, Pavel Machek wrote: > > ...according to gcc docs, sp should be global, or placement in > > register is not guaranteed (except at asm boundaries, but there are > > none). > > Sorry I'm not sure I grok what you mean. Well, according to gcc doscs and my experience, local "register int __asm()" variables only work by accident (or not at all). Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-15 7:34 ` Pavel Machek @ 2010-02-15 19:59 ` Benjamin Herrenschmidt 2010-02-15 20:28 ` Pavel Machek 0 siblings, 1 reply; 8+ messages in thread From: Benjamin Herrenschmidt @ 2010-02-15 19:59 UTC (permalink / raw) To: Pavel Machek; +Cc: linuxppc-dev, paulus, kernel list On Mon, 2010-02-15 at 08:34 +0100, Pavel Machek wrote: > > On Tue, 2010-02-09 at 16:24 +0100, Pavel Machek wrote: > > > ...according to gcc docs, sp should be global, or placement in > > > register is not guaranteed (except at asm boundaries, but there > are > > > none). > > > > Sorry I'm not sure I grok what you mean. > > Well, according to gcc doscs and my experience, local "register int > __asm()" variables only work by accident (or not at all). Hrm... we definitely rely on that for our thread_info() access, and so far it has worked well for us, but I'll poke our gcc folks just in case. Cheers, Ben. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-15 19:59 ` Benjamin Herrenschmidt @ 2010-02-15 20:28 ` Pavel Machek 2010-02-15 21:04 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 8+ messages in thread From: Pavel Machek @ 2010-02-15 20:28 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, paulus, kernel list On Tue 2010-02-16 06:59:52, Benjamin Herrenschmidt wrote: > On Mon, 2010-02-15 at 08:34 +0100, Pavel Machek wrote: > > > On Tue, 2010-02-09 at 16:24 +0100, Pavel Machek wrote: > > > > ...according to gcc docs, sp should be global, or placement in > > > > register is not guaranteed (except at asm boundaries, but there > > are > > > > none). > > > > > > Sorry I'm not sure I grok what you mean. > > > > Well, according to gcc doscs and my experience, local "register int > > __asm()" variables only work by accident (or not at all). > > Hrm... we definitely rely on that for our thread_info() access, and so > far it has worked well for us, but I'll poke our gcc folks just in case. Thanks, and let me know about any results. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-15 20:28 ` Pavel Machek @ 2010-02-15 21:04 ` Benjamin Herrenschmidt 2010-02-15 22:15 ` H. Peter Anvin 0 siblings, 1 reply; 8+ messages in thread From: Benjamin Herrenschmidt @ 2010-02-15 21:04 UTC (permalink / raw) To: Pavel Machek; +Cc: linuxppc-dev, paulus, kernel list On Mon, 2010-02-15 at 21:28 +0100, Pavel Machek wrote: > On Tue 2010-02-16 06:59:52, Benjamin Herrenschmidt wrote: > > On Mon, 2010-02-15 at 08:34 +0100, Pavel Machek wrote: > > > > On Tue, 2010-02-09 at 16:24 +0100, Pavel Machek wrote: > > > > > ...according to gcc docs, sp should be global, or placement in > > > > > register is not guaranteed (except at asm boundaries, but there > > > are > > > > > none). > > > > > > > > Sorry I'm not sure I grok what you mean. > > > > > > Well, according to gcc doscs and my experience, local "register int > > > __asm()" variables only work by accident (or not at all). > > > > Hrm... we definitely rely on that for our thread_info() access, and so > > far it has worked well for us, but I'll poke our gcc folks just in case. > > Thanks, and let me know about any results. All the gcc folks I talked to say something along the lines that there is no way in hell it doesn't work :-) It's true that most other use of it we have are global scope (local_paca in r13, glibc use of r2/r13, etc...) afaik, but since r1 itself is the stack pointer always, I think they pretty much guarantee it works. I'm CCing a couple of experts just to be sure. Cheers, Ben. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-15 21:04 ` Benjamin Herrenschmidt @ 2010-02-15 22:15 ` H. Peter Anvin 2010-02-18 22:57 ` Pavel Machek 0 siblings, 1 reply; 8+ messages in thread From: H. Peter Anvin @ 2010-02-15 22:15 UTC (permalink / raw) To: Benjamin Herrenschmidt; +Cc: kernel list, linuxppc-dev, paulus, Pavel Machek On 02/15/2010 01:04 PM, Benjamin Herrenschmidt wrote: > > It's true that most other use of it we have are global scope (local_paca > in r13, glibc use of r2/r13, etc...) afaik, but since r1 itself is the > stack pointer always, I think they pretty much guarantee it works. > It should work, because r1, being the stack pointer, is already marked a reserved register in gcc. The reference Pavel is citing bascially states that gcc won't globally reserve the register, which is true, but it is already reserved anyway. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: register long sp asm("r1") incorrect 2010-02-15 22:15 ` H. Peter Anvin @ 2010-02-18 22:57 ` Pavel Machek 0 siblings, 0 replies; 8+ messages in thread From: Pavel Machek @ 2010-02-18 22:57 UTC (permalink / raw) To: H. Peter Anvin; +Cc: kernel list, linuxppc-dev, paulus On Mon 2010-02-15 14:15:17, H. Peter Anvin wrote: > On 02/15/2010 01:04 PM, Benjamin Herrenschmidt wrote: > > > > It's true that most other use of it we have are global scope (local_paca > > in r13, glibc use of r2/r13, etc...) afaik, but since r1 itself is the > > stack pointer always, I think they pretty much guarantee it works. > > > > It should work, because r1, being the stack pointer, is already marked a > reserved register in gcc. > > The reference Pavel is citing bascially states that gcc won't globally > reserve the register, which is true, but it is already reserved anyway. Ok, thanks for clarification. -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-02-19 19:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 15:24 register long sp asm("r1") incorrect Pavel Machek
2010-02-11 5:31 ` Benjamin Herrenschmidt
2010-02-15 7:34 ` Pavel Machek
2010-02-15 19:59 ` Benjamin Herrenschmidt
2010-02-15 20:28 ` Pavel Machek
2010-02-15 21:04 ` Benjamin Herrenschmidt
2010-02-15 22:15 ` H. Peter Anvin
2010-02-18 22:57 ` Pavel Machek
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).