/* Perform machine dependent cif processing. */
-ffi_status
-ffi_prep_cif_machdep(ffi_cif *cif)
+static ffi_status
+ffi_prep_cif_machdep_core(ffi_cif *cif)
{
int flags;
return FFI_OK;
}
+ffi_status
+ffi_prep_cif_machdep(ffi_cif *cif)
+{
+ cif->nfixedargs = cif->nargs;
+ return ffi_prep_cif_machdep_core(cif);
+}
+
+ffi_status
+ffi_prep_cif_machdep_var(ffi_cif *cif,
+ unsigned int nfixedargs,
+ unsigned int ntotalargs MAYBE_UNUSED)
+{
+ cif->nfixedargs = nfixedargs;
+ return ffi_prep_cif_machdep_core(cif);
+}
+
extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64);
void
ffi_cif *cif;
void **avalue;
ffi_type **p_arg;
- long i, avn, gpcount, fpcount;
+ long i, avn, gpcount, fpcount, nfixedargs;
cif = closure->cif;
avn = cif->nargs;
+ nfixedargs = cif->nfixedargs;
avalue = alloca (avn * sizeof (void *));
/* If the structure return value is passed in memory get that location
gpcount = fpcount = 0;
for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++)
{
+ int named = i < nfixedargs;
switch ((*p_arg)->type)
{
case FFI_TYPE_SINT8:
break;
case FFI_TYPE_FLOAT:
- if (gpcount < 8 && fpcount < 8)
+ if (named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
float result;
break;
case FFI_TYPE_DOUBLE:
- if (gpcount < 8 && fpcount < 8)
+ if (named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
double result;
case FFI_TYPE_LONGDOUBLE:
if (gpcount & 1)
gpcount++;
- if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8)
+ if (LDBL_MANT_DIG == 64 && named && gpcount < 8 && fpcount < 8)
{
fpreg *addr = &stack->fp_regs[fpcount++];
__float80 result;