#ifdef _WIN32
#include <windows.h> /* FlushInstructionCache */
#endif
+#include <tramp.h>
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
all further uses in this file will refer to the 128-bit type. */
extern void ffi_closure_SYSV (void) FFI_HIDDEN;
extern void ffi_closure_SYSV_V (void) FFI_HIDDEN;
+#if defined(FFI_EXEC_STATIC_TRAMP)
+extern void ffi_closure_SYSV_alt (void) FFI_HIDDEN;
+extern void ffi_closure_SYSV_V_alt (void) FFI_HIDDEN;
+#endif
ffi_status
ffi_prep_closure_loc (ffi_closure *closure,
0x00, 0x02, 0x1f, 0xd6 /* br x16 */
};
char *tramp = closure->tramp;
-
+
+#if defined(FFI_EXEC_STATIC_TRAMP)
+ if (ffi_tramp_is_present(closure))
+ {
+ /* Initialize the static trampoline's parameters. */
+ if (start == ffi_closure_SYSV_V)
+ start = ffi_closure_SYSV_V_alt;
+ else
+ start = ffi_closure_SYSV_alt;
+ ffi_tramp_set_parms (closure->ftramp, start, closure);
+ goto out;
+ }
+#endif
+
+ /* Initialize the dynamic trampoline. */
memcpy (tramp, trampoline, sizeof(trampoline));
*(UINT64 *)(tramp + 16) = (uintptr_t)start;
unsigned char *tramp_code = ffi_data_to_code_pointer (tramp);
#endif
ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE);
+out:
#endif
closure->cif = cif;
return flags;
}
+#if defined(FFI_EXEC_STATIC_TRAMP)
+void *
+ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
+{
+ extern void *trampoline_code_table;
+
+ *tramp_size = AARCH64_TRAMP_SIZE;
+ *map_size = AARCH64_TRAMP_MAP_SIZE;
+ return &trampoline_code_table;
+}
+#endif
+
#endif /* (__aarch64__) || defined(__arm64__)|| defined (_M_ARM64)*/