ffi 0.5.4-x86-mingw32 → 0.6.3-x86-mingw32

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.

Files changed (222) hide show
  1. data/History.txt +102 -0
  2. data/LICENSE +1 -27
  3. data/Rakefile +4 -12
  4. data/ext/ffi_c/AbstractMemory.c +6 -8
  5. data/ext/ffi_c/AbstractMemory.h +23 -21
  6. data/ext/ffi_c/AutoPointer.c +0 -1
  7. data/ext/ffi_c/Buffer.c +23 -8
  8. data/ext/ffi_c/Call.c +31 -3
  9. data/ext/ffi_c/Call.h +5 -1
  10. data/ext/ffi_c/DynamicLibrary.c +0 -1
  11. data/ext/ffi_c/Function.c +22 -4
  12. data/ext/ffi_c/MemoryPointer.c +2 -3
  13. data/ext/ffi_c/Pointer.c +23 -9
  14. data/ext/ffi_c/Struct.c +227 -79
  15. data/ext/ffi_c/Struct.h +16 -7
  16. data/ext/ffi_c/StructLayout.c +92 -55
  17. data/ext/ffi_c/Type.c +5 -22
  18. data/ext/ffi_c/Type.h +1 -1
  19. data/ext/ffi_c/Types.c +9 -3
  20. data/ext/ffi_c/Types.h +2 -0
  21. data/ext/ffi_c/extconf.rb +11 -7
  22. data/ext/ffi_c/libffi.gnu.mk +1 -1
  23. data/ext/ffi_c/libffi.mk +1 -1
  24. data/ext/ffi_c/libffi/ChangeLog +900 -84
  25. data/ext/ffi_c/libffi/ChangeLog.libffi +311 -0
  26. data/ext/ffi_c/libffi/LICENSE +1 -1
  27. data/ext/ffi_c/libffi/Makefile.am +14 -4
  28. data/ext/ffi_c/libffi/Makefile.in +362 -211
  29. data/ext/ffi_c/libffi/README +70 -92
  30. data/ext/ffi_c/libffi/aclocal.m4 +6068 -4586
  31. data/ext/ffi_c/libffi/config.guess +125 -143
  32. data/ext/ffi_c/libffi/config.sub +103 -27
  33. data/ext/ffi_c/libffi/configure +11340 -18473
  34. data/ext/ffi_c/libffi/configure.ac +43 -4
  35. data/ext/ffi_c/libffi/doc/libffi.info +15 -15
  36. data/ext/ffi_c/libffi/doc/libffi.texi +1 -1
  37. data/ext/ffi_c/libffi/doc/stamp-vti +4 -4
  38. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  39. data/ext/ffi_c/libffi/fficonfig.h.in +24 -3
  40. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  41. data/ext/ffi_c/libffi/include/Makefile.in +97 -50
  42. data/ext/ffi_c/libffi/include/ffi.h.in +8 -2
  43. data/ext/ffi_c/libffi/include/ffi_common.h +24 -0
  44. data/ext/ffi_c/libffi/libtool-version +1 -1
  45. data/ext/ffi_c/libffi/ltmain.sh +7346 -5870
  46. data/ext/ffi_c/libffi/m4/libtool.m4 +7360 -0
  47. data/ext/ffi_c/libffi/m4/ltoptions.m4 +368 -0
  48. data/ext/ffi_c/libffi/m4/ltsugar.m4 +123 -0
  49. data/ext/ffi_c/libffi/m4/ltversion.m4 +23 -0
  50. data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +92 -0
  51. data/ext/ffi_c/libffi/man/Makefile.in +115 -62
  52. data/ext/ffi_c/libffi/man/ffi_call.3 +3 -3
  53. data/ext/ffi_c/libffi/missing +15 -8
  54. data/ext/ffi_c/libffi/src/arm/sysv.S +15 -8
  55. data/ext/ffi_c/libffi/src/avr32/ffi.c +421 -0
  56. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +50 -0
  57. data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
  58. data/ext/ffi_c/libffi/src/closures.c +47 -10
  59. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  60. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -3
  61. data/ext/ffi_c/libffi/src/mips/ffi.c +135 -32
  62. data/ext/ffi_c/libffi/src/mips/ffitarget.h +37 -4
  63. data/ext/ffi_c/libffi/src/mips/n32.S +67 -10
  64. data/ext/ffi_c/libffi/src/mips/o32.S +8 -8
  65. data/ext/ffi_c/libffi/src/pa/ffi.c +7 -0
  66. data/ext/ffi_c/libffi/src/powerpc/aix.S +163 -64
  67. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +308 -112
  68. data/ext/ffi_c/libffi/src/powerpc/ffi.c +20 -7
  69. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +208 -80
  70. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +11 -3
  71. data/ext/ffi_c/libffi/src/powerpc/sysv.S +12 -23
  72. data/ext/ffi_c/libffi/src/s390/sysv.S +1 -1
  73. data/ext/ffi_c/libffi/src/sh/sysv.S +9 -9
  74. data/ext/ffi_c/libffi/src/sh64/ffi.c +37 -22
  75. data/ext/ffi_c/libffi/src/sh64/sysv.S +23 -14
  76. data/ext/ffi_c/libffi/src/sparc/ffi.c +21 -6
  77. data/ext/ffi_c/libffi/src/sparc/v8.S +55 -14
  78. data/ext/ffi_c/libffi/src/x86/darwin.S +10 -9
  79. data/ext/ffi_c/libffi/src/x86/ffi.c +293 -86
  80. data/ext/ffi_c/libffi/src/x86/ffi64.c +73 -19
  81. data/ext/ffi_c/libffi/src/x86/ffitarget.h +30 -0
  82. data/ext/ffi_c/libffi/src/x86/sysv.S +21 -4
  83. data/ext/ffi_c/libffi/src/x86/unix64.S +8 -4
  84. data/ext/ffi_c/libffi/src/x86/win32.S +633 -147
  85. data/ext/ffi_c/libffi/src/x86/win64.S +460 -0
  86. data/ext/ffi_c/libffi/testsuite/Makefile.am +63 -54
  87. data/ext/ffi_c/libffi/testsuite/Makefile.in +112 -77
  88. data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +12 -1
  89. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +4 -4
  90. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +7 -15
  91. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +7 -15
  92. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +7 -15
  93. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +7 -15
  94. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +7 -15
  95. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +7 -14
  96. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +7 -15
  97. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +95 -0
  98. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c +6 -14
  99. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +4 -12
  100. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +4 -12
  101. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +4 -12
  102. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +4 -12
  103. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +4 -12
  104. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +4 -12
  105. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +4 -12
  106. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +4 -12
  107. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +4 -12
  108. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +4 -12
  109. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +4 -12
  110. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +4 -12
  111. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +4 -12
  112. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +4 -12
  113. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +4 -12
  114. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +4 -12
  115. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +4 -12
  116. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +4 -12
  117. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +4 -12
  118. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +4 -12
  119. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +4 -12
  120. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +4 -12
  121. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +4 -12
  122. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +4 -12
  123. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +4 -12
  124. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +4 -12
  125. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +4 -12
  126. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +134 -0
  127. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +117 -0
  128. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +11 -17
  129. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +4 -12
  130. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +4 -12
  131. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +7 -15
  132. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +4 -12
  133. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +4 -12
  134. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +7 -15
  135. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +66 -0
  136. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +4 -12
  137. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +57 -0
  138. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +4 -13
  139. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +105 -0
  140. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +57 -0
  141. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +4 -12
  142. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +4 -12
  143. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +4 -12
  144. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +4 -12
  145. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +4 -12
  146. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +4 -12
  147. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +74 -0
  148. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +140 -0
  149. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +4 -12
  150. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +4 -12
  151. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +4 -12
  152. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +4 -12
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +4 -12
  154. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +8 -16
  155. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +4 -12
  156. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +37 -0
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +25 -0
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +31 -0
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +2 -1
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +342 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +4 -12
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +4 -12
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +4 -12
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +4 -12
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +4 -12
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +4 -12
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +4 -12
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +4 -12
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +4 -12
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +4 -12
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +4 -12
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +4 -12
  173. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +1 -1
  174. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +1 -1
  175. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +145 -0
  176. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +148 -0
  177. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +124 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +124 -0
  179. data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
  180. data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +10 -0
  181. data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +4 -5
  182. data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc +17 -16
  183. data/ext/ffi_c/libffi/texinfo.tex +155 -427
  184. data/gen/Rakefile +4 -2
  185. data/lib/1.8/ffi_c.so +0 -0
  186. data/lib/1.9/ffi_c.so +0 -0
  187. data/lib/ffi/autopointer.rb +79 -20
  188. data/lib/ffi/callback.rb +4 -10
  189. data/lib/ffi/enum.rb +28 -0
  190. data/lib/ffi/ffi.rb +1 -0
  191. data/lib/ffi/io.rb +28 -0
  192. data/lib/ffi/library.rb +237 -182
  193. data/lib/ffi/memorypointer.rb +28 -62
  194. data/lib/ffi/platform.rb +27 -0
  195. data/lib/ffi/pointer.rb +28 -0
  196. data/lib/ffi/struct.rb +55 -1
  197. data/lib/ffi/types.rb +29 -0
  198. data/lib/ffi/variadic.rb +29 -0
  199. data/spec/ffi/library_spec.rb +31 -5
  200. data/spec/ffi/rbx/attach_function_spec.rb +2 -1
  201. data/spec/ffi/rbx/memory_pointer_spec.rb +2 -1
  202. data/spec/ffi/spec_helper.rb +5 -1
  203. data/spec/ffi/struct_spec.rb +82 -0
  204. data/tasks/ann.rake +80 -0
  205. data/tasks/extension.rake +25 -0
  206. data/tasks/gem.rake +200 -0
  207. data/tasks/git.rake +41 -0
  208. data/tasks/notes.rake +27 -0
  209. data/tasks/post_load.rake +34 -0
  210. data/tasks/rdoc.rake +50 -0
  211. data/tasks/rubyforge.rake +55 -0
  212. data/tasks/setup.rb +300 -0
  213. data/tasks/spec.rake +54 -0
  214. data/tasks/svn.rake +47 -0
  215. data/tasks/test.rake +40 -0
  216. metadata +312 -279
  217. data/ext/ffi_c/libffi/TODO +0 -1
  218. data/ext/ffi_c/libffi/ltcf-c.sh +0 -861
  219. data/ext/ffi_c/libffi/ltcf-cxx.sh +0 -1069
  220. data/ext/ffi_c/libffi/ltcf-gcj.sh +0 -700
  221. data/ext/ffi_c/libffi/ltconfig +0 -2862
  222. data/ext/ffi_c/libffi/mkinstalldirs +0 -158
