37 #define CIF_FLAGS_CHAR 1 38 #define CIF_FLAGS_SHORT 2 39 #define CIF_FLAGS_INT 4 40 #define CIF_FLAGS_DINT 8 57 void *struct_value_ptr;
61 if (ecif->
cif->rtype->type == FFI_TYPE_STRUCT
63 struct_value_ptr = ecif->
rvalue;
65 struct_value_ptr =
NULL;
69 for (i = ecif->
cif->nargs, p_arg = ecif->
cif->arg_types;
78 switch ((*p_arg)->type)
81 *(
signed int *) argp = (
signed int) *(SINT8 *) *p_argv;
85 *(
unsigned int *) argp = (
unsigned int) *(UINT8 *) *p_argv;
89 *(
signed int *) argp = (
signed int) *(SINT16 *) *p_argv;
93 *(
unsigned int *) argp = (
unsigned int) *(UINT16 *) *p_argv;
107 memcpy (argp, *p_argv, z);
110 if ((
sizeof(
int) - 1) & z)
111 z =
ALIGN(z,
sizeof(
int));
118 return struct_value_ptr;
125 switch (cif->rtype->type)
131 case FFI_TYPE_STRUCT:
132 if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT &&
133 cif->rtype->elements[1])
139 if (cif->rtype->size == sizeof (
char))
141 else if (cif->rtype->size == sizeof (
short))
143 else if (cif->rtype->size == sizeof (
int))
145 else if (cif->rtype->size == 2 * sizeof (
int))
152 if (cif->rtype->size <= sizeof (
int))
163 ffi_call (ffi_cif *cif,
void (*fn) (),
void *rvalue,
void **avalue)
174 && cif->rtype->type == FFI_TYPE_STRUCT
209 for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++)
217 if ((
sizeof (
int) - 1) & z)
218 z =
ALIGN(z,
sizeof (
int));
232 arg_area = (
void **)
alloca (cif->nargs * sizeof (
void *));
236 (closure->fun) (cif, resp, arg_area, closure->user_data);
243 void (*fun)(ffi_cif *,
void *,
void **,
void *),
244 void *user_data,
void *codeloc)
246 char *tramp = (
char *) codeloc;
252 *(
unsigned short *)(tramp + 0) = 0x0000;
256 *(
unsigned int *)(tramp + 4) = (
unsigned int) closure;
259 if (cif->rtype->type == FFI_TYPE_STRUCT
268 *(
unsigned int *)(tramp + 11) = (
unsigned int)fn + 2 -
269 (
unsigned int)tramp - 9 - 6;
272 closure->user_data = user_data;
void ffi_closure_elfbsd(void)
unsigned int ffi_closure_elfbsd_inner(ffi_closure *, void *, char *)
static void ffi_prep_closure_elfbsd(ffi_cif *cif, void **avalue, char *stackp)
void ffi_call_elfbsd(extended_cif *, unsigned, unsigned, void *, void(*)())
ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, void(*fun)(ffi_cif *, void *, void **, void *), void *user_data, void *codeloc)
void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)
void ffi_closure_struct_elfbsd(void)
void ffi_prep_args(char *stack, extended_cif *ecif)
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)