diff options
author | Landon Fuller <landonf@bikemonkey.org> | 2010-09-19 10:43:06 -0700 |
---|---|---|
committer | Landon Fuller <landonf@bikemonkey.org> | 2010-09-19 10:43:06 -0700 |
commit | 9e1196444e78aef20028c18891f44ebe39a815fd (patch) | |
tree | 9372769473b276b73589762f56404b3b443f3f50 /src/arm | |
parent | f38364b399184e682fc3e785084bd497827bc5af (diff) | |
download | libffi-9e1196444e78aef20028c18891f44ebe39a815fd.tar.gz |
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.
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/ffi.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/arm/ffi.c b/src/arm/ffi.c index f6a6475..7da69c1 100644 --- a/src/arm/ffi.c +++ b/src/arm/ffi.c @@ -297,10 +297,17 @@ ffi_prep_closure_loc (ffi_closure* closure, { FFI_ASSERT (cif->abi == FFI_SYSV); +#if FFI_EXEC_TRAMPOLINE_TABLE + // XXX - hardcoded offset + void **config = (void **) (((uint8_t *) codeloc) - 4080); + config[0] = closure; + config[1] = ffi_closure_SYSV; +#else FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ &ffi_closure_SYSV, \ codeloc); - +#endif + closure->cif = cif; closure->user_data = user_data; closure->fun = fun; |