* src/alpha/ffitarget.h - FFI_TRAMPOLINE_SIZE
@ 2015-04-16 3:22 John E. Malmberg
2015-04-16 10:58 ` Jarkko Hietaniemi
0 siblings, 1 reply; 2+ messages in thread
From: John E. Malmberg @ 2015-04-16 3:22 UTC (permalink / raw)
To: libffi-discuss
I do not have a Tru64 system to test this on.
Looking at the code in src/alpha/ffitarget.h and src/alpha/ffi.c,
something does not look right.
FFI_TRAMPOLINE_SIZE is set to 24 in ffitarget.h
The typedef struct ffi_closure is then set up in ffi.h as:
typedef struct {
char tramp{FFI_TRAMPOLINE_SIZE];
ffi_cif * cif;
void (*fun)...
void *user_data
} ffi_closure
In ffi.c ffi_prep_closure_loc(), the code then does:
tramp = (unsigned int *) &closure->tramp[0];
....
*(void **) &tramp[4] = ffi_closure_osf;
But tramp only has 3 longword members per the previous declaration, so
&tramp[4] is the address of the '*cif' member of the structure which is
then updated:
closure->cif = cif;
Am I understanding this correctly?
Regards,
-John
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: src/alpha/ffitarget.h - FFI_TRAMPOLINE_SIZE
2015-04-16 3:22 src/alpha/ffitarget.h - FFI_TRAMPOLINE_SIZE John E. Malmberg
@ 2015-04-16 10:58 ` Jarkko Hietaniemi
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Hietaniemi @ 2015-04-16 10:58 UTC (permalink / raw)
To: libffi-discuss
On Wednesday-201504-15 23:20, John E. Malmberg wrote:
> tramp = (unsigned int *) &closure->tramp[0];
> ....
>
> *(void **) &tramp[4] = ffi_closure_osf;
>
> But tramp only has 3 longword members per the previous declaration, so
> &tramp[4] is the address of the '*cif' member of the structure which is
> then updated:
unsigned int is four bytes in alpha. (LP64, not ILP64).
So writing an 8-byte ptr at int offset 4 or byte offset 16
will update the bytes 16 to 23. Verified in an alpha, and
for that matter in an x86_64, which is LP64, too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-16 10:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 3:22 src/alpha/ffitarget.h - FFI_TRAMPOLINE_SIZE John E. Malmberg
2015-04-16 10:58 ` Jarkko Hietaniemi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).