Commit Graph
41 Commits
Author SHA1 Message Date
Richard Henderson f27c4e4673 x86: Fix thinko in ffi_raw_call
Missed structure initialization for raw path.
Apparently there are no tests for this outside gcc.
2015-01-13 07:22:07 -08:00
Richard Henderson 3fa5d70cbb x86: Avoid fastcall when building with pcc
Apparently, PCC doesn't support the fastcall calling convention.
Nor does it issue a warning or error for the attribute that it
does not understand.
2015-01-05 13:03:06 -08:00
Richard Henderson a03d2310ed x86: Load structure return address into eax 2015-01-05 12:24:51 -08:00
Richard Henderson 1b12593d7e x86: Honor alignment of arguments
Darwin aligns long-double to 16, and thus all of the long double
tests were failing due to not honoring that.  We ought to be able
to devise a test case for GCC using __attribute__((aligned)) that
would have failed too.
2015-01-05 10:01:37 -08:00
Richard Henderson dea49e2020 x86: Fix typo in ffi_prep_go_closure
Used the wrong register for THISCALL and FASTCALL.
2014-11-14 13:07:47 +01:00
Richard Henderson f8c64e2486 x86: Add support for Go closures 2014-11-12 09:16:02 +01:00
Richard Henderson 198f469e91 x86: Add support for Complex 2014-11-12 09:16:02 +01:00
Richard Henderson b21ec1ce78 x86: Rewrite closures
Move everything into sysv.S, removing win32.S and freebsd.S.
Handle all abis with a single ffi_closure_inner function.
Move complexity of the raw THISCALL trampoline into assembly
instead of the trampoline itself.
Only push the context for the REGISTER abi; let the rest
receive it in a register.
2014-11-12 09:15:54 +01:00
Richard Henderson b9ac94f3af x86: Rewrite ffi_call
Decouple the assembly from FFI_TYPE_*.  Merge prep_args with ffi_call,
passing the frame and the stack to the assembly.

Note that this patch isn't really standalone, as this breaks closures.
2014-11-12 09:15:35 +01:00
Richard Henderson e7b0056d60 x86: Force FFI_TYPE_LONGDOUBLE different from FFI_TYPE_DOUBLE
There are few abis that set double = long double.  Eliminate the
conditional compilation and let this code simply be unused there.
2014-11-12 09:15:35 +01:00
Richard Henderson 4b2fad8fd5 x86: Remove some conditional compilation
Removal of ifdefs made possible to due to ffi_abi unification.
2014-11-12 09:15:35 +01:00
Richard Henderson ef76205647 x86: Tidy ffi_abi
The x86_64 unix port only handles one ABI; don't define all of the
other symbols.  The UNIX64 symbol retains the same value.

The i386 ports ought to have the same symbols, even if we can't yet
unify the values without incrementing the libffi soname.
2014-11-12 09:15:35 +01:00
Richard Henderson ebd82769de win64: Remove support from ffi.c 2014-11-12 09:15:35 +01:00
Bernd Edlinger bfcbf329c5 2014-05-11 Bernd Edlinger <bernd.edlinger@hotmail.de>
Fix current cygwin-64 build problems.
	* src/java_raw_api.c: Remove if !defined(FFI_NO_RAW_API).
	* src/x86/ffi.c: Add if defined(__CYGWIN__).
	* src/x86/win64.S (ffi_closure_win64, ffi_call_win64): Added
	handling for FFI_TYPE_UINT64, FFI_TYPE_POINTER and FFI_TYPE_INT.
	Added SEH information.  Fixed formatting.
