separate ARM ffi_prepare_args in a version implementing the simple SYSV calling convention and one for the hard-float calling convention

This commit is contained in:
David Schneider
2013-03-26 19:22:02 +01:00
parent 3a352b8a82
commit 0f2ff2d4c9
2 changed files with 13 additions and 17 deletions

View File

@@ -122,15 +122,15 @@ static size_t ffi_put_arg(ffi_type **arg_type, void **arg, char *stack)
value is cif->vfp_used (word bitset of VFP regs used for passing
arguments). These are only used for the VFP hard-float ABI.
*/
int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space)
int ffi_prep_args_SYSV(char *stack, extended_cif *ecif, float *vfp_space)
{
register unsigned int i, vi = 0;
register unsigned int i;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
argp = stack;
if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
*(void **) argp = ecif->rvalue;
argp += 4;
@@ -140,23 +140,19 @@ int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space)
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0);
i--, p_arg++)
i--, p_arg++, p_argv++)
{
/* Allocated in VFP registers. */
if (ecif->cif->abi == FFI_VFP
&& vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg))
{
char *vfp_slot = (char *)(vfp_space + ecif->cif->vfp_args[vi++]);
ffi_put_arg(p_arg, p_argv, vfp_slot);
p_argv++;
continue;
}
argp = ffi_align(p_arg, argp);
argp += ffi_put_arg(p_arg, p_argv, argp);
p_argv++;
}
return 0;
}
int ffi_prep_args_VFP(char *stack, extended_cif *ecif, float *vfp_space)
{
// make sure we are using FFI_VFP
FFI_ASSERT(ecif->cif->abi == FFI_VFP);
/* Indicate the VFP registers used. */
return ecif->cif->vfp_used;
}

View File

@@ -187,7 +187,7 @@ ARM_FUNC_START ffi_call_SYSV
@ r1 already set
@ Call ffi_prep_args(stack, &ecif)
bl CNAME(ffi_prep_args)
bl CNAME(ffi_prep_args_SYSV)
@ move first 4 parameters in registers
ldmia sp, {r0-r3}
@@ -364,7 +364,7 @@ ARM_FUNC_START ffi_call_VFP
sub r2, fp, #64 @ VFP scratch space
@ Call ffi_prep_args(stack, &ecif, vfp_space)
bl CNAME(ffi_prep_args)
bl CNAME(ffi_prep_args_VFP)
@ Load VFP register args if needed
cmp r0, #0