@@ -28,7 +28,10 @@
28
28
  #define LIBFFI_TARGET_H
29
29
 
30
30
  #ifdef linux
31
- #include <asm/sgidefs.h>
31
+ # include <asm/sgidefs.h>
32
+ #else
33
+ # include <sgidefs.h>
34
+ #endif
32
35
  # ifndef _ABIN32
33
36
  # define _ABIN32 _MIPS_SIM_NABI32
34
37
  # endif
@@ -38,7 +41,6 @@
38
41
  # ifndef _ABIO32
39
42
  # define _ABIO32 _MIPS_SIM_ABI32
40
43
  # endif
41
- #endif
42
44
 
43
45
  #if !defined(_MIPS_SIM)
44
46
  -- something is very wrong --
@@ -95,6 +97,15 @@
95
97
  #define FFI_TYPE_STRUCT_DF 189
96
98
  #define FFI_TYPE_STRUCT_SMALL 93
97
99
  #define FFI_TYPE_STRUCT_SMALL2 109
100
+
101
+ /* and for n32 soft float, add 16 * 2^4 */
102
+ #define FFI_TYPE_STRUCT_D_SOFT 317
103
+ #define FFI_TYPE_STRUCT_F_SOFT 301
104
+ #define FFI_TYPE_STRUCT_DD_SOFT 509
105
+ #define FFI_TYPE_STRUCT_FF_SOFT 429
106
+ #define FFI_TYPE_STRUCT_FD_SOFT 493
107
+ #define FFI_TYPE_STRUCT_DF_SOFT 445
108
+ #define FFI_TYPE_STRUCT_SOFT 16
98
109
  #endif
