diff options
author | Anthony Green <green@moxielogic.com> | 2018-04-08 18:25:34 -0400 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2018-04-08 18:25:34 -0400 |
commit | e27f70b8cf2a537bef84b2cb29ad8ea6209a11b8 (patch) | |
tree | 65caf9fd63df7dfe3f741bc46ba970049fdb053f | |
parent | 8660e6935971c5abd7b528eaf54deeccd4bbaccd (diff) | |
download | libffi-e27f70b8cf2a537bef84b2cb29ad8ea6209a11b8.tar.gz |
Fix case where callback arg value is split across regs and stack
-rw-r--r-- | src/moxie/ffi.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/moxie/ffi.c b/src/moxie/ffi.c index 0846b27..21144e8 100644 --- a/src/moxie/ffi.c +++ b/src/moxie/ffi.c @@ -215,7 +215,18 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, break; default: /* This is an 8-byte value. */ - avalue[i] = ptr; + if (ptr == (char *) ®ister_args[5]) + { + /* The value is split across two locations */ + unsigned *ip = alloca(8); + avalue[i] = ip; + ip[0] = *(unsigned *) ptr; + ip[1] = *(unsigned *) stack_args; + } + else + { + avalue[i] = ptr; + } ptr += 4; break; } @@ -223,9 +234,9 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ - if (ptr == ®ister_args[6]) + if (ptr == (char *) ®ister_args[6]) ptr = stack_args; - else if (ptr == ®ister_args[7]) + else if (ptr == (char *) ®ister_args[7]) ptr = stack_args + 4; } |