aboutsummaryrefslogtreecommitdiff
path: root/libffi
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2003-09-18 14:08:20 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2003-09-18 14:08:20 +0000
commit78d6113deb0c7cd72ede79826301f74d2361825e (patch)
tree8668a37e11b5fc94252867a6093afcc0c2b61fe5 /libffi
parent0713a627627ebcf9d4e4ef2ad4b44327e072c422 (diff)
* src/sh/ffi.c (ffi_prep_args): Take account into the alignement
for the register size. (ffi_closure_helper_SYSV): Handle the structure return value address correctly. (ffi_closure_helper_SYSV): Return the appropriate type when the registers are used for the structure return value. * src/sh/sysv.S (ffi_closure_SYSV): Fix the stack layout for the 64-bit return value. Update copyright years. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@71521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r--libffi/ChangeLog11
-rw-r--r--libffi/src/sh/ffi.c12
-rw-r--r--libffi/src/sh/sysv.S29
3 files changed, 32 insertions, 20 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 419f88c92eb..b12f804a1d0 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,14 @@
+2003-09-18 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * src/sh/ffi.c (ffi_prep_args): Take account into the alignement
+ for the register size.
+ (ffi_closure_helper_SYSV): Handle the structure return value
+ address correctly.
+ (ffi_closure_helper_SYSV): Return the appropriate type when
+ the registers are used for the structure return value.
+ * src/sh/sysv.S (ffi_closure_SYSV): Fix the stack layout for
+ the 64-bit return value. Update copyright years.
+
2003-09-17 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in
diff --git a/libffi/src/sh/ffi.c b/libffi/src/sh/ffi.c
index 65acbcbc1a6..8aa96a1e14f 100644
--- a/libffi/src/sh/ffi.c
+++ b/libffi/src/sh/ffi.c
@@ -220,7 +220,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
greg += n;
#endif
memcpy (argp, *p_argv, z);
- argp += z;
+ argp += n * sizeof (int);
}
}
@@ -315,7 +315,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
}
#endif
memcpy (argp, *p_argv, z);
- argp += z;
+ argp += n * sizeof (int);
}
}
@@ -533,10 +533,10 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
/* Copy the caller's structure return value address so that the closure
returns the data directly to the caller. */
- if (cif->rtype->type == FFI_TYPE_STRUCT)
+ if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG)
{
rvalue = *pgr++;
- ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
+ ireg = 1;
}
else
ireg = 0;
@@ -717,6 +717,6 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
(closure->fun) (cif, rvalue, avalue, closure->user_data);
- /* Tell ffi_closure_osf how to perform return type promotions. */
- return cif->rtype->type;
+ /* Tell ffi_closure_SYSV how to perform return type promotions. */
+ return return_type (cif->rtype);
}
diff --git a/libffi/src/sh/sysv.S b/libffi/src/sh/sysv.S
index 40c14e2d208..ab98a8af433 100644
--- a/libffi/src/sh/sysv.S
+++ b/libffi/src/sh/sysv.S
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- sysv.S - Copyright (c) 2002 Kaz Kojima
+ sysv.S - Copyright (c) 2002, 2003 Kaz Kojima
SuperH Foreign Function Interface
@@ -505,21 +505,22 @@ ENTRY(ffi_closure_SYSV)
...
32 bytes (floating register parameters, SH-4 only)
16 bytes (register parameters)
- 4 bytes (result)
+ 8 bytes (result)
+ 4 bytes (pad)
4 bytes (5th arg)
<- new stack pointer
*/
.LCFI8:
#if defined(__SH4__)
- add #-56,r15
+ add #-64,r15
#else
- add #-24,r15
+ add #-32,r15
#endif
.LCFI9:
mov r15,r14
.LCFIA:
mov r14,r1
- add #24,r1
+ add #32,r1
mov.l r7,@-r1
mov.l r6,@-r1
mov.l r5,@-r1
@@ -528,7 +529,7 @@ ENTRY(ffi_closure_SYSV)
#if defined(__SH4__)
mov r14,r1
- add #56,r1
+ add #64,r1
#ifdef __LITTLE_ENDIAN__
fmov.s fr10,@-r1
fmov.s fr11,@-r1
@@ -552,14 +553,14 @@ ENTRY(ffi_closure_SYSV)
#endif
mov r14,r1
- add #4,r1
+ add #8,r1
mov r1,r5
mov r14,r1
#if defined(__SH4__)
- add #64,r1
+ add #72,r1
#else
- add #32,r1
+ add #40,r1
#endif
mov.l r1,@r14
@@ -574,7 +575,7 @@ ENTRY(ffi_closure_SYSV)
mov.w @r0,r0
mov r14,r2
braf r0
- add #4,r2
+ add #8,r2
0:
.align 2
L_helper:
@@ -664,9 +665,9 @@ L_case_uh:
L_case_v:
#if defined(__SH4__)
- add #56,r15
+ add #64,r15
#else
- add #24,r15
+ add #32,r15
#endif
lds.l @r15+,pr
rts
@@ -757,9 +758,9 @@ __FRAME_BEGIN__:
.4byte .LCFI9-.LCFI8
.byte 0xe /* DW_CFA_def_cfa_offset */
#if defined(__SH4__)
- .byte 8+56 /* uleb128 8+56 */
+ .byte 8+64 /* uleb128 8+64 */
#else
- .byte 8+24 /* uleb128 8+24 */
+ .byte 8+32 /* uleb128 8+32 */
#endif
.byte 0x91 /* DW_CFA_offset, column 0x11 */
.byte 0x2