99
110
 
100
111
  #ifdef LIBFFI_ASM
@@ -145,7 +156,8 @@
145
156
  # endif /* _MIPS_SIM==_ABI64 */
146
157
  #endif /* !FFI_MIPS_O32 */
147
158
  #else /* !LIBFFI_ASM */
148
- #ifdef FFI_MIPS_O32
159
+ # ifdef __GNUC__
160
+ # ifdef FFI_MIPS_O32
149
161
  /* O32 stack frames have 32bit integer args */
150
162
  typedef unsigned int ffi_arg __attribute__((__mode__(__SI__)));
151
163
  typedef signed int ffi_sarg __attribute__((__mode__(__SI__)));
@@ -153,7 +165,18 @@ typedef signed int ffi_sarg __attribute__((__mode__(__SI__)));
153
165
  /* N32 and N64 frames have 64bit integer args */
154
166
  typedef unsigned int ffi_arg __attribute__((__mode__(__DI__)));
155
167
  typedef signed int ffi_sarg __attribute__((__mode__(__DI__)));
156
- #endif
168
+ # endif
169
+ # else
170
+ # ifdef FFI_MIPS_O32
171
+ /* O32 stack frames have 32bit integer args */
172
+ typedef __uint32_t ffi_arg;
173
+ typedef __int32_t ffi_sarg;
174
+ # else
175
+ /* N32 and N64 frames have 64bit integer args */
176
+ typedef __uint64_t ffi_arg;
177
+ typedef __int64_t ffi_sarg;
178
+ # endif
179
+ # endif /* __GNUC__ */
157
180
 
