Subject: %g registers
To: None <port-sparc@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 11/30/2002 20:56:57
Which %g registers can I count on not changing behind my back?

I've written some assembly code that needs lots of registers.  I ran
out of spare registers and started using the %g registers.  But in
tracking down bugs, I discovered that %g1 is being changed behind my
back by *something*.

The only thing the code calls is .mul, and looking at
/usr/src/lib/libc/arch/sparc/gen/mul.S, it looks to me as though it
runs entirely in the %o registers (which my code is prepared to have
clobbered by calls to .mul).  The only %g register it even refers to is
%g0, as far as I can see.  I even looked at the FUNC() entry prologue,
and it doesn't use %g1 even if compiling for profiling, which I'm not
doing anyway.

What am I missing?  What could be bashing %g1?  What other registers
can I expect to change mysteriously behind my back, and - perhaps most
important of all - where is all this stuff documented?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B