Subject: Re: %g registers
To: None <port-sparc@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sparc
Date: 12/01/2002 18:40:38
On Sun, Dec 01, 2002 at 14:35:52 +0100, Michael Rauch wrote:

> > der> Which %g registers can I count on not changing behind my back?
> > It's defined by the Sparc ABI. [...]
> 
> the complete text is in "The SPARC Architecture Manual, Version 8":
> http://www.sparc.com/standards/V8.pdf, Appendix D. 

And the problem is that gcc clobbers app registers.

`-mno-app-regs'
`-mapp-regs'
     Specify `-mapp-regs' to generate output using the global registers
     2 through 4, which the SPARC SVR4 ABI reserves for applications.
     This is the default.
                 ^^^^^^^
     To be fully SVR4 ABI compliant at the cost of some performance
     loss, specify `-mno-app-regs'.  You should compile libraries and
     system software with this option.

And some handwritten assembler routines in libc still use %g2..%g4.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen