Subject: Re: Assembler question
To: Krister Walfridsson <cato@df.lth.se>
From: Urban Boquist <boquist@cs.chalmers.se>
List: port-sparc
Date: 05/19/1997 11:44:37
>>>>> Krister Walfridsson writes:

Krister> registers, and %g2-%g4 seems to be the right choice for our
Krister> Solaris machines (or so my teacher says anyhow...) The
Krister> problem is that NetBSD does nasty things with (at least) %g2
Krister> and %g3...

I have similar experiences. Solaris and NetBSD doesn't use registers
exactly the same.

Krister> ...so does anybody know which registers are safe to use on NetBSD?

Despite the GCC comment appended below, I've been using %g5 and %g7
without problems (yet ;-) on both NetBSD and Solaris/SunOS. But of
course, if you really want to be sure you should always save before
calling out of your own code. Especially if you use setjmp()...

	-- Urban

-------------------------------------------------------------------------------
>From gnu/usr.bin/gcc/arch/sparc/sparc.h, describing FIXED_REGISTERS:

/* 1 for registers that have pervasive standard uses
   and are not available for the register allocator.
   g0 is used for the condition code and not to represent %g0, which is
   hardwired to 0, so reg 0 is *not* fixed.
   On non-v9 systems:
   g1 is free to use as temporary.
   g2-g4 are reserved for applications.  Gcc normally uses them as
   temporaries, but this can be disabled via the -mno-app-regs option.
   g5 through g7 are reserved for the operating system.
   On v9 systems:
   g1 and g5 are free to use as temporaries.
   g2-g4 are reserved for applications (the compiler will not normally use
   them, but they can be used as temporaries with -mapp-regs).
   g6-g7 are reserved for the operating system.
   ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must
   currently be a fixed register until this pattern is rewritten.
   Register 1 is also used when restoring call-preserved registers in large
   stack frames.  */

--
BATF Uzi NORAD Treasury quiche Cocaine cracking assassination [Hello
to all my fans in domestic surveillance] FSF strategic NSA $400
million in gold bullion Ft. Bragg nuclear