summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/mips/ffi.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index eceef84..e7e5d94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-23 Mark H Weaver <mhw@netris.org>
+
+ * src/mips/ffi.c: Fix handling of uint32_t arguments on the
+ MIPS N32 ABI.
+
2013-10-13 Sandra Loosemore <sandra@codesourcery.com>
* README: Add Nios II to table of supported platforms.
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. */