Commit Graph
31 Commits
Author SHA1 Message Date
James Cowgill 159b94e5fd Various MIPS Fixes (#425)
* mips: simplify closure #defines

This commit should have no visible effect.

* mips: add special handling of variadic functions

MIPS requires special handling of variadic functions which pass floating
point arguments:
* In the o32 ABI, all float arguments are passed in integer registers.
* In the n32/n64 ABIs, float arguments after the ellipsis are passed in
  integer registers.

Implement this in libffi. To support this in n32/n64 closures, we need to add
a new mips_nfixedargs field to ffi_cif which will break the libffi ABI.

This fixes the libffi.call/cls_longdouble_va.c test which was failing on
64-bit MIPS.

* mips: align argn for all 64-bit types in o32 closure handler

Ensure that argn is pre-aligned for all 64-bit argument types (including
doubles) and not just integer types.

This fixes closures of the form "f(float, double, <some integer args>)".
Previously the first integer argument would be read from a2 which is garbage
at this point (the float arguments have already "consumed" a0-a3). After
this commit, argn is correctly padded between the "float" and "double"
arguments so that the first integer argument is read from the stack.

Fixes "double f(float,double,int)" test in #371

* mips: do not read from floating point register if returning a struct

In the o32 ABI, the pointer passed in a0 used to return structures
indirectly is treated as the first argument for argument allocation purposes.
This means that it should inhibit floating point registers the same way that
other integer arguments do.

Fixes "Double f(float,Double,double)" test in #371

* mips: fix pointer cast warnings

Fix two pointer cast warnings when compiled on 64-bit mips by casting
through uintptr_t.

Fixes mips64el part of #404
2018-04-18 20:28:23 -04:00
YunQiang Su 746dbe3a6a mips/ffi.c: fix encoding for jr on r6
mips/ffi.c: instruction jr has a different encoding for r6
2018-01-03 10:07:41 +08:00
YunQiang Su 94c102aa69 Not set mips on mips r6
MIPS release changed encodes of some instructions, include ll/sc etc.

if .set mips4 on mips r6, as will generate some wrong encode of some instructions.
2017-12-10 14:25:01 +08:00
Yen Chi Hsuan 9fc9dc535e Fix linux detection (closes #303) 2017-10-27 16:12:56 +08:00
Gregory Pakosz bd72848c7a Prefix ALIGN macros with FFI_ 2017-04-27 13:22:28 +02:00
Yousong Zhou 7a0d2c83bf mips: fix MIPS softfloat build issue
The patch for o32.S is taken from OpenWrt packages repo 3a7a4bf "libffi:
fix MIPS softfloat build issue with current binutils"

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2016-08-15 15:14:54 +08:00
Zhang Fuxin 505346e18f fix type error in unwind code 2015-08-26 09:57:10 +08:00
foxsen 5953c66bd7 add unwind infor for *go_closure;
reorder the labels to make thing more clear
2015-08-20 20:28:13 +08:00
Zhang Fuxin f0ecd5d403 fix O32 stack unwind code
add missing 1: label
2015-08-11 12:47:36 +08:00
foxsen 6f0201c803 various fixes for go closure support. Now all n64 tests passed. 2015-08-04 18:25:34 +08:00
foxsen 697dd4e8a0 add support for go closure support on mips 2015-08-04 12:53:33 +08:00
Heiher 40927bd3e1 Fix call floating point va function
I'm not sure floating-point arguments in GPR or FPR before calling
variable number arguments function. so, load all arguments to GPR and
FPR.
2014-02-09 10:38:24 +08:00
Mark H Weaver d3372c54ce Fix N32 ABI issue for MIPS. 2013-10-26 08:30:06 -04:00
Anthony Green 048d2f41c3 Rebase 2012-10-11 10:55:25 -04:00
Anthony Green 8360bf1cd0 Ensure that users don't include ffitarget.h directly 2012-02-23 07:01:13 -05:00
Anthony Green c365ee7577 Refresh 2012-01-23 11:13:18 -05:00
Anthony Green 049d8386ff Many new patches 2011-08-22 14:50:10 -04:00
Anthony Green 1fbf9dc44f Fix bad_abi test. rc5. 2011-02-13 08:06:39 -05:00
Anthony Green 42695e7250 Fix IRIX support 2011-02-09 15:12:35 -05:00
Anthony Green 3b836249fe Rebase from GCC 2011-02-08 14:28:59 -05:00
Anthony Green 2db72615b5 Rebase 2010-11-21 10:50:56 -05:00
Anthony Green d14178be4c FFI_LAST_ABI fix 2010-07-23 09:14:00 -04:00
Anthony Green 3f5b1375ab rebase 2010-07-12 14:39:18 -04:00
Anthony Green 9dc9a293f3 Rebase to latest GCC sources 2010-04-13 10:33:52 -04:00
Anthony Green 7b7a42f221 Rebase from GCC 2010-01-12 09:14:14 -05:00
Anthony Green c3042afaf3 Reset quilt patches post 3.0.9 merge with GCC 2010-01-01 08:08:02 -05:00
Anthony Green 0cfe60e9d1 3.0.9rc12 2009-12-29 10:06:04 -05:00
Anthony Green 9458d88f67 Rebase from GCC 2009-12-26 07:02:27 -05:00
Anthony Green da11bece0f Release 3.0.9rc5 2009-12-24 05:34:46 -05:00
Anthony Green 115ab36fce Update missing changes for 3.0.9r4. 2009-12-24 00:22:00 -05:00
Anthony Green c6dddbd02b Initial commit 2009-10-04 08:11:33 -04:00