2014-09-20 06:51:45 -04:00
nielsAD 5d6340ef2c Determine whether register arguments (THISCALL/FASTCALL/REGISTER) are really passed via register to closures. Use stack if not. 2014-08-25 17:42:07 +02:00
nielsAD 6e346487b8 Fixed THISCALL/FASTCALL closures and added basic support for PASCAL/REGISTER closures. 2014-08-25 12:23:29 +02:00
nielsAD 098dca6b31 Support for calling functions with PASCAL and REGISTER calling conventions on x86 Windows/Linux.
Also changed indentation to be more consistent throughout the (adjusted) files.
2014-08-24 14:29:38 +02:00
Josh Triplett d36952273d Support fastcall closures
libffi on 32-bit x86 now supports closures for all supported ABIs.
Thus, rewrite the last remaining duplicated-by-ABI test (closure_stdcall
and closure_thiscall) to use the generic ABI_NUM/ABI_ATTR mechanism.
2014-04-20 17:08:37 -07:00
Ole André Vadla Ravnås 3e2b84d295 Fix Windows regression
Introduced by b5fed60194.
2014-04-12 01:06:09 +02:00
Josh Triplett b5fed60194 Fix ABI on 32-bit non-Windows x86: go back to trampoline size 10
The trampoline size is part of the ABI, so it cannot change.  Move the
logic from the stdcall and thiscall trampolines to the functions they
call, to reduce them both to 10 bytes.

This drops the previously added support for raw THISCALL closures on
non-Windows.  (Non-raw THISCALL closures still work.)
2014-04-05 17:33:42 -07:00
Josh Triplett 56be47f876 Fix a warning on 64-bit Windows
When sizeof(size_t) != sizeof(unsigned), adding a size_t to cif->bytes
produces a "possible loss of data" warning.  However, the size_t in
question refers to the size of a single parameter.  Use a cast to avoid
the warning.
2014-03-24 21:24:53 -07:00
Josh Triplett 48a8eda74a Avoid referencing undefined ABIs on 64-bit Windows builds
64-bit Windows does not have FFI_STDCALL, FFI_THISCALL, or FFI_FASTCALL.
2014-03-24 21:21:12 -07:00
Josh Triplett e1911f78df Add support for stdcall, thiscall, and fastcall on non-Windows x86-32
Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.

This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
2014-03-16 05:05:06 -07:00
Zachary Waldowski 1367534158 Darwin/i386: Inhibit Clang previous prototype warnings 2014-02-05 14:28:53 -05:00
Anthony Green 3dc3f32c35 Undo iOS ARM64 changes. 2013-12-05 16:23:25 -05:00
Zachary Waldowski 16ba1b8002 Darwin: Silence Clang warnings. 2013-11-30 03:47:58 -05:00
Vitaly Budovski 6aa15900ac Don't use 16 byte aligned stack for WIN32
This fixes a crash when accessing __stdcall functions in Python ctypes.
2013-09-05 12:05:06 +10:00
Alex Gaynor ee18766b16 Fix for a crasher due to misaligned stack on x86-32.
Full information on reproduction (using Python's ctypes available here: http://bugs.python.org/issue17423)
2013-03-14 15:00:33 -07:00
Anthony Green 2d9b393975 Fix for closures with sunpro compiler 2013-01-09 21:14:54 -05:00
Zachary Waldowski 39dccddb60 Fix building with Clang for Darwin (OS X 10.6+ and iOS
4.0+)
2012-04-05 12:32:41 -04:00
Peter Rosin 0a1ab12a8d Various MSVC-related changes. 2012-03-30 08:14:08 -04:00
Anthony Green 7c5e60b5f4 Rebase on fixed GCC sources 2012-03-29 08:48:22 -04:00
Anthony Green dee20f8e45 Rebased from gcc 2012-02-10 13:06:46 -05:00
Anthony Green 1ff9c604bb Rebase from GCC 2012-02-01 16:34:30 -06:00
Anthony Green 0e5843995f Refresh from GCC 2011-02-08 07:52:40 -05:00
Anthony Green c1d28ba8d5 stdcall-x86-closure-fix 2010-08-05 08:48:16 -04:00
Anthony Green 10ea848900 don't copy win64 struct args 2010-08-05 08:24:27 -04:00
Anthony Green f2c2a4fce9 Remove warnings and add OS/2 support 2010-04-13 10:19:28 -04:00
Anthony Green 3de1eb36d3 fix-comments patch 2010-03-15 05:57:24 -04:00
Anthony Green cadeba6cb5 Microsoft Visual C port 2010-01-15 10:46:51 -05:00
Anthony Green c6dddbd02b Initial commit 2009-10-04 08:11:33 -04:00