little-endian ppc64 support
This commit is contained in:
@@ -132,6 +132,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
|
||||
|
||||
int i;
|
||||
ffi_type **ptr;
|
||||
#ifndef __NO_FPRS__
|
||||
double double_tmp;
|
||||
#endif
|
||||
union {
|
||||
void **v;
|
||||
char **c;
|
||||
@@ -151,7 +154,6 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
|
||||
gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
|
||||
intarg_count = 0;
|
||||
#ifndef __NO_FPRS__
|
||||
double double_tmp;
|
||||
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
|
||||
fparg_count = 0;
|
||||
copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
|
||||
@@ -553,11 +555,12 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
||||
{
|
||||
char *where = next_arg.c;
|
||||
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
/* Structures with size less than eight bytes are passed
|
||||
left-padded. */
|
||||
if ((*ptr)->size < 8)
|
||||
where += 8 - (*ptr)->size;
|
||||
|
||||
#endif
|
||||
memcpy (where, *p_argv.c, (*ptr)->size);
|
||||
next_arg.ul += words;
|
||||
if (next_arg.ul == gpr_end.ul)
|
||||
@@ -1236,6 +1239,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
|
||||
|
||||
case FFI_TYPE_SINT8:
|
||||
case FFI_TYPE_UINT8:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
/* there are 8 gpr registers used to pass values */
|
||||
if (ng < 8)
|
||||
{
|
||||
@@ -1249,9 +1253,11 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
|
||||
pst++;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_SINT16:
|
||||
case FFI_TYPE_UINT16:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
/* there are 8 gpr registers used to pass values */
|
||||
if (ng < 8)
|
||||
{
|
||||
@@ -1265,6 +1271,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
|
||||
pst++;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_SINT32:
|
||||
case FFI_TYPE_UINT32:
|
||||
@@ -1395,21 +1402,27 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
|
||||
{
|
||||
case FFI_TYPE_SINT8:
|
||||
case FFI_TYPE_UINT8:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
avalue[i] = (char *) pst + 7;
|
||||
pst++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_SINT16:
|
||||
case FFI_TYPE_UINT16:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
avalue[i] = (char *) pst + 6;
|
||||
pst++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_SINT32:
|
||||
case FFI_TYPE_UINT32:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
avalue[i] = (char *) pst + 4;
|
||||
pst++;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case FFI_TYPE_SINT64:
|
||||
case FFI_TYPE_UINT64:
|
||||
@@ -1419,11 +1432,13 @@ ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
|
||||
break;
|
||||
|
||||
case FFI_TYPE_STRUCT:
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
/* Structures with size less than eight bytes are passed
|
||||
left-padded. */
|
||||
if (arg_types[i]->size < 8)
|
||||
avalue[i] = (char *) pst + 8 - arg_types[i]->size;
|
||||
else
|
||||
#endif
|
||||
avalue[i] = pst;
|
||||
pst += (arg_types[i]->size + 7) / 8;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user