diff options
Diffstat (limited to 'libffi/src/powerpc/ffi.c')
-rw-r--r-- | libffi/src/powerpc/ffi.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c index 6f0e2a5..30ab7ef 100644 --- a/libffi/src/powerpc/ffi.c +++ b/libffi/src/powerpc/ffi.c @@ -288,7 +288,7 @@ enum { ASM_NEEDS_REGISTERS64 = 4 }; |--------------------------------------------| | | TOC save area 8 | | |--------------------------------------------| | stack | - | Linker doubleword 8 | | gorws | + | Linker doubleword 8 | | grows | |--------------------------------------------| | down V | Compiler doubleword 8 | | |--------------------------------------------| | lower addresses @@ -384,15 +384,14 @@ void hidden ffi_prep_args64(extended_cif *ecif, unsigned long *const stack) } else { - /* Structures with 1, 2 and 4 byte sizes are passed left-padded - if they are in the first 8 arguments. */ - if (next_arg >= gpr_base - && (*ptr)->size < 8 - && ((*ptr)->size & ~((*ptr)->size - 1)) == (*ptr)->size) - memcpy((char *) next_arg + 8 - (*ptr)->size, - (char *) *p_argv, (*ptr)->size); - else - memcpy((char *) next_arg, (char *) *p_argv, (*ptr)->size); + char *where = (char *) next_arg; + + /* Structures with size less than eight bytes are passed + left-padded. */ + if ((*ptr)->size < 8) + where += 8 - (*ptr)->size; + + memcpy (where, (char *) *p_argv, (*ptr)->size); next_arg += words; if (next_arg == gpr_end) next_arg = rest; @@ -1027,12 +1026,9 @@ ffi_closure_helper_LINUX64 (ffi_closure* closure, void * rvalue, #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif - /* Structures with 1, 2 and 4 byte sizes are passed left-padded - if they are in the first 8 arguments. */ - if (ng < NUM_GPR_ARG_REGISTERS64 - && arg_types[i]->size < 8 - && ((arg_types[i]->size & ~(arg_types[i]->size - 1)) - == arg_types[i]->size)) + /* 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 avalue[i] = pst; |