separate ARM ffi_prepare_args in a version implementing the simple SYSV calling convention and one for the hard-float calling convention
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 1fb7199..d3dba9c 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -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
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;
@@ -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;
}
diff --git a/src/arm/sysv.S b/src/arm/sysv.S
index fb38cd6..de1809b 100644
--- a/src/arm/sysv.S
+++ b/src/arm/sysv.S
@@ -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