summaryrefslogtreecommitdiff
path: root/src/mips
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-10-26 08:30:06 -0400
committerAnthony Green <green@moxielogic.com>2013-10-26 08:30:06 -0400
commitd3372c54ce7117e80d389ba875dc5b6b2213c71e (patch)
tree6bea9624996fd0e92f0df6bcc308b75961b2a05a /src/mips
parentd6716aba8118eb0513885cfe557bedebb7016e8b (diff)
downloadlibffi-d3372c54ce7117e80d389ba875dc5b6b2213c71e.tar.gz
Fix N32 ABI issue for MIPS.
Diffstat (limited to 'src/mips')
-rw-r--r--src/mips/ffi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mips/ffi.c b/src/mips/ffi.c
index 03121e3..5d0dd70 100644
--- a/src/mips/ffi.c
+++ b/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. */