aboutsummaryrefslogtreecommitdiff
path: root/libffi/src/sh/ffi.c
diff options
context:
space:
mode:
Diffstat (limited to 'libffi/src/sh/ffi.c')
-rw-r--r--libffi/src/sh/ffi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libffi/src/sh/ffi.c b/libffi/src/sh/ffi.c
index eb594460dd2..8aa96a1e14f 100644
--- a/libffi/src/sh/ffi.c
+++ b/libffi/src/sh/ffi.c
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- ffi.c - Copyright (c) 2002 Kaz Kojima
+ ffi.c - Copyright (c) 2002, 2003 Kaz Kojima
SuperH Foreign Function Interface
@@ -220,7 +220,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
greg += n;
#endif
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
memcpy (argp, *p_argv, z);
- argp += z;
+ argp += n * sizeof (int);
}
}
@@ -507,7 +507,7 @@ ffi_prep_closure (ffi_closure* closure,
#ifdef __LITTLE_ENDIAN__
#define OFS_INT8 0
-#define OFS_INT16 2
+#define OFS_INT16 0
#else
#define OFS_INT8 3
#define OFS_INT16 2
@@ -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
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++;
- ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0;
+ ireg = 1;
}
else
ireg = 0;
@@ -717,6 +717,6 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
(closure->fun) (cif, rvalue, avalue, closure->user_data);
- /* Tell ffi_closure_osf how to perform return type promotions. */
- return cif->rtype->type;
+ /* Tell ffi_closure_SYSV how to perform return type promotions. */
+ return return_type (cif->rtype);
}