Subject: Re: power and percpu: Could we move the paca into the percpu area?

From: Segher Boessenkool <[email-masked]>
Date: Fri, 13 Jun 2014 09:16:16 -0500

> > > So cr5, which is number 73, is never used by gcc. 
> > 
> > Not available for RA is not the same thing at all as not used by GCC.
> > For example, GPR1 and XER[CA] are also fixed regs.
> 
> Indeed, I should have been more clear, it is never explicitly reserved
> by any ABI like GPR1 for the stack pointer nor used implicitly by any pattern
> like the carry (which is also never allocated, but used or clobbered
> by many patterns). However no machine description pattern uses cr5.
> 
> The line "cr5 is not supposed to be used" has always been a mystery
> to me, but gcc has always obeyed this rule. If memory serves it has 
> been in rs6000.h since I got my first PPC board in 1997.

It's been there (in the public repo) since 1992.  The copyrights for
some  of the rest of the port go back to 1990, so the code has most
likely existed at least that far back.

> > But, indeed, it does look like GCC doesn't use it.  It seems to me that
> > some ABI forbade userland (or non-libraries or whatever) from using it.
> > I'll see what I can find out.
> 
> Take what I say with a grain of salt, but I always had the impression that
> it was a remnant from the first port of GCC to Power, which could well have 
> been AIX. This first port might have been done by Richard Kenner.

That is all correct as far as I can see.

Presumably the AIX ABI at that time (AIX2? AIX3?) had cr5 reserved.

Still digging...

Segher