[PATCH] libffi on XScale (BE)
Quaritsch Markus
quam@qwws.net
Tue Oct 26 18:21:00 GMT 2004
On Tue, Oct 26, 2004 at 05:04:16PM +0100, Richard Earnshaw wrote:
> 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.
but it works ;-)
> --- 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.
But when you look at the code-snipped below, you can see, thet the
pointer for the ecif-struct is at sp + 32, and therefore the address of
the return-value must be at sp + 36 (its the parameter before the
ecif-struct). I have not reconstructed all modifications of the
stackpointer within this function - just guessing...
I've also compared the address of the returnvalue in the preceding
c-function with the one in the assembler-routine and they are (now) the
same.
> # 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).
Well I just looked at the parameter passed to the assembler-routine and
tried to grab the type of the return-value. The only way I found was the
ecif.cif-struct...
The original code was (from my point of view) wrong, because a4 always held
the value 1 (FFI_TYPE_INT) - even if the return-type was 64bit value.
I'm sure, you have a better solution because this are my first
experiences with the XScale (especially asm on this platform) and
libffi (got to know it last week).
bye
quam
--
| .''`. | Quaritsch Markus quam@qwws.net Student of Telematics |
| : :' : | TU-Graz, Austria |
| `. `' | |
| `- | Enter any 11-digit prime number to continue... |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20041026/cff6b6ef/attachment.sig>
More information about the Java-patches
mailing list