summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-07-21 19:54:52 +0200
committerArmin Rigo <arigo@tunes.org>2020-07-21 19:54:52 +0200
commit1a1e1e6ee5c4a7411a7ce8c319739ccab0eb4035 (patch)
tree3c23ecc20b6aa980d7566ae82956509a2ab0f539 /c
parent5e2c0f61537ee5cce787c0baceabc050917401da (diff)
downloadcffi-1a1e1e6ee5c4a7411a7ce8c319739ccab0eb4035.tar.gz
#465 Callback returning non-small struct failed on Windows
Diffstat (limited to 'c')
-rw-r--r--c/libffi_msvc/ffi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/c/libffi_msvc/ffi.c b/c/libffi_msvc/ffi.c
index edae9e5..dab2b50 100644
--- a/c/libffi_msvc/ffi.c
+++ b/c/libffi_msvc/ffi.c
@@ -289,16 +289,12 @@ ffi_closure_SYSV (ffi_closure *closure, char *argp)
_asm fld DWORD PTR [eax] ;
// asm ("flds (%0)" : : "r" (resp) : "st" );
}
- else if (rtype == FFI_TYPE_DOUBLE)
+ else if (rtype == FFI_TYPE_DOUBLE || rtype == FFI_TYPE_LONGDOUBLE)
{
_asm mov eax, resp ;
_asm fld QWORD PTR [eax] ;
// asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
}
- else if (rtype == FFI_TYPE_LONGDOUBLE)
- {
-// asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
- }
else if (rtype == FFI_TYPE_SINT64)
{
_asm mov edx, resp ;
@@ -309,6 +305,10 @@ ffi_closure_SYSV (ffi_closure *closure, char *argp)
// : : "r"(resp)
// : "eax", "edx");
}
+ else if (rtype == FFI_TYPE_STRUCT)
+ {
+ _asm mov eax, resp ;
+ }
#else
/* now, do a generic return based on the value of rtype */
if (rtype == FFI_TYPE_INT)
@@ -319,14 +319,10 @@ ffi_closure_SYSV (ffi_closure *closure, char *argp)
{
asm ("flds (%0)" : : "r" (resp) : "st" );
}
- else if (rtype == FFI_TYPE_DOUBLE)
+ else if (rtype == FFI_TYPE_DOUBLE || rtype == FFI_TYPE_LONGDOUBLE)
{
asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
}
- else if (rtype == FFI_TYPE_LONGDOUBLE)
- {
- asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
- }
else if (rtype == FFI_TYPE_SINT64)
{
asm ("movl 0(%0),%%eax;"
@@ -334,6 +330,10 @@ ffi_closure_SYSV (ffi_closure *closure, char *argp)
: : "r"(resp)
: "eax", "edx");
}
+ else if (rtype == FFI_TYPE_STRUCT)
+ {
+ asm ("movl %0,%%eax" : : "r" (resp) : "eax");
+ }
#endif
#endif