ffi 0.5.4-x86-mswin32 → 0.6.3-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- data/History.txt +102 -0
- data/LICENSE +1 -27
- data/Rakefile +4 -12
- data/ext/ffi_c/AbstractMemory.c +6 -8
- data/ext/ffi_c/AbstractMemory.h +23 -21
- data/ext/ffi_c/AutoPointer.c +0 -1
- data/ext/ffi_c/Buffer.c +23 -8
- data/ext/ffi_c/Call.c +31 -3
- data/ext/ffi_c/Call.h +5 -1
- data/ext/ffi_c/DynamicLibrary.c +0 -1
- data/ext/ffi_c/Function.c +22 -4
- data/ext/ffi_c/MemoryPointer.c +2 -3
- data/ext/ffi_c/Pointer.c +23 -9
- data/ext/ffi_c/Struct.c +227 -79
- data/ext/ffi_c/Struct.h +16 -7
- data/ext/ffi_c/StructLayout.c +92 -55
- data/ext/ffi_c/Type.c +5 -22
- data/ext/ffi_c/Type.h +1 -1
- data/ext/ffi_c/Types.c +9 -3
- data/ext/ffi_c/Types.h +2 -0
- data/ext/ffi_c/extconf.rb +11 -7
- data/ext/ffi_c/libffi.gnu.mk +1 -1
- data/ext/ffi_c/libffi.mk +1 -1
- data/ext/ffi_c/libffi/ChangeLog +900 -84
- data/ext/ffi_c/libffi/ChangeLog.libffi +311 -0
- data/ext/ffi_c/libffi/LICENSE +1 -1
- data/ext/ffi_c/libffi/Makefile.am +14 -4
- data/ext/ffi_c/libffi/Makefile.in +362 -211
- data/ext/ffi_c/libffi/README +70 -92
- data/ext/ffi_c/libffi/aclocal.m4 +6068 -4586
- data/ext/ffi_c/libffi/config.guess +125 -143
- data/ext/ffi_c/libffi/config.sub +103 -27
- data/ext/ffi_c/libffi/configure +11340 -18473
- data/ext/ffi_c/libffi/configure.ac +43 -4
- data/ext/ffi_c/libffi/doc/libffi.info +15 -15
- data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
- data/ext/ffi_c/libffi/doc/stamp-vti +4 -4
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +24 -3
- data/ext/ffi_c/libffi/include/Makefile.am +1 -1
- data/ext/ffi_c/libffi/include/Makefile.in +97 -50
- data/ext/ffi_c/libffi/include/ffi.h.in +8 -2
- data/ext/ffi_c/libffi/include/ffi_common.h +24 -0
- data/ext/ffi_c/libffi/libtool-version +1 -1
- data/ext/ffi_c/libffi/ltmain.sh +7346 -5870
- data/ext/ffi_c/libffi/m4/libtool.m4 +7360 -0
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +368 -0
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +123 -0
- data/ext/ffi_c/libffi/m4/ltversion.m4 +23 -0
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +92 -0
- data/ext/ffi_c/libffi/man/Makefile.in +115 -62
- data/ext/ffi_c/libffi/man/ffi_call.3 +3 -3
- data/ext/ffi_c/libffi/missing +15 -8
- data/ext/ffi_c/libffi/src/arm/sysv.S +15 -8
- data/ext/ffi_c/libffi/src/avr32/ffi.c +421 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +50 -0
- data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
- data/ext/ffi_c/libffi/src/closures.c +47 -10
- data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
- data/ext/ffi_c/libffi/src/java_raw_api.c +0 -3
- data/ext/ffi_c/libffi/src/mips/ffi.c +135 -32
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +37 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +67 -10
- data/ext/ffi_c/libffi/src/mips/o32.S +8 -8
- data/ext/ffi_c/libffi/src/pa/ffi.c +7 -0
- data/ext/ffi_c/libffi/src/powerpc/aix.S +163 -64
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +308 -112
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +20 -7
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +208 -80
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +11 -3
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +12 -23
- data/ext/ffi_c/libffi/src/s390/sysv.S +1 -1
- data/ext/ffi_c/libffi/src/sh/sysv.S +9 -9
- data/ext/ffi_c/libffi/src/sh64/ffi.c +37 -22
- data/ext/ffi_c/libffi/src/sh64/sysv.S +23 -14
- data/ext/ffi_c/libffi/src/sparc/ffi.c +21 -6
- data/ext/ffi_c/libffi/src/sparc/v8.S +55 -14
- data/ext/ffi_c/libffi/src/x86/darwin.S +10 -9
- data/ext/ffi_c/libffi/src/x86/ffi.c +293 -86
- data/ext/ffi_c/libffi/src/x86/ffi64.c +73 -19
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +30 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +21 -4
- data/ext/ffi_c/libffi/src/x86/unix64.S +8 -4
- data/ext/ffi_c/libffi/src/x86/win32.S +633 -147
- data/ext/ffi_c/libffi/src/x86/win64.S +460 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +63 -54
- data/ext/ffi_c/libffi/testsuite/Makefile.in +112 -77
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +12 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +4 -4
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +7 -14
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c +6 -14
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +11 -17
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +7 -15
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +4 -13
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +105 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +140 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +8 -16
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +25 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +31 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +2 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +342 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +4 -12
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +145 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +148 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +4 -5
- data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc +17 -16
- data/ext/ffi_c/libffi/texinfo.tex +155 -427
- data/gen/Rakefile +4 -2
- data/lib/1.8/ffi_c.so +0 -0
- data/lib/1.9/ffi_c.so +0 -0
- data/lib/ffi/autopointer.rb +79 -20
- data/lib/ffi/callback.rb +4 -10
- data/lib/ffi/enum.rb +28 -0
- data/lib/ffi/ffi.rb +1 -0
- data/lib/ffi/io.rb +28 -0
- data/lib/ffi/library.rb +237 -182
- data/lib/ffi/memorypointer.rb +28 -62
- data/lib/ffi/platform.rb +27 -0
- data/lib/ffi/pointer.rb +28 -0
- data/lib/ffi/struct.rb +55 -1
- data/lib/ffi/types.rb +29 -0
- data/lib/ffi/variadic.rb +29 -0
- data/spec/ffi/library_spec.rb +31 -5
- data/spec/ffi/rbx/attach_function_spec.rb +2 -1
- data/spec/ffi/rbx/memory_pointer_spec.rb +2 -1
- data/spec/ffi/spec_helper.rb +5 -1
- data/spec/ffi/struct_spec.rb +82 -0
- data/tasks/ann.rake +80 -0
- data/tasks/extension.rake +25 -0
- data/tasks/gem.rake +200 -0
- data/tasks/git.rake +41 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +34 -0
- data/tasks/rdoc.rake +50 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +300 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- metadata +312 -279
- data/ext/ffi_c/libffi/TODO +0 -1
- data/ext/ffi_c/libffi/ltcf-c.sh +0 -861
- data/ext/ffi_c/libffi/ltcf-cxx.sh +0 -1069
- data/ext/ffi_c/libffi/ltcf-gcj.sh +0 -700
- data/ext/ffi_c/libffi/ltconfig +0 -2862
- data/ext/ffi_c/libffi/mkinstalldirs +0 -158
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -----------------------------------------------------------------*-C-*-
|
2
2
|
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
|
3
|
-
Copyright (C) 2007 Free Software Foundation, Inc
|
3
|
+
Copyright (C) 2007, 2008 Free Software Foundation, Inc
|
4
4
|
Target configuration macros for PowerPC.
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining
|
@@ -30,7 +30,11 @@
|
|
30
30
|
|
31
31
|
/* ---- System specific configurations ----------------------------------- */
|
32
32
|
|
33
|
-
#if defined (POWERPC) && defined (__powerpc64__)
|
33
|
+
#if defined (POWERPC) && defined (__powerpc64__) /* linux64 */
|
34
|
+
#define POWERPC64
|
35
|
+
#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */
|
36
|
+
#define POWERPC64
|
37
|
+
#elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */
|
34
38
|
#define POWERPC64
|
35
39
|
#endif
|
36
40
|
|
@@ -78,6 +82,8 @@ typedef enum ffi_abi {
|
|
78
82
|
FFI_SYSV,
|
79
83
|
FFI_GCC_SYSV,
|
80
84
|
FFI_LINUX64,
|
85
|
+
FFI_LINUX,
|
86
|
+
FFI_LINUX_SOFT_FLOAT,
|
81
87
|
FFI_DEFAULT_ABI = FFI_SYSV,
|
82
88
|
#endif
|
83
89
|
|
@@ -96,7 +102,9 @@ typedef enum ffi_abi {
|
|
96
102
|
/* Needed for soft-float long-double-128 support. */
|
97
103
|
#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
|
98
104
|
|
99
|
-
/* Needed for FFI_SYSV small structure returns.
|
105
|
+
/* Needed for FFI_SYSV small structure returns.
|
106
|
+
We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are
|
107
|
+
defined in ffi.c, to determine the exact return type and its size. */
|
100
108
|
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
|
101
109
|
|
102
110
|
#if defined(POWERPC64) || defined(POWERPC_AIX)
|
@@ -136,29 +136,18 @@ L(float_return_value):
|
|
136
136
|
b L(done_return_value)
|
137
137
|
|
138
138
|
L(small_struct_return_value):
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
rlwinm %r5,%r31,5+23,32-5,31 /* Extract the value to shift. */
|
152
|
-
cmpwi %r5,0
|
153
|
-
subfic %r9,%r5,32
|
154
|
-
slw %r29,%r3,%r5
|
155
|
-
srw %r9,%r4,%r9
|
156
|
-
beq- L(smst_8byte)
|
157
|
-
or %r3,%r9,%r29
|
158
|
-
slw %r4,%r4,%r5
|
159
|
-
L(smst_8byte):
|
160
|
-
stw %r3,0(%r30)
|
161
|
-
stw %r4,4(%r30)
|
139
|
+
extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */
|
140
|
+
mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */
|
141
|
+
extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */
|
142
|
+
subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */
|
143
|
+
bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */
|
144
|
+
/* smst_one_register: */
|
145
|
+
slw %r3,%r3,%r5 /* Left-justify value in r3 */
|
146
|
+
mtxer %r6 /* move byte count to XER ... */
|
147
|
+
stswx %r3,0,%r30 /* ... and store that many bytes */
|
148
|
+
bf+ 26,L(done_return_value) /* struct in r3:r4 ? */
|
149
|
+
add %r6,%r6,%r30 /* adjust pointer */
|
150
|
+
stswi %r4,%r6,4 /* store last four bytes */
|
162
151
|
b L(done_return_value)
|
163
152
|
|
164
153
|
.LFE1:
|
@@ -14,14 +14,14 @@
|
|
14
14
|
The above copyright notice and this permission notice shall be included
|
15
15
|
in all copies or substantial portions of the Software.
|
16
16
|
|
17
|
-
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
18
|
-
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
21
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
22
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
24
|
+
DEALINGS IN THE SOFTWARE.
|
25
25
|
----------------------------------------------------------------------- */
|
26
26
|
|
27
27
|
#define LIBFFI_ASM
|
@@ -705,7 +705,7 @@ L_case_v:
|
|
705
705
|
#if defined __ELF__ && defined __linux__
|
706
706
|
.section .note.GNU-stack,"",@progbits
|
707
707
|
#endif
|
708
|
-
|
708
|
+
|
709
709
|
.section ".eh_frame","aw",@progbits
|
710
710
|
__FRAME_BEGIN__:
|
711
711
|
.4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
ffi.c - Copyright (c) 2003, 2004 Kaz Kojima
|
2
|
+
ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima
|
3
3
|
Copyright (c) 2008 Anthony Green
|
4
4
|
|
5
5
|
SuperH SHmedia Foreign Function Interface
|
@@ -56,9 +56,7 @@ return_type (ffi_type *arg)
|
|
56
56
|
/* ffi_prep_args is called by the assembly routine once stack space
|
57
57
|
has been allocated for the function's arguments */
|
58
58
|
|
59
|
-
/*@-exportheader@*/
|
60
59
|
void ffi_prep_args(char *stack, extended_cif *ecif)
|
61
|
-
/*@=exportheader@*/
|
62
60
|
{
|
63
61
|
register unsigned int i;
|
64
62
|
register unsigned int avn;
|
@@ -162,6 +160,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|
162
160
|
int n, m;
|
163
161
|
int greg;
|
164
162
|
int freg;
|
163
|
+
int fpair = -1;
|
165
164
|
|
166
165
|
greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0);
|
167
166
|
freg = 0;
|
@@ -177,7 +176,13 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|
177
176
|
cif->bytes += sizeof (UINT64) - sizeof (float);
|
178
177
|
if (freg >= NFREGARG - 1)
|
179
178
|
continue;
|
180
|
-
|
179
|
+
if (fpair < 0)
|
180
|
+
{
|
181
|
+
fpair = freg;
|
182
|
+
freg += 2;
|
183
|
+
}
|
184
|
+
else
|
185
|
+
fpair = -1;
|
181
186
|
cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++);
|
182
187
|
break;
|
183
188
|
|
@@ -186,7 +191,6 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|
186
191
|
continue;
|
187
192
|
if ((freg + 1) < NFREGARG)
|
188
193
|
{
|
189
|
-
freg = (freg + 1) & ~1;
|
190
194
|
freg += 2;
|
191
195
|
cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++);
|
192
196
|
}
|
@@ -264,9 +268,7 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
|
|
264
268
|
else if ((rvalue == NULL) &&
|
265
269
|
(cif->rtype->type == FFI_TYPE_STRUCT))
|
266
270
|
{
|
267
|
-
/*@-sysunrecog@*/
|
268
271
|
ecif.rvalue = alloca(cif->rtype->size);
|
269
|
-
/*@=sysunrecog@*/
|
270
272
|
}
|
271
273
|
else
|
272
274
|
ecif.rvalue = rvalue;
|
@@ -274,10 +276,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
|
|
274
276
|
switch (cif->abi)
|
275
277
|
{
|
276
278
|
case FFI_SYSV:
|
277
|
-
|
278
|
-
|
279
|
-
cif->flags, cif->flags2, ecif.rvalue, fn);
|
280
|
-
/*@=usedef@*/
|
279
|
+
ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2,
|
280
|
+
ecif.rvalue, fn);
|
281
281
|
break;
|
282
282
|
default:
|
283
283
|
FFI_ASSERT(0);
|
@@ -294,10 +294,11 @@ extern void ffi_closure_SYSV (void);
|
|
294
294
|
extern void __ic_invalidate (void *line);
|
295
295
|
|
296
296
|
ffi_status
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
297
|
+
ffi_prep_closure_loc (ffi_closure *closure,
|
298
|
+
ffi_cif *cif,
|
299
|
+
void (*fun)(ffi_cif*, void*, void**, void*),
|
300
|
+
void *user_data,
|
301
|
+
void *codeloc)
|
301
302
|
{
|
302
303
|
unsigned int *tramp;
|
303
304
|
|
@@ -321,8 +322,8 @@ ffi_prep_closure (ffi_closure *closure,
|
|
321
322
|
tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10;
|
322
323
|
tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10;
|
323
324
|
tramp[4] = 0x6bf10600;
|
324
|
-
tramp[5] = 0xcc000010 | (((UINT32)
|
325
|
-
tramp[6] = 0xc8000010 | (((UINT32)
|
325
|
+
tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10;
|
326
|
+
tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10;
|
326
327
|
tramp[7] = 0x4401fff0;
|
327
328
|
|
328
329
|
closure->cif = cif;
|
@@ -330,7 +331,8 @@ ffi_prep_closure (ffi_closure *closure,
|
|
330
331
|
closure->user_data = user_data;
|
331
332
|
|
332
333
|
/* Flush the icache. */
|
333
|
-
asm volatile ("ocbwb %0,0; synco; icbi %
|
334
|
+
asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp),
|
335
|
+
"r"(codeloc));
|
334
336
|
|
335
337
|
return FFI_OK;
|
336
338
|
}
|
@@ -352,6 +354,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue,
|
|
352
354
|
int i, avn;
|
353
355
|
int greg, freg;
|
354
356
|
ffi_cif *cif;
|
357
|
+
int fpair = -1;
|
355
358
|
|
356
359
|
cif = closure->cif;
|
357
360
|
avalue = alloca (cif->nargs * sizeof (void *));
|
@@ -360,7 +363,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue,
|
|
360
363
|
returns the data directly to the caller. */
|
361
364
|
if (return_type (cif->rtype) == FFI_TYPE_STRUCT)
|
362
365
|
{
|
363
|
-
rvalue = *pgr;
|
366
|
+
rvalue = (UINT64 *) *pgr;
|
364
367
|
greg = 1;
|
365
368
|
}
|
366
369
|
else
|
@@ -404,11 +407,24 @@ ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue,
|
|
404
407
|
if ((*p_arg)->type == FFI_TYPE_FLOAT)
|
405
408
|
{
|
406
409
|
if (freg < NFREGARG - 1)
|
410
|
+
{
|
411
|
+
if (fpair >= 0)
|
412
|
+
{
|
413
|
+
avalue[i] = (UINT32 *) pfr + fpair;
|
414
|
+
fpair = -1;
|
415
|
+
}
|
416
|
+
else
|
417
|
+
{
|
407
418
|
#ifdef __LITTLE_ENDIAN__
|
408
|
-
|
419
|
+
fpair = freg;
|
420
|
+
avalue[i] = (UINT32 *) pfr + (1 ^ freg);
|
409
421
|
#else
|
410
|
-
|
422
|
+
fpair = 1 ^ freg;
|
423
|
+
avalue[i] = (UINT32 *) pfr + freg;
|
411
424
|
#endif
|
425
|
+
freg += 2;
|
426
|
+
}
|
427
|
+
}
|
412
428
|
else
|
413
429
|
#ifdef __LITTLE_ENDIAN__
|
414
430
|
avalue[i] = pgr + greg;
|
@@ -430,7 +446,6 @@ ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue,
|
|
430
446
|
avalue[i] = pgr + greg;
|
431
447
|
else
|
432
448
|
{
|
433
|
-
freg = (freg + 1) & ~1;
|
434
449
|
avalue[i] = pfr + (freg >> 1);
|
435
450
|
freg += 2;
|
436
451
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
sysv.S - Copyright (c) 2003, 2004, 2008 Kaz Kojima
|
2
|
+
sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima
|
3
3
|
|
4
4
|
SuperH SHmedia Foreign Function Interface
|
5
5
|
|
@@ -14,14 +14,15 @@
|
|
14
14
|
The above copyright notice and this permission notice shall be included
|
15
15
|
in all copies or substantial portions of the Software.
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
25
|
+
DEALINGS IN THE SOFTWARE.
|
25
26
|
----------------------------------------------------------------------- */
|
26
27
|
|
27
28
|
#define LIBFFI_ASM
|
@@ -85,6 +86,7 @@ ENTRY(ffi_call_SYSV)
|
|
85
86
|
addi r15, 64, r22
|
86
87
|
movi 0, r0
|
87
88
|
movi 0, r1
|
89
|
+
movi -1, r23
|
88
90
|
|
89
91
|
pt/l 1f, tr1
|
90
92
|
bnei/l r29, FFI_TYPE_STRUCT, tr1
|
@@ -107,9 +109,6 @@ ENTRY(ffi_call_SYSV)
|
|
107
109
|
|
108
110
|
.L_pass_d:
|
109
111
|
addi r0, 1, r0
|
110
|
-
addi r1, 1, r1
|
111
|
-
andi r1, ~1, r1
|
112
|
-
|
113
112
|
pt/l 3f, tr0
|
114
113
|
movi 12, r20
|
115
114
|
bge/l r1, r20, tr0
|
@@ -159,13 +158,23 @@ ENTRY(ffi_call_SYSV)
|
|
159
158
|
addi.l r15, 8, r15
|
160
159
|
3:
|
161
160
|
pt/l .L_pass, tr0
|
162
|
-
addi r1, 1, r1
|
163
161
|
blink tr0, r63
|
164
162
|
|
165
163
|
.L_pop_f:
|
166
164
|
pt/l .L_pop_f_tbl, tr1
|
165
|
+
pt/l 5f, tr2
|
167
166
|
gettr tr1, r20
|
167
|
+
bge/l r23, r63, tr2
|
168
|
+
add r1, r63, r23
|
168
169
|
shlli r1, 3, r21
|
170
|
+
addi r1, 2, r1
|
171
|
+
add r20, r21, r20
|
172
|
+
ptabs/l r20, tr1
|
173
|
+
blink tr1, r63
|
174
|
+
5:
|
175
|
+
addi r23, 1, r21
|
176
|
+
movi -1, r23
|
177
|
+
shlli r21, 3, r21
|
169
178
|
add r20, r21, r20
|
170
179
|
ptabs/l r20, tr1
|
171
180
|
blink tr1, r63
|
@@ -433,7 +442,7 @@ ENTRY(ffi_closure_SYSV)
|
|
433
442
|
#if defined __ELF__ && defined __linux__
|
434
443
|
.section .note.GNU-stack,"",@progbits
|
435
444
|
#endif
|
436
|
-
|
445
|
+
|
437
446
|
.section ".eh_frame","aw",@progbits
|
438
447
|
__FRAME_BEGIN__:
|
439
448
|
.4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */
|
@@ -308,14 +308,24 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|
308
308
|
cif->flags = FFI_TYPE_STRUCT;
|
309
309
|
break;
|
310
310
|
|
311
|
+
case FFI_TYPE_SINT8:
|
312
|
+
case FFI_TYPE_UINT8:
|
313
|
+
case FFI_TYPE_SINT16:
|
314
|
+
case FFI_TYPE_UINT16:
|
315
|
+
if (cif->abi == FFI_V9)
|
316
|
+
cif->flags = FFI_TYPE_INT;
|
317
|
+
else
|
318
|
+
cif->flags = cif->rtype->type;
|
319
|
+
break;
|
320
|
+
|
311
321
|
case FFI_TYPE_SINT64:
|
312
322
|
case FFI_TYPE_UINT64:
|
313
|
-
if (cif->abi
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
323
|
+
if (cif->abi == FFI_V9)
|
324
|
+
cif->flags = FFI_TYPE_INT;
|
325
|
+
else
|
326
|
+
cif->flags = FFI_TYPE_SINT64;
|
327
|
+
break;
|
328
|
+
|
319
329
|
default:
|
320
330
|
cif->flags = FFI_TYPE_INT;
|
321
331
|
break;
|
@@ -589,6 +599,11 @@ ffi_closure_sparc_inner_v9(ffi_closure *closure,
|
|
589
599
|
/* Right-justify. */
|
590
600
|
argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
|
591
601
|
|
602
|
+
/* Align on a 16-byte boundary. */
|
603
|
+
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
604
|
+
if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0)
|
605
|
+
argn++;
|
606
|
+
#endif
|
592
607
|
if (i < fp_slot_max
|
593
608
|
&& (arg_types[i]->type == FFI_TYPE_FLOAT
|
594
609
|
|| arg_types[i]->type == FFI_TYPE_DOUBLE
|
@@ -73,21 +73,63 @@ _ffi_call_v8:
|
|
73
73
|
be,a done
|
74
74
|
st %f0, [%i4+0] ! (delay)
|
75
75
|
|
76
|
+
cmp %i3, FFI_TYPE_DOUBLE
|
77
|
+
be,a double
|
78
|
+
st %f0, [%i4+0] ! (delay)
|
79
|
+
|
80
|
+
cmp %i3, FFI_TYPE_SINT8
|
81
|
+
be,a sint8
|
82
|
+
sll %o0, 24, %o0 ! (delay)
|
83
|
+
|
84
|
+
cmp %i3, FFI_TYPE_UINT8
|
85
|
+
be,a uint8
|
86
|
+
sll %o0, 24, %o0 ! (delay)
|
87
|
+
|
88
|
+
cmp %i3, FFI_TYPE_SINT16
|
89
|
+
be,a sint16
|
90
|
+
sll %o0, 16, %o0 ! (delay)
|
91
|
+
|
92
|
+
cmp %i3, FFI_TYPE_UINT16
|
93
|
+
be,a uint16
|
94
|
+
sll %o0, 16, %o0 ! (delay)
|
95
|
+
|
76
96
|
cmp %i3, FFI_TYPE_SINT64
|
77
|
-
be longlong
|
97
|
+
be,a longlong
|
98
|
+
st %o0, [%i4+0] ! (delay)
|
99
|
+
done:
|
100
|
+
ret
|
101
|
+
restore
|
78
102
|
|
79
|
-
|
80
|
-
bne done
|
81
|
-
nop
|
82
|
-
st %f0, [%i4+0]
|
103
|
+
double:
|
83
104
|
st %f1, [%i4+4]
|
84
|
-
|
85
|
-
done:
|
86
105
|
ret
|
87
106
|
restore
|
88
107
|
|
89
|
-
|
108
|
+
sint8:
|
109
|
+
sra %o0, 24, %o0
|
110
|
+
st %o0, [%i4+0]
|
111
|
+
ret
|
112
|
+
restore
|
113
|
+
|
114
|
+
uint8:
|
115
|
+
srl %o0, 24, %o0
|
90
116
|
st %o0, [%i4+0]
|
117
|
+
ret
|
118
|
+
restore
|
119
|
+
|
120
|
+
sint16:
|
121
|
+
sra %o0, 16, %o0
|
122
|
+
st %o0, [%i4+0]
|
123
|
+
ret
|
124
|
+
restore
|
125
|
+
|
126
|
+
uint16:
|
127
|
+
srl %o0, 16, %o0
|
128
|
+
st %o0, [%i4+0]
|
129
|
+
ret
|
130
|
+
restore
|
131
|
+
|
132
|
+
longlong:
|
91
133
|
st %o1, [%i4+4]
|
92
134
|
ret
|
93
135
|
restore
|
@@ -148,7 +190,8 @@ ffi_closure_v8:
|
|
148
190
|
be done1
|
149
191
|
|
150
192
|
cmp %o0, FFI_TYPE_INT
|
151
|
-
be
|
193
|
+
be done1
|
194
|
+
ld [%fp-8], %i0
|
152
195
|
|
153
196
|
cmp %o0, FFI_TYPE_FLOAT
|
154
197
|
be,a done1
|
@@ -166,13 +209,11 @@ ffi_closure_v8:
|
|
166
209
|
cmp %o0, FFI_TYPE_STRUCT
|
167
210
|
be done2
|
168
211
|
|
169
|
-
|
170
|
-
|
171
|
-
|
212
|
+
cmp %o0, FFI_TYPE_SINT64
|
213
|
+
be,a done1
|
214
|
+
ldd [%fp-8], %i0
|
172
215
|
|
173
|
-
integer:
|
174
216
|
ld [%fp-8], %i0
|
175
|
-
|
176
217
|
done1:
|
177
218
|
jmp %i7+8
|
178
219
|
restore
|