summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnthony Green <green@moxielogic.com>2018-03-16 17:53:33 -0400
committerAnthony Green <green@moxielogic.com>2018-03-16 17:53:33 -0400
commit6a801d042ac1212fe8c0e11abb865061e515aa43 (patch)
tree5ae79e3b2229114974e0b27249b07cf0a747cf55 /src
parent0f0ba9e0ec52e0297c91cb63a889980a6f847219 (diff)
downloadlibffi-6a801d042ac1212fe8c0e11abb865061e515aa43.tar.gz
Fix closure case where 8-byte value is partially passed in register. Fixes cls_many_mixed_float_double test case.
Diffstat (limited to 'src')
-rw-r--r--src/moxie/ffi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/moxie/ffi.c b/src/moxie/ffi.c
index 29209b4..0846b27 100644
--- a/src/moxie/ffi.c
+++ b/src/moxie/ffi.c
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
- ffi.c - Copyright (C) 2012, 2013 Anthony Green
+ ffi.c - Copyright (C) 2012, 2013, 2018 Anthony Green
Moxie Foreign Function Interface
@@ -159,7 +159,7 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
unsigned arg4, unsigned arg5, unsigned arg6)
{
/* This function is called by a trampoline. The trampoline stows a
- pointer to the ffi_closure object in $r7. We must save this
+ pointer to the ffi_closure object in $r12. We must save this
pointer in a place that will persist while we do our work. */
register ffi_closure *creg __asm__ ("$r12");
ffi_closure *closure = creg;
@@ -225,6 +225,8 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
start looking at the those passed on the stack. */
if (ptr == &register_args[6])
ptr = stack_args;
+ else if (ptr == &register_args[7])
+ ptr = stack_args + 4;
}
/* Invoke the closure. */
@@ -257,7 +259,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
fn = (unsigned long) ffi_closure_eabi;
- tramp[0] = 0x01e0; /* ldi.l $r7, .... */
+ tramp[0] = 0x01e0; /* ldi.l $r12, .... */
tramp[1] = cls >> 16;
tramp[2] = cls & 0xffff;
tramp[3] = 0x1a00; /* jmpa .... */