This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libffi on XScale (BE)


On Thu, 2004-10-21 at 10:22, Quaritsch Markus wrote:
> Hi,
> 
> We've discovered a bug in the ffi-library on XScale (BE). When running the 
> testcase 'return_ll.c' in testsuite/libffi.call it aborts on line 35. The 
> problem is related to 64bit returnvalues which are not handled correctly.
> 
> The attached patch (for src/arm/sysv.S) fixes this issue by obtaining the 
> correct value for the returntype and the correct address for the returnvalue.
> 


I think I've figured out most of what you are trying to do now, and as a
result I think your approach is wrong.

--- sysv.S.orig 2004-10-21 09:35:22.000000000 +0200
+++ sysv.S      2004-10-21 10:59:17.204423684 +0200
@@ -88,10 +88,17 @@
        mov   sp, fp
 
        # Load a3 with the pointer to storage for the return value
-       ldr   a3, [sp, #24]
+# @@@ quam
+       ldr  a3, [sp, #36]
 

This bit doesn't make sense at all.  There are only 32 bytes in the
stack frame for this call, so you can't peek outside it.


        # Load a4 with the return type code 
-       ldr   a4, [sp, #12]
+# @@@ quam
+       # load address of ecif.cif  
+       ldr a4, [sp, #32] 
+       # load address of ecif.cif->rtype 
+       ldr a4, [a4, #12]
+       # load value of ecif.cif->rtype->type 
+       ldrh a4, [a4, #6]
 
No, you don't want to be looking up the fully-qualified type here, you
want the simplified type, as calculated in arm/ffi.c
(ffi_prep_cif_machdep).  That function needs extending to support a
single 64-bit integer type (the low-level code doesn't care whether it's
signed or not, just the size and the registers holding the value).

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]