This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-1.1 status
- To: Andi Kleen <ak at muc dot de>
- Subject: Re: egcs-1.1 status
- From: Linus Torvalds <torvalds at transmeta dot com>
- Date: Sun, 23 Aug 1998 10:46:26 -0700 (PDT)
- cc: law at cygnus dot com, "H.J. Lu" <hjl at lucon dot org>, manfred at s-direktnet dot de, Manfred dot Hollstein at ks dot sel dot alcatel dot de, egcs at cygnus dot com
On Sun, 23 Aug 1998, Andi Kleen wrote:
>
> How about something like
>
> register void *arga asm("eax");
> register void *argb asm("ebx");
>
> void switch_to(void)
> {
> /* use arga and argb */
> }
>
> Could this work?
I doubt you really don't want to use register globals - it has other side
effects, and especially with %eax/%edx being so special on intel the above
is unlikely to work.
Note that as far as I can tell, the only problems reload has is on the
_calling_ side of a function - not on the function side itself (I think
that this one particular version of egcs had a problem that was completely
unrelated to the normal register allocation issue - losing the attribute
information for some reason).
As such, I suspect that __switch_to() is actually really safe as far as
gcc is concerned, as __switch_to is never called from C code at all, so
there is never any calling sequence that gcc sees in the first place. The
only calling sequence is in an assembly wrapper, and as such this is
pretty much guarateed to work.
So I don't think we need to worry about switch_to. If that ever breaks, it
breaks very obviously indeed (as shown by this one case), and even with a
silent compiler failure it certainly won't be a case of a kernel that
almost works - the result will decidedly not work at all if gcc gets that
function wrong. And complete non-functionality is better than random
corruption.
There are some other cases where Linux uses "regparm", one being
"__get_free_pages()" that takes two (predominantly constant) arguments and
is called from various places. The other one is __wake_up().
Linus