diff options
Diffstat (limited to 'ext/ffi_c/libffi/src/mips/ffi.c')
-rw-r--r-- | ext/ffi_c/libffi/src/mips/ffi.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/ffi_c/libffi/src/mips/ffi.c b/ext/ffi_c/libffi/src/mips/ffi.c index 79cff9b..5d0dd70 100644 --- a/ext/ffi_c/libffi/src/mips/ffi.c +++ b/ext/ffi_c/libffi/src/mips/ffi.c @@ -170,7 +170,14 @@ static void ffi_prep_args(char *stack, break; case FFI_TYPE_UINT32: +#ifdef FFI_MIPS_N32 + /* The N32 ABI requires that 32-bit integers + be sign-extended to 64-bits, regardless of + whether they are signed or unsigned. */ + *(ffi_arg *)argp = *(SINT32 *)(* p_argv); +#else *(ffi_arg *)argp = *(UINT32 *)(* p_argv); +#endif break; /* This can only happen with 64bit slots. */ @@ -670,9 +677,16 @@ ffi_prep_closure_loc (ffi_closure *closure, if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) return FFI_BAD_ABI; fn = ffi_closure_O32; -#else /* FFI_MIPS_N32 */ - if (cif->abi != FFI_N32 && cif->abi != FFI_N64) +#else +#if _MIPS_SIM ==_ABIN32 + if (cif->abi != FFI_N32 + && cif->abi != FFI_N32_SOFT_FLOAT) + return FFI_BAD_ABI; +#else + if (cif->abi != FFI_N64 + && cif->abi != FFI_N64_SOFT_FLOAT) return FFI_BAD_ABI; +#endif fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ |