Skip to contentSkip to conversation

Using r2 for millicode return pointer

parisc-linux John Marvin 2 participants 2 messages May 30, 2001

lore
Share & tools
lore
#0 lore raw

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).

John

P.S. Thanks for the quick fix!

#1 lore raw
Quoted 18 lines · John Marvin

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.

Quoted 4 lines

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

Signature · 3 lines
Alan

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