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.
This commit is contained in:
Landon Fuller
2010-09-19 10:43:06 -07:00
parent f38364b399
commit 9e1196444e
2 changed files with 92 additions and 3 deletions

View File

@@ -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;