View Single Post

   
  #1 (permalink)  
Old 01-16-2008, 10:34 AM
Charles Lindsey
 
Posts: n/a
Default Conventions for using the register %g7

In SPARC systems, what conventions apply to the use og the register %g7?

For example, under Solaris 10 (or under the libc that comes with it), the
lmutex_unlock function starts off like this:

lmutex_unlock: save %sp, -96, %sp
lmutex_unlock+4: ld [%g7 + 84], %l2
lmutex_unlock+8: sethi %hi(0x1000), %i5
lmutex_unlock+0xc: add %i5, 132, %i1
lmutex_unlock+0x10: ld [%l2 + %i1], %l7
lmutex_unlock+0x14: tst %l7

where it is evident that %g7 is a globally understood register (presumably
pointing to some globally known collection of variables).

And for that matter, what is lmutex_unlock supposed to do; there is no man
page for it? All I know is that it is called by brk. And in Solaris 7, brk
was a much smaller beast that never called lmutex_unlock.

And I have observed that even my somewhat ancient Sun C compiler never
seems to make use of %g7.

OTOH, I have another compiler, nothing to do with Sun, that is not aware
of %g7 being reserved for anything. So as a result I have a program that
worked fine under Solaris 7, bur breaks in Solaris 10.

So what is going on?

--
Charles H. Lindsey ---------At Home, doing my own thing------------------------
Tel: +44 161 436 6131 Fax: +44 161 436 6133 Web: http://www.cs.man.ac.uk/~chl
Email: chl@clerew.man.ac.uk Snail: 5 Clerewood Ave, CHEADLE, SK8 3JU, U.K.
PGP: 2C15F1A9 Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5
Reply With Quote