[parisc-linux] Re: Using r2 for millicode return pointer

amodra@one.net.au amodra@one.net.au
Wed, 30 May 2001 14:33:58 +0930


On Tue, May 29, 2001 at 10:50:46PM -0600, John Marvin wrote:
> 
> Alan,
> 
> I am cc'ing parisc-linux also, since there are other parisc gcc experts
> who may have an opinion on this. For those new to this, I found a
> bug where a procedure calls millicode, which on Linux uses r2 as
> a return pointer, however, gcc wasn't aware of that.
> 
> It looks like the cause of this bug is that we changed the return
> pointer for millicode from r31 to r2. Was this a deliberate choice?
> 
> On HP-UX, millicode uses r31 for a return pointer.  This allows leaf
> routines to call millicode without having to save r2.  I notice that the
> code that you patched has a clobber for r31, which is not necessary
> (currently) for Linux.  Is this code shared with the HP-UX version of gcc?
> If not, we should remove the r31 clobbers, since they are unecessary and
> will allow more efficient usage for r31.
> 
> If this code is shared, perhaps that would be another motivation for
> changing the Linux copy of the millicode to use r31, if possible (I
> don't know what the motivation for using r2 was, so I don't know if
> this is reasonable).

It's a 64-bit vs. 32-bit ABI issue.  64-bit uses r2 as the return
for millicode.  See devresource.hp.com/STK/partner/pa64rt.pdf, chapter 5

-- 
Alan

PS: I was wrong about this bug affecting the 32-bit compiler.