diff options
author | Moxie Bot <bot@moxielogic.com> | 2020-02-24 10:29:20 -0500 |
---|---|---|
committer | Moxie Bot <bot@moxielogic.com> | 2020-02-24 10:29:20 -0500 |
commit | 8eb2d2b05626b1cbbed100725bc440709499e8a6 (patch) | |
tree | b71e350bbc76ee09c0d4c269d1a19d4cb38abe92 /include | |
parent | be815544c1588c6ca70120361c168b196376aa56 (diff) | |
download | libffi-8eb2d2b05626b1cbbed100725bc440709499e8a6.tar.gz |
Revamp PA_LINUX and PA_HPUX target closures to use function descriptors.
2020-02-23 John David Anglin <danglin@gcc.gnu.org>
* include/ffi.h.in (FFI_CLOSURE_PTR, FFI_RESTORE_PTR): Define.
* src/closures.c (ffi_closure_alloc): Convert closure pointer
return by malloc to function pointer.
(ffi_closure_free): Convert function pointer back to malloc pointer.
* src/pa/ffi.c (ffi_closure_inner_pa32): Use union to double word
align return address on stack. Adjust statements referencing return
address. Convert closure argument from function pointer to standard
closure pointer.
(ffi_prep_closure_loc): Likewise convert closure argument back to
closure pointer. Remove assembler trampolines. Setup simulated
function descriptor as on ia64.
src/pa/ffitarget.h (FFI_TRAMPOLINE_SIZE): Reduce to 12.
src/pa/hpux32.S (ffi_closure_pa32): Retrieve closure pointer and real
gp from fake gp value in register %r19.
src/pa/linux.S (ffi_closure_pa32): Likewise.
Diffstat (limited to 'include')
-rw-r--r-- | include/ffi.h.in | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/ffi.h.in b/include/ffi.h.in index 71cc05c..38885b0 100644 --- a/include/ffi.h.in +++ b/include/ffi.h.in @@ -330,6 +330,14 @@ typedef struct { FFI_API void *ffi_closure_alloc (size_t size, void **code); FFI_API void ffi_closure_free (void *); +#if defined(PA_LINUX) || defined(PA_HPUX) +#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2)) +#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3)) +#else +#define FFI_CLOSURE_PTR(X) (X) +#define FFI_RESTORE_PTR(X) (X) +#endif + FFI_API ffi_status ffi_prep_closure (ffi_closure*, ffi_cif *, |