This separates the 32-bit sysv/linux/bsd code from the 64-bit linux

code, and makes it possible to link code compiled with different
options to those used to compile libffi.  For example, a
-mlong-double-128 libffi can be used with -mlong-double-64 code.

Using the return value area as a place to pass parameters wasn't such
a good idea, causing a failure of cls_ulonglong.c.  I didn't see this
when running the mainline gcc libffi testsuite because that version of
the test is inferior to the upstreamm libffi test.

Using NUM_FPR_ARG_REGISTERS rather than NUM_FPR_ARG_REGISTERS64 meant
that a parameter save area could be allocated before it was strictly
necessary.  Wrong but harmless.  Found when splitting apart ffi.c
into 32-bit and 64-bit support.
This commit is contained in:
Alan Modra
2013-11-21 06:12:35 -05:00
committed by Anthony Green
parent 69df91cfb4
commit ab79d6e219
21 changed files with 2193 additions and 1777 deletions

View File

@@ -30,7 +30,7 @@
.file "linux64_closure.S"
#ifdef __powerpc64__
#ifdef POWERPC64
FFI_HIDDEN (ffi_closure_LINUX64)
.globl ffi_closure_LINUX64
# if _CALL_ELF == 2
@@ -60,13 +60,11 @@ ffi_closure_LINUX64:
# endif
# if _CALL_ELF == 2
# 32 byte special reg save area + 64 byte parm save area and retval
# + 13*8 fpr save area + round to 16
# define STACKFRAME 208
# 32 byte special reg save area + 64 byte parm save area
# + 64 byte retval area + 13*8 fpr save area + round to 16
# define STACKFRAME 272
# define PARMSAVE 32
# No parameter save area is needed for the call to ffi_closure_helper_LINUX64,
# so return value can start there.
# define RETVAL PARMSAVE
# define RETVAL PARMSAVE+64
# else
# 48 bytes special reg save area + 64 bytes parm save area
# + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
@@ -85,8 +83,8 @@ ffi_closure_LINUX64:
bt 7, .Lparmsave
# Our caller has not allocated a parameter save area.
# We need to allocate one here and use it to pass gprs to
# ffi_closure_helper_LINUX64. The return value area will do.
addi %r12, %r1, -STACKFRAME+RETVAL
# ffi_closure_helper_LINUX64.
addi %r12, %r1, -STACKFRAME+PARMSAVE
.Lparmsave:
std %r0, 16(%r1)
# Save general regs into parm save area