Re: Sparc assember

New Message Reply About this list Date view Thread view Subject view Author view

Niels Möller (nisse@lysator.liu.se)
28 Sep 1998 03:02:10 +0200


Eric Young <eay@cryptsoft.com> writes:

> As part of reworking my Bignum library, I've been having to redo some of my
> assember. The question I have relates to the normal sparc register usage
> conventions under Solaris (and SunOS if possible).

[...]

> My understanding is that
> %i0-%i7
> %l0-%l7
> %o0-%o7
> are reasonably simple, watch out for the stack pointer, frame
> pointer and return address.
> My question is about the global registers. The only references is that
> %g1 is normally a temp and
> %g2-%g4 can also be used, but some old programs may have problems.
> This leaves me wondering what %g5, %g6 and %g7 are used for.
>
> Are the global registers preserved across function calls?

Do you mean "unaffected by register window shifting" or "preserved by
convention"? In any case, I think the answer is yes (that's more or
less the definition of "global": They are unaffected by register
window shifting, and not normally used for passing arguments).

The global registers could sensibly be used by the language
environment (libc), but I don't think that is the case. (Kernel code
does use a few of them that way, but that's not very relevant here).
If you use them for local variables, you should of course make sure
their old values are saved and restored properly before returning.

> Am I free to mutilate the input registers?, I assume yes.

I think so too.

> My final question concerns the Sparc v9 chips. Rumour had it that solaris
> does save the local registers as 64 bit quantities on context switches.
> Is this true? Are any of the others saved as 64 bit number in the 32bit
> Solaris OS?

Depends on OS version. I think this is the situation:

2.5.x: Only the low 32-bits are saved.
2.6: A subset of the registers are saved as 64-bit values, but not
       all of them.
2.7: All registers are saved as 64-bit values.

> Any responses would be greatly appreciated.

Sorry for the vague answers. I don't have the sparc9 manual handy, and
I don't think even that answers all of your questions. The above is my
recollection of that manual and some other sources.

> eric (who needs about 20+ temp registers to implement comba8 type
> multiplication cleanly)

Then the 31 sparc registers ought to suffice.

Regards,
/Niels


New Message Reply About this list Date view Thread view Subject view Author view

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

The following archive was created by hippie-mail 7.98617-22 on Sat Apr 10 1999 - 01:14:01