Commit Graph
47 Commits
Author SHA1 Message Date
Saleem Abdulrasool 3c372c384a arm: fix a level of indirection issue
Rather than relying on the stack being 0'ed out always, do it manually.
The stack generally happened to be zero, and because the compiler
realizes that the tests are dealing with chars truncates the read value.
However, the top 3 nibbles of the value are undefined and may be
non-zero.  The indirection level caused a null-pointer dereference.

Explicitly scribbling on the stack during the allocation causes test
failures without the original zexting behaviour.
2017-10-24 16:44:54 -07:00
Saleem Abdulrasool 7ad0ae7f42 arm: zext return value parameters
The closure function (invoked as closure->fun in ffi_closure_XXX_inner)
will only populate the actual number of bytes for the true return type,
which may be a character.  This leaves garbage on the stack when the
assembly closure function (i.e. ffi_closure_XXX) reads the return value
off of the stack into r0 as a 4-byte value.  ffi_closure_XXX always
leaves room for at least 4 bytes here, so we can safely set them to 0.
Otherwise, if there is garbage in any of these bytes, these end up in r0
and in the returned value as well.
2017-10-10 11:46:20 -07:00
Anthony Green 02a5145abb Merge pull request #263 from ksjogo/master
fix ios builds
2017-09-27 21:43:03 -04:00
Anthony Green 10099d6cad Merge pull request #271 from frida/fix/qnx-cache-flushing
arm: Fix cache flushing on QNX
2017-09-27 20:54:09 -04:00
Gregory Pakosz bd72848c7a Prefix ALIGN macros with FFI_ 2017-04-27 13:22:28 +02:00
Johannes Goslar 0040694505 Update Xcodeproj
Include all currently relevent files.
Call autogen is build script.
Fix compiler settings.
Fix mach include.
2017-03-30 13:26:15 +02:00
s1341 ed8488345e arm: Fix cache flushing on QNX
Use `msync()` directly as `__clear_cache()` is broken in the
qnx650_gcc4.8.3 toolchain.
2016-08-10 17:09:17 +02:00
Russell Keith-Magee bc4fc07aa5 Fixed #181 -- Corrected problems with ARMv7 build under iOS.
Based on a patch from @fealebenpae, with input from @SolaWing and @rth7680,
and testing from @superdump.
2015-12-21 00:37:06 +08:00
Richard Henderson ab83cbb90b arm: Add support for Go closures 2014-11-12 09:32:39 +01:00
Richard Henderson 6fa617dabc arm: Add argument space for the hidden struct return pointer
This should have been failing all along, but it's only
exposed by the complex_int test case.
2014-11-12 09:32:39 +01:00
Richard Henderson a529bec27b arm: Add support for complex types 2014-11-12 09:32:36 +01:00
Richard Henderson a4b785ea69 arm: Rewrite ffi_closure
Move the push of the argument registers into ffi_closure_SYSV,
reducing the size of the trampoline.
2014-11-12 09:32:13 +01:00
Richard Henderson e7f15f60e8 arm: Rewrite ffi_call
Use the trick to allocate the stack frame for ffi_call_SYSV
within ffi_call itself.
2014-11-12 09:32:13 +01:00
Richard Henderson a74a3aaddb arm: Rewrite vfp_type_p
Do not modify the ffi_type.  Rearrange the tests so that we
quickly eliminate structures that cannot match.  Return an
encoded value of element count and base type.
2014-11-12 09:32:13 +01:00
Richard Henderson 0d39b4bb69 arm: Deref ffi_put_arg arguments 2014-11-12 09:32:13 +01:00
Richard Henderson 57b24fb3f5 arm: Deref ffi_align argument 2014-11-12 09:32:13 +01:00
Richard Henderson c129bea82a arm: Reindent arm/ffi.c 2014-11-12 09:32:13 +01:00
Matthias Klose aaf3101ba8 Fix -Werror=declaration-after-statement problem 2014-09-20 06:37:04 -04:00
Zachary Waldowski 994be3a5c1 Darwin/iOS: Fix mis-typing of vfp_reg_free 2014-02-05 14:28:58 -05:00
Zachary Waldowski a8e0a835ab Darwin/ARM: Assert on NULL dereference
This inhibits an analyzer warning by Clang on all platforms.
2014-02-05 14:28:58 -05:00
Zachary Waldowski 66469c381e Darwin/ARM: Inhibit Clang previous prototype warnings 2014-02-05 14:28:49 -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
Anthony Green 2f450822a8 Clean up code to appease modern GCC compiler. 2013-11-18 06:52:29 -05:00
David Schneider 77f823e31f stop trying to assing vfp regs once we are done with the registers 2013-11-13 14:26:57 +01:00
David Schneider 37067ec503 mark all vfp registers as used when done.
To avoid assigning registers the would fit, once arguments have been on
the stack, we mark all registers as used once we do not find a free
register for the first time.
2013-11-12 19:49:01 +01:00
Anthony Green c2422174b3 Merge pull request #45 from foss-for-synopsys-dwc-arc-processors/arc_support
arc: Fix build error
2013-11-02 17:11:08 -04:00
Anthony Green 128cd1d2f3 Fix spelling errors 2013-10-08 06:45:51 -04:00
David Schneider 9708e7cf09 folow the ARM hard-float ABI in ffi_prep_incoming_args_VFP 2013-03-28 16:40:40 +01:00
David Schneider b41120981e create separated versions of ffi_prep_incoming_args_* for SYSV and VFP ABIs.
The different versions will be called depending on the value of cif->abi
2013-03-28 16:40:40 +01:00
David Schneider 3c1608613a extend ffi_prepare_args for FFI_VFP (hard-float ABI), fixing an issue with passing VFP arguments in VFP registers and the stack, while at the same time not using all core registers. 2013-03-28 16:38:28 +01:00
David Schneider 0f2ff2d4c9 separate ARM ffi_prepare_args in a version implementing the simple SYSV calling convention and one for the hard-float calling convention 2013-03-28 16:38:25 +01:00
David Schneider 3a352b8a82 move the hardfloat specific argument copying code to the helper function 2013-03-28 16:38:21 +01:00
David Schneider 5df6b7944a extract setting of arguments to be passed to a helper function 2013-03-28 16:38:15 +01:00
David Schneider 7d1048c471 extract code to align the argument storage pointer to a helper function 2013-03-28 16:38:10 +01:00
Anthony Green e1539266e6 ARM VFP fix for old toolchains 2012-03-30 00:40:18 -04:00
Anthony Green ff9454da44 Add David Gilbert's variadic function call support 2011-11-12 17:18:51 -05:00
Anthony Green 322052ce65 Fix arm wince alignment issue 2011-11-12 16:11:49 -05:00
Anthony Green 3d56106b07 Rebase 2011-11-12 07:20:24 -05:00
Anthony Green d992ac54a2 Refresh from GCC 2011-07-29 17:32:53 -04:00
Anthony Green 1fbf9dc44f Fix bad_abi test. rc5. 2011-02-13 08:06:39 -05:00
Anthony Green 0cad4386fa Add ChangeLog entry. Fix copyright headers. 2011-02-09 06:11:46 -05:00
Anthony Green 1106229a57 Add iOS support 2011-02-08 19:20:09 -05:00
Anthony Green 2db72615b5 Rebase 2010-11-21 10:50:56 -05:00
Landon Fuller 83038cf24a Implement FFI_EXEC_TRAMPOLINE_TABLE allocator for iOS/ARM.
This provides working closure support on iOS/ARM devices where
PROT_WRITE|PROT_EXEC is not permitted. The code passes basic
smoke tests, but requires further review.
2010-09-19 14:36:45 -07:00
Landon Fuller 9e1196444e Add a hard-coded FFI_EXEC_TRAMPOLINE_TABLE arm implementation.
This implements support for re-mapping a shared table of executable
trampolines directly in front of a writable configuration page, working
around PROT_WRITE restrictions for sandboxed applications on Apple's
iOS.

This implementation is for testing purposes; a proper allocator is still
necessary, and ARM-specific code needs to be moved out of
src/closures.c.
2010-09-19 10:43:06 -07:00
Anthony Green c6dddbd02b Initial commit 2009-10-04 08:11:33 -04:00