[Patch] libffi-MIPS: Fix ffi closure support for n64 ABI.
David Daney
ddaney@avtrex.com
Thu Dec 6 06:44:00 GMT 2007
Closure support in libffi for the MIPS64/n64 ABI is broken because it is
using the 32 bit add instruction in several places to do pointer
manipulation. In most cases this causes the calculated pointer value to
have its upper 32 bits clobbered.
I am still trying to understand how I didn't catch this when I was doing
the initial development of the n64 support. My best (but untested)
theory is that the machine I did the original testing on (linux-2.6.18
on R4400 Indy) just happened to give the desired results for the
undefined operation I was using and my new test machine (linux 2.6.23 on
R5000 O2) does not. The operation is undefined because the source
register must be either all 0s or all 1s in the upper 32 bits when using
32 bit arithmetic.
In any event the patch uses the 64 bit add instruction so that the upper
32 bits of the pointers are not clobbered by sign extension.
Tested on mips64-linux-gnu both n32 and n64 ABIs
OK to commit?
2007-12-05 David Daney <ddaney@avtrex.com>
* src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on
pointer values.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffi-n64.diff
Type: text/x-patch
Size: 521 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20071206/26aa10e1/attachment.bin>
More information about the Java-patches
mailing list