Message165660
| Author |
Alex.Leach |
| Recipients |
Alex.Leach, Arfrever, jared.jennings, loewis, meador.inge, skrah, theller |
| Date |
2012年07月16日.22:16:02 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<2121850.oUxmvAAuKI@metabuntu> |
| In-reply-to |
<1342432416.64.0.83193886737.issue4130@psf.upfronthosting.co.za> |
| Content |
I just had a dig around my cpython build dir, and found an ffi64.c I hacked at a
while back.
I copied the edits over to the latest libffi git revision, rebuilt, and `make
check` (of libffi) passes all tests. So as far as I can tell the below patch
works, but it is a hack, and I'm sure it could be improved..
Regards to submitting it upstream, I've just written to the libffi-
discuss/sourceware.org mailing list, sending them the below patch also. So it
might work, but you know that GPL clause about coming with no warranty? ;)
HTH,
Alex
libffi-git> diff -u src/x86/ffi64.c.orig src/x86/ffi64.c
--- src/x86/ffi64.c.orig 2012年07月16日 11:38:34.681045084 +0100
+++ src/x86/ffi64.c 2012年07月16日 22:34:42.959552750 +0100
@@ -38,7 +38,7 @@
#define MAX_SSE_REGS 8
#ifdef __INTEL_COMPILER
-#define UINT128 __m128
+typedef struct { int64_t m[2]; } __int128_t;
#else
#define UINT128 __int128_t
#endif
@@ -47,7 +47,7 @@
{
/* Registers for argument passing. */
UINT64 gpr[MAX_GPR_REGS];
- UINT128 sse[MAX_SSE_REGS];
+ __int128_t sse[MAX_SSE_REGS];
};
extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@@ -477,10 +477,20 @@
break;
case X86_64_SSE_CLASS:
case X86_64_SSEDF_CLASS:
+#ifdef __INTEL_COMPILER
+ reg_args->sse[ssecount].m[0] = *(UINT64 *) a;
+ reg_args->sse[ssecount++].m[1] = 0;
+#else
reg_args->sse[ssecount++] = *(UINT64 *) a;
+#endif
break;
case X86_64_SSESF_CLASS:
+#ifdef __INTEL_COMPILER
+ reg_args->sse[ssecount].m[0] = *(UINT32 *) a;
+ reg_args->sse[ssecount++].m[1] = 0;
+#else
reg_args->sse[ssecount++] = *(UINT32 *) a;
+#endif
break;
default:
abort(); |
|