ffi.c (ffi_prep_args): Take account into the alignement for the register size.
* 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. From-SVN: r71521
This commit is contained in:
parent
0b5ce4f15c
commit
df805cdc54
@ -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>
|
2003-09-17 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in
|
* testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in
|
||||||
|
@ -220,7 +220,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
|
|||||||
greg += n;
|
greg += n;
|
||||||
#endif
|
#endif
|
||||||
memcpy (argp, *p_argv, z);
|
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
|
#endif
|
||||||
memcpy (argp, *p_argv, z);
|
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
|
/* Copy the caller's structure return value address so that the closure
|
||||||
returns the data directly to the caller. */
|
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++;
|
rvalue = *pgr++;
|
||||||
ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
|
ireg = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ireg = 0;
|
ireg = 0;
|
||||||
@ -717,6 +717,6 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
|
|||||||
|
|
||||||
(closure->fun) (cif, rvalue, avalue, closure->user_data);
|
(closure->fun) (cif, rvalue, avalue, closure->user_data);
|
||||||
|
|
||||||
/* Tell ffi_closure_osf how to perform return type promotions. */
|
/* Tell ffi_closure_SYSV how to perform return type promotions. */
|
||||||
return cif->rtype->type;
|
return return_type (cif->rtype);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
sysv.S - Copyright (c) 2002 Kaz Kojima
|
sysv.S - Copyright (c) 2002, 2003 Kaz Kojima
|
||||||
|
|
||||||
SuperH Foreign Function Interface
|
SuperH Foreign Function Interface
|
||||||
|
|
||||||
@ -505,21 +505,22 @@ ENTRY(ffi_closure_SYSV)
|
|||||||
...
|
...
|
||||||
32 bytes (floating register parameters, SH-4 only)
|
32 bytes (floating register parameters, SH-4 only)
|
||||||
16 bytes (register parameters)
|
16 bytes (register parameters)
|
||||||
4 bytes (result)
|
8 bytes (result)
|
||||||
|
4 bytes (pad)
|
||||||
4 bytes (5th arg)
|
4 bytes (5th arg)
|
||||||
<- new stack pointer
|
<- new stack pointer
|
||||||
*/
|
*/
|
||||||
.LCFI8:
|
.LCFI8:
|
||||||
#if defined(__SH4__)
|
#if defined(__SH4__)
|
||||||
add #-56,r15
|
add #-64,r15
|
||||||
#else
|
#else
|
||||||
add #-24,r15
|
add #-32,r15
|
||||||
#endif
|
#endif
|
||||||
.LCFI9:
|
.LCFI9:
|
||||||
mov r15,r14
|
mov r15,r14
|
||||||
.LCFIA:
|
.LCFIA:
|
||||||
mov r14,r1
|
mov r14,r1
|
||||||
add #24,r1
|
add #32,r1
|
||||||
mov.l r7,@-r1
|
mov.l r7,@-r1
|
||||||
mov.l r6,@-r1
|
mov.l r6,@-r1
|
||||||
mov.l r5,@-r1
|
mov.l r5,@-r1
|
||||||
@ -528,7 +529,7 @@ ENTRY(ffi_closure_SYSV)
|
|||||||
|
|
||||||
#if defined(__SH4__)
|
#if defined(__SH4__)
|
||||||
mov r14,r1
|
mov r14,r1
|
||||||
add #56,r1
|
add #64,r1
|
||||||
#ifdef __LITTLE_ENDIAN__
|
#ifdef __LITTLE_ENDIAN__
|
||||||
fmov.s fr10,@-r1
|
fmov.s fr10,@-r1
|
||||||
fmov.s fr11,@-r1
|
fmov.s fr11,@-r1
|
||||||
@ -552,14 +553,14 @@ ENTRY(ffi_closure_SYSV)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
mov r14,r1
|
mov r14,r1
|
||||||
add #4,r1
|
add #8,r1
|
||||||
mov r1,r5
|
mov r1,r5
|
||||||
|
|
||||||
mov r14,r1
|
mov r14,r1
|
||||||
#if defined(__SH4__)
|
#if defined(__SH4__)
|
||||||
add #64,r1
|
add #72,r1
|
||||||
#else
|
#else
|
||||||
add #32,r1
|
add #40,r1
|
||||||
#endif
|
#endif
|
||||||
mov.l r1,@r14
|
mov.l r1,@r14
|
||||||
|
|
||||||
@ -574,7 +575,7 @@ ENTRY(ffi_closure_SYSV)
|
|||||||
mov.w @r0,r0
|
mov.w @r0,r0
|
||||||
mov r14,r2
|
mov r14,r2
|
||||||
braf r0
|
braf r0
|
||||||
add #4,r2
|
add #8,r2
|
||||||
0:
|
0:
|
||||||
.align 2
|
.align 2
|
||||||
L_helper:
|
L_helper:
|
||||||
@ -664,9 +665,9 @@ L_case_uh:
|
|||||||
|
|
||||||
L_case_v:
|
L_case_v:
|
||||||
#if defined(__SH4__)
|
#if defined(__SH4__)
|
||||||
add #56,r15
|
add #64,r15
|
||||||
#else
|
#else
|
||||||
add #24,r15
|
add #32,r15
|
||||||
#endif
|
#endif
|
||||||
lds.l @r15+,pr
|
lds.l @r15+,pr
|
||||||
rts
|
rts
|
||||||
@ -757,9 +758,9 @@ __FRAME_BEGIN__:
|
|||||||
.4byte .LCFI9-.LCFI8
|
.4byte .LCFI9-.LCFI8
|
||||||
.byte 0xe /* DW_CFA_def_cfa_offset */
|
.byte 0xe /* DW_CFA_def_cfa_offset */
|
||||||
#if defined(__SH4__)
|
#if defined(__SH4__)
|
||||||
.byte 8+56 /* uleb128 8+56 */
|
.byte 8+64 /* uleb128 8+64 */
|
||||||
#else
|
#else
|
||||||
.byte 8+24 /* uleb128 8+24 */
|
.byte 8+32 /* uleb128 8+32 */
|
||||||
#endif
|
#endif
|
||||||
.byte 0x91 /* DW_CFA_offset, column 0x11 */
|
.byte 0x91 /* DW_CFA_offset, column 0x11 */
|
||||||
.byte 0x2
|
.byte 0x2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user