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:
@@ -122,14 +122,14 @@ 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
|
value is cif->vfp_used (word bitset of VFP regs used for passing
|
||||||
arguments). These are only used for the VFP hard-float ABI.
|
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 void **p_argv;
|
||||||
register char *argp;
|
register char *argp;
|
||||||
register ffi_type **p_arg;
|
register ffi_type **p_arg;
|
||||||
|
|
||||||
argp = stack;
|
argp = stack;
|
||||||
|
|
||||||
|
|
||||||
if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
|
if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
|
||||||
*(void **) argp = ecif->rvalue;
|
*(void **) argp = ecif->rvalue;
|
||||||
@@ -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;
|
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
|
||||||
(i != 0);
|
(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_align(p_arg, argp);
|
||||||
argp += ffi_put_arg(p_arg, p_argv, 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. */
|
/* Indicate the VFP registers used. */
|
||||||
return ecif->cif->vfp_used;
|
return ecif->cif->vfp_used;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ ARM_FUNC_START ffi_call_SYSV
|
|||||||
@ r1 already set
|
@ r1 already set
|
||||||
|
|
||||||
@ Call ffi_prep_args(stack, &ecif)
|
@ Call ffi_prep_args(stack, &ecif)
|
||||||
bl CNAME(ffi_prep_args)
|
bl CNAME(ffi_prep_args_SYSV)
|
||||||
|
|
||||||
@ move first 4 parameters in registers
|
@ move first 4 parameters in registers
|
||||||
ldmia sp, {r0-r3}
|
ldmia sp, {r0-r3}
|
||||||
@@ -364,7 +364,7 @@ ARM_FUNC_START ffi_call_VFP
|
|||||||
sub r2, fp, #64 @ VFP scratch space
|
sub r2, fp, #64 @ VFP scratch space
|
||||||
|
|
||||||
@ Call ffi_prep_args(stack, &ecif, vfp_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
|
@ Load VFP register args if needed
|
||||||
cmp r0, #0
|
cmp r0, #0
|
||||||
|
|||||||
Reference in New Issue
Block a user