158
181
  typedef enum ffi_abi {
159
182
  FFI_FIRST_ABI = 0,
@@ -161,6 +184,8 @@ typedef enum ffi_abi {
161
184
  FFI_N32,
162
185
  FFI_N64,
163
186
  FFI_O32_SOFT_FLOAT,
187
+ FFI_N32_SOFT_FLOAT,
188
+ FFI_N64_SOFT_FLOAT,
164
189
 
165
190
  #ifdef FFI_MIPS_O32
166
191
  #ifdef __mips_soft_float
@@ -170,9 +195,17 @@ typedef enum ffi_abi {
170
195
  #endif
171
196
  #else
172
197
  # if _MIPS_SIM==_ABI64
198
+ # ifdef __mips_soft_float
199
+ FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT,
200
+ # else
173
201
  FFI_DEFAULT_ABI = FFI_N64,
202
+ # endif
174
203
  # else
204
+ # ifdef __mips_soft_float
205
+ FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT,
206
+ # else
175
207
  FFI_DEFAULT_ABI = FFI_N32,
208
+ # endif
176
209
  # endif
177
210
  #endif
178
211
 
@@ -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, EXPRESS
18
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
21
- ANY CLAIM, DAMAGES OR
22
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
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
@@ -40,7 +40,9 @@
40
40
 
41
41
  #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG )
42
42
 
43
+ #ifdef linux
43
44
  .abicalls
45
+ #endif
44
46
  .text
45
47
  .align 2
46
48
  .globl ffi_call_N32
@@ -217,8 +219,10 @@ callit:
217
219
 
218
220
  # Shift the return type flag over
219
221
  SRL t6, 8*FFI_FLAG_BITS
220
-
222
+
223
+ beq t6, FFI_TYPE_SINT32, retint
221
224
  bne t6, FFI_TYPE_INT, retfloat
225
+ retint:
222
226
  jal t9
223
227
  REG_L t4, 4*FFI_SIZEOF_ARG($fp)
224
228
  REG_S v0, 0(t4)
@@ -277,12 +281,58 @@ retstruct_d_f:
277
281
  b epilogue
278
282
 
279
283
  retstruct_f_d:
280
- bne t6, FFI_TYPE_STRUCT_FD, retstruct_small
284
+ bne t6, FFI_TYPE_STRUCT_FD, retstruct_d_soft
281
285
  jal t9
282
286
  REG_L t4, 4*FFI_SIZEOF_ARG($fp)
283
287
  s.s $f0, 0(t4)
284
288
  s.d $f2, 8(t4)
285
289
  b epilogue
290
+
291
+ retstruct_d_soft:
292
+ bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
293
+ jal t9
294
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
295
+ sd v0, 0(t4)
296
+ b epilogue
297
+
298
+ retstruct_f_soft:
299
+ bne t6, FFI_TYPE_STRUCT_F_SOFT, retstruct_d_d_soft
300
+ jal t9
301
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
302
+ sw v0, 0(t4)
303
+ b epilogue
304
+
305
+ retstruct_d_d_soft:
306
+ bne t6, FFI_TYPE_STRUCT_DD_SOFT, retstruct_f_f_soft
307
+ jal t9
308
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
309
+ sd v0, 0(t4)
310
+ sd v1, 8(t4)
311
+ b epilogue
312
+
313
+ retstruct_f_f_soft:
314
+ bne t6, FFI_TYPE_STRUCT_FF_SOFT, retstruct_d_f_soft
315
+ jal t9
316
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
317
+ sw v0, 0(t4)
318
+ sw v1, 4(t4)
319
+ b epilogue
320
+
321
+ retstruct_d_f_soft:
322
+ bne t6, FFI_TYPE_STRUCT_DF_SOFT, retstruct_f_d_soft
323
+ jal t9
324
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
325
+ sd v0, 0(t4)
326
+ sw v1, 8(t4)
327
+ b epilogue
328
+
329
+ retstruct_f_d_soft:
330
+ bne t6, FFI_TYPE_STRUCT_FD_SOFT, retstruct_small
331
+ jal t9
332
+ REG_L t4, 4*FFI_SIZEOF_ARG($fp)
333
+ sw v0, 0(t4)
334
+ sd v1, 8(t4)
335
+ b epilogue
286
336
 
287
337
  retstruct_small:
288
338
  bne t6, FFI_TYPE_STRUCT_SMALL, retstruct_small2
@@ -413,6 +463,11 @@ ffi_closure_N32:
413
463
  jalr t9
414
464
 
415
465
  # Return flags are in v0
466
+ bne v0, FFI_TYPE_SINT32, cls_retint
467
+ lw v0, V0_OFF2($sp)
468
+ b cls_epilogue
469
+
470
+ cls_retint:
416
471
  bne v0, FFI_TYPE_INT, cls_retfloat
417
472
  REG_L v0, V0_OFF2($sp)
418
473
  b cls_epilogue
@@ -474,6 +529,7 @@ cls_epilogue:
474
529
  .LFE2:
475
530
  .end ffi_closure_N32
476
531
 
532
+ #ifdef linux
477
533
  .section .eh_frame,"aw",@progbits
478
534
  .Lframe1:
479
535
  .4byte .LECIE1-.LSCIE1 # length
@@ -530,5 +586,6 @@ cls_epilogue:
530
586
  .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
531
587
  .align EH_FRAME_ALIGN
532
588
  .LEFDE3:
589
+ #endif /* linux */
533
590
 
534
591
  #endif
@@ -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, EXPRESS
18
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
21
- ANY CLAIM, DAMAGES OR
22
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
- OTHER DEALINGS IN THE SOFTWARE.
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
@@ -492,6 +492,13 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
492
492
  avalue[i] = (void *)(stack - slot);
493
493
  break;
494
494
 
495
+ #ifdef PA_HPUX
496
+ case FFI_TYPE_LONGDOUBLE:
497
+ /* Long doubles are treated like a big structure. */
498
+ avalue[i] = (void *) *(stack - slot);
499
+ break;
500
+ #endif
501
+
495
502
  case FFI_TYPE_STRUCT:
496
503
  /* Structs smaller or equal than 4 bytes are passed in one
497
504
  register. Structs smaller or equal 8 bytes are passed in two
@@ -1,5 +1,5 @@
1
1
  /* -----------------------------------------------------------------------
2
- aix.S - Copyright (c) 2002 Free Software Foundation, Inc.
2
+ aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc.
3
3
  based on darwin.S by John Hornkvist
4
4
 
5
5
  PowerPC Assembly glue.
@@ -86,9 +86,13 @@
86
86
  #define L(x) x
87
87
  .file "aix.S"
88
88
  .toc
89
- .csect .text[PR]
90
- .align 2
91
- .globl ffi_prep_args
89
+
90
+ /* void ffi_call_AIX(extended_cif *ecif, unsigned long bytes,
91
+ * unsigned int flags, unsigned int *rvalue,
92
+ * void (*fn)(),
93
+ * void (*prep_args)(extended_cif*, unsigned *const));
94
+ * r3=ecif, r4=bytes, r5=flags, r6=rvalue, r7=fn, r8=prep_args
95
+ */
92
96
 
93
97
  .csect .text[PR]
94
98
  .align 2
@@ -96,61 +100,151 @@
96
100
  .globl .ffi_call_AIX
97
101
  .csect ffi_call_AIX[DS]
98
102
  ffi_call_AIX:
99
- .long .ffi_call_AIX, TOC[tc0], 0
103
+ #ifdef __64BIT__
104
+ .llong .ffi_call_AIX, TOC[tc0], 0
100
105
  .csect .text[PR]
101
106
  .ffi_call_AIX:
102
- mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved...
103
- /* Save the old stack pointer as AP. */
104
- mr r8,r1
105
-
106
- /* Allocate the stack space we need. */
107
- stwux r1,r1,r4
108
-
109
107
  /* Save registers we use. */
110
- mflr r9
108
+ mflr r0
111
109
 
112
- stw r28,-16(r8)
113
- stw r29,-12(r8)
114
- stw r30, -8(r8)
115
- stw r31, -4(r8)
110
+ std r28,-32(r1)
111
+ std r29,-24(r1)
112
+ std r30,-16(r1)
113
+ std r31, -8(r1)
116
114
 
117
- stw r9, 8(r8)
118
- stw r2, 20(r1)
115
+ std r0, 16(r1)
116
+ mr r28, r1 /* our AP. */
117
+ stdux r1, r1, r4
119
118
 
120
119
  /* Save arguments over call... */
121
- mr r31,r5 /* flags, */
122
- mr r30,r6 /* rvalue, */
123
- mr r29,r7 /* function address, */
124
- mr r28,r8 /* our AP. */
120
+ mr r31, r5 /* flags, */
121
+ mr r30, r6 /* rvalue, */
122
+ mr r29, r7 /* function address. */
123
+ std r2, 40(r1)
125
124
 
126
125
  /* Call ffi_prep_args. */
127
- mr r4,r1
128
- li r9,0
126
+ mr r4, r1
127
+ bl .ffi_prep_args
128
+
129
+ /* Now do the call. */
130
+ ld r0, 0(r29)
131
+ ld r2, 8(r29)
132
+ ld r11, 16(r29)
133
+ /* Set up cr1 with bits 4-7 of the flags. */
134
+ mtcrf 0x40, r31
135
+ mtctr r0
136
+ /* Load all those argument registers. */
137
+ // We have set up a nice stack frame, just load it into registers.
138
+ ld r3, 40+(1*8)(r1)
139
+ ld r4, 40+(2*8)(r1)
140
+ ld r5, 40+(3*8)(r1)
141
+ ld r6, 40+(4*8)(r1)
142
+ nop
143
+ ld r7, 40+(5*8)(r1)
144
+ ld r8, 40+(6*8)(r1)
145
+ ld r9, 40+(7*8)(r1)
146
+ ld r10,40+(8*8)(r1)
147
+
148
+ L1:
149
+ /* Load all the FP registers. */
150
+ bf 6,L2 // 2f + 0x18
151
+ lfd f1,-32-(13*8)(r28)
152
+ lfd f2,-32-(12*8)(r28)
153
+ lfd f3,-32-(11*8)(r28)
154
+ lfd f4,-32-(10*8)(r28)
155
+ nop
156
+ lfd f5,-32-(9*8)(r28)
157
+ lfd f6,-32-(8*8)(r28)
158
+ lfd f7,-32-(7*8)(r28)
159
+ lfd f8,-32-(6*8)(r28)
160
+ nop
161
+ lfd f9,-32-(5*8)(r28)
162
+ lfd f10,-32-(4*8)(r28)
163
+ lfd f11,-32-(3*8)(r28)
164
+ lfd f12,-32-(2*8)(r28)
165
+ nop
166
+ lfd f13,-32-(1*8)(r28)
129
167
 
130
- lwz r2,4(r12)
131
- lwz r12,0(r12)
132
- mtctr r12 // r12 holds address of _ffi_prep_args
168
+ L2:
169
+ /* Make the call. */
133
170
  bctrl
134
- lwz r2,20(r1)
171
+ ld r2, 40(r1)
172
+
173
+ /* Now, deal with the return value. */
174
+ mtcrf 0x01, r31
175
+
176
+ bt 30, L(done_return_value)
177
+ bt 29, L(fp_return_value)
178
+ std r3, 0(r30)
179
+
180
+ /* Fall through... */
181
+
182
+ L(done_return_value):
183
+ /* Restore the registers we used and return. */
184
+ mr r1, r28
185
+ ld r0, 16(r28)
186
+ ld r28, -32(r1)
187
+ mtlr r0
188
+ ld r29, -24(r1)
189
+ ld r30, -16(r1)
190
+ ld r31, -8(r1)
191
+ blr
192
+
193
+ L(fp_return_value):
194
+ bf 28, L(float_return_value)
195
+ stfd f1, 0(r30)
196
+ bf 31, L(done_return_value)
197
+ stfd f2, 8(r30)
198
+ b L(done_return_value)
199
+ L(float_return_value):
200
+ stfs f1, 0(r30)
201
+ b L(done_return_value)
202
+
203
+ #else /* ! __64BIT__ */
204
+
205
+ .long .ffi_call_AIX, TOC[tc0], 0
206
+ .csect .text[PR]
207
+ .ffi_call_AIX:
208
+ /* Save registers we use. */
209
+ mflr r0
210
+
211
+ stw r28,-16(r1)
212
+ stw r29,-12(r1)
213
+ stw r30, -8(r1)
214
+ stw r31, -4(r1)
215
+
216
+ stw r0, 8(r1)
217
+ mr r28, r1 /* out AP. */
218
+ stwux r1, r1, r4
219
+
220
+ /* Save arguments over call... */
221
+ mr r31, r5 /* flags, */
222
+ mr r30, r6 /* rvalue, */
223
+ mr r29, r7 /* function address, */
224
+ stw r2, 20(r1)
225
+
226
+ /* Call ffi_prep_args. */
227
+ mr r4, r1
228
+ bl .ffi_prep_args
135
229
 
136
230
  /* Now do the call. */
137
- lwz r12,0(r29)
231
+ lwz r0, 0(r29)
232
+ lwz r2, 4(r29)
233
+ lwz r11, 8(r29)
138
234
  /* Set up cr1 with bits 4-7 of the flags. */
139
- mtcrf 0x40,r31
140
- stw r2,20(r1)
141
- mtctr r12
142
- lwz r2,4(r29)
235
+ mtcrf 0x40, r31
236
+ mtctr r0
143
237
  /* Load all those argument registers. */
144
238
  // We have set up a nice stack frame, just load it into registers.
145
- lwz r3, 20+(1*4)(r1)
146
- lwz r4, 20+(2*4)(r1)
147
- lwz r5, 20+(3*4)(r1)
148
- lwz r6, 20+(4*4)(r1)
239
+ lwz r3, 20+(1*4)(r1)
240
+ lwz r4, 20+(2*4)(r1)
241
+ lwz r5, 20+(3*4)(r1)
242
+ lwz r6, 20+(4*4)(r1)
149
243
  nop
150
- lwz r7, 20+(5*4)(r1)
151
- lwz r8, 20+(6*4)(r1)
152
- lwz r9, 20+(7*4)(r1)
153
- lwz r10,20+(8*4)(r1)
244
+ lwz r7, 20+(5*4)(r1)
245
+ lwz r8, 20+(6*4)(r1)
246
+ lwz r9, 20+(7*4)(r1)
247
+ lwz r10,20+(8*4)(r1)
154
248
 
155
249
  L1:
156
250
  /* Load all the FP registers. */
@@ -165,47 +259,48 @@ L1:
165
259
  lfd f7,-16-(7*8)(r28)
166
260
  lfd f8,-16-(6*8)(r28)
167
261
  nop
168
- lfd f9,-16-(5*8)(r28)
169
- lfd f10,-16-(4*8)(r28)
170
- lfd f11,-16-(3*8)(r28)
171
- lfd f12,-16-(2*8)(r28)
262
+ lfd f9,-16-(5*8)(r28)
263
+ lfd f10,-16-(4*8)(r28)
264
+ lfd f11,-16-(3*8)(r28)
265
+ lfd f12,-16-(2*8)(r28)
172
266
  nop
173
- lfd f13,-16-(1*8)(r28)
267
+ lfd f13,-16-(1*8)(r28)
174
268
 
175
269
  L2:
176
270
  /* Make the call. */
177
271
  bctrl
178
- lwz r2,20(r1)
272
+ lwz r2, 20(r1)
179
273
 
180
274
  /* Now, deal with the return value. */
181
- mtcrf 0x01,r31
275
+ mtcrf 0x01, r31
182
276
 
183
- bt 30,L(done_return_value)
184
- bt 29,L(fp_return_value)
185
- stw r3,0(r30)
186
- bf 28,L(done_return_value)
187
- stw r4,4(r30)
277
+ bt 30, L(done_return_value)
278
+ bt 29, L(fp_return_value)
279
+ stw r3, 0(r30)
280
+ bf 28, L(done_return_value)
281
+ stw r4, 4(r30)
188
282
 
189
283
  /* Fall through... */
190
284
 
191
285
  L(done_return_value):
192
286
  /* Restore the registers we used and return. */
193
- lwz r9, 8(r28)
194
- lwz r31, -4(r28)
195
- mtlr r9
196
- lwz r30, -8(r28)
197
- lwz r29,-12(r28)
198
- lwz r28,-16(r28)
199
- lwz r1,0(r1)
287
+ mr r1, r28
288
+ lwz r0, 8(r28)
289
+ lwz r28,-16(r1)
290
+ mtlr r0
291
+ lwz r29,-12(r1)
292
+ lwz r30, -8(r1)
293
+ lwz r31, -4(r1)
200
294
  blr
201
295
 
202
296
  L(fp_return_value):
203
- bf 28,L(float_return_value)
204
- stfd f1,0(r30)
297
+ bf 28, L(float_return_value)
298
+ stfd f1, 0(r30)
205
299
  b L(done_return_value)
206
300
  L(float_return_value):
207
- stfs f1,0(r30)
301
+ stfs f1, 0(r30)
208
302
  b L(done_return_value)
303
+ #endif
209
304
  .long 0
210
305
  .byte 0,0,0,1,128,4,0,0
211
306
  //END(ffi_call_AIX)
@@ -216,7 +311,11 @@ L(float_return_value):
216
311
  .globl .ffi_call_DARWIN
217
312
  .csect ffi_call_DARWIN[DS]
218
313
  ffi_call_DARWIN:
314
+ #ifdef __64BIT__
315
+ .llong .ffi_call_DARWIN, TOC[tc0], 0
316
+ #else
219
317
  .long .ffi_call_DARWIN, TOC[tc0], 0
318
+ #endif
220
319
  .csect .text[PR]
221
320
  .ffi_call_DARWIN:
222
321
  blr