ffi 1.16.3 → 1.17.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (550) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile +9 -2
  5. data/README.md +1 -1
  6. data/Rakefile +17 -5
  7. data/lib/ffi/autopointer.rb +1 -9
  8. data/lib/ffi/dynamic_library.rb +34 -5
  9. data/lib/ffi/enum.rb +0 -1
  10. data/lib/ffi/function.rb +1 -1
  11. data/lib/ffi/io.rb +2 -2
  12. data/lib/ffi/library.rb +23 -23
  13. data/lib/ffi/platform/aarch64-linux/types.conf +74 -3
  14. data/lib/ffi/pointer.rb +6 -6
  15. data/lib/ffi/struct.rb +4 -4
  16. data/lib/ffi/struct_layout.rb +2 -2
  17. data/lib/ffi/struct_layout_builder.rb +8 -8
  18. data/lib/ffi/types.rb +51 -49
  19. data/lib/ffi/version.rb +1 -1
  20. data/sig/ffi/abstract_memory.rbs +165 -0
  21. data/sig/ffi/auto_pointer.rbs +27 -0
  22. data/sig/ffi/buffer.rbs +18 -0
  23. data/sig/ffi/data_converter.rbs +10 -0
  24. data/sig/ffi/dynamic_library.rbs +9 -0
  25. data/sig/ffi/enum.rbs +38 -0
  26. data/sig/ffi/function.rbs +39 -0
  27. data/sig/ffi/library.rbs +42 -0
  28. data/sig/ffi/native_type.rbs +86 -0
  29. data/sig/ffi/pointer.rbs +42 -0
  30. data/sig/ffi/struct.rbs +76 -0
  31. data/sig/ffi/struct_by_reference.rbs +11 -0
  32. data/sig/ffi/struct_by_value.rbs +7 -0
  33. data/sig/ffi/struct_layout.rbs +9 -0
  34. data/sig/ffi/struct_layout_builder.rbs +5 -0
  35. data/sig/ffi/type.rbs +39 -0
  36. data/sig/ffi.rbs +26 -0
  37. data.tar.gz.sig +0 -0
  38. metadata +34 -532
  39. metadata.gz.sig +0 -0
  40. data/ext/ffi_c/AbstractMemory.c +0 -1128
  41. data/ext/ffi_c/AbstractMemory.h +0 -176
  42. data/ext/ffi_c/ArrayType.c +0 -198
  43. data/ext/ffi_c/ArrayType.h +0 -60
  44. data/ext/ffi_c/Buffer.c +0 -417
  45. data/ext/ffi_c/Call.c +0 -498
  46. data/ext/ffi_c/Call.h +0 -107
  47. data/ext/ffi_c/ClosurePool.c +0 -333
  48. data/ext/ffi_c/ClosurePool.h +0 -59
  49. data/ext/ffi_c/DynamicLibrary.c +0 -397
  50. data/ext/ffi_c/DynamicLibrary.h +0 -98
  51. data/ext/ffi_c/Function.c +0 -1063
  52. data/ext/ffi_c/Function.h +0 -84
  53. data/ext/ffi_c/FunctionInfo.c +0 -322
  54. data/ext/ffi_c/LastError.c +0 -243
  55. data/ext/ffi_c/LastError.h +0 -47
  56. data/ext/ffi_c/LongDouble.c +0 -65
  57. data/ext/ffi_c/LongDouble.h +0 -47
  58. data/ext/ffi_c/MappedType.c +0 -211
  59. data/ext/ffi_c/MappedType.h +0 -57
  60. data/ext/ffi_c/MemoryPointer.c +0 -219
  61. data/ext/ffi_c/MemoryPointer.h +0 -49
  62. data/ext/ffi_c/MethodHandle.c +0 -350
  63. data/ext/ffi_c/MethodHandle.h +0 -56
  64. data/ext/ffi_c/Platform.c +0 -78
  65. data/ext/ffi_c/Platform.h +0 -45
  66. data/ext/ffi_c/Pointer.c +0 -546
  67. data/ext/ffi_c/Pointer.h +0 -60
  68. data/ext/ffi_c/Struct.c +0 -897
  69. data/ext/ffi_c/Struct.h +0 -115
  70. data/ext/ffi_c/StructByValue.c +0 -177
  71. data/ext/ffi_c/StructByValue.h +0 -55
  72. data/ext/ffi_c/StructLayout.c +0 -769
  73. data/ext/ffi_c/Thread.c +0 -129
  74. data/ext/ffi_c/Thread.h +0 -76
  75. data/ext/ffi_c/Type.c +0 -447
  76. data/ext/ffi_c/Type.h +0 -63
  77. data/ext/ffi_c/Types.c +0 -138
  78. data/ext/ffi_c/Types.h +0 -88
  79. data/ext/ffi_c/Variadic.c +0 -345
  80. data/ext/ffi_c/compat.h +0 -82
  81. data/ext/ffi_c/extconf.rb +0 -115
  82. data/ext/ffi_c/ffi.c +0 -97
  83. data/ext/ffi_c/libffi/.appveyor/site.exp +0 -16
  84. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +0 -7
  85. data/ext/ffi_c/libffi/.appveyor.yml +0 -84
  86. data/ext/ffi_c/libffi/.ci/ar-lib +0 -270
  87. data/ext/ffi_c/libffi/.ci/bfin-sim.exp +0 -58
  88. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +0 -18
  89. data/ext/ffi_c/libffi/.ci/build-in-container.sh +0 -10
  90. data/ext/ffi_c/libffi/.ci/build.sh +0 -124
  91. data/ext/ffi_c/libffi/.ci/compile +0 -351
  92. data/ext/ffi_c/libffi/.ci/install.sh +0 -78
  93. data/ext/ffi_c/libffi/.ci/m32r-sim.exp +0 -58
  94. data/ext/ffi_c/libffi/.ci/moxie-sim.exp +0 -60
  95. data/ext/ffi_c/libffi/.ci/msvs-detect +0 -1103
  96. data/ext/ffi_c/libffi/.ci/or1k-sim.exp +0 -58
  97. data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +0 -58
  98. data/ext/ffi_c/libffi/.ci/site.exp +0 -29
  99. data/ext/ffi_c/libffi/.ci/wine-sim.exp +0 -55
  100. data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
  101. data/ext/ffi_c/libffi/.gitattributes +0 -4
  102. data/ext/ffi_c/libffi/.github/issue_template.md +0 -10
  103. data/ext/ffi_c/libffi/.github/workflows/build.yml +0 -460
  104. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +0 -171
  105. data/ext/ffi_c/libffi/.gitignore +0 -46
  106. data/ext/ffi_c/libffi/ChangeLog.old +0 -7407
  107. data/ext/ffi_c/libffi/LICENSE +0 -21
  108. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +0 -353
  109. data/ext/ffi_c/libffi/Makefile.am +0 -157
  110. data/ext/ffi_c/libffi/Makefile.in +0 -2127
  111. data/ext/ffi_c/libffi/README.md +0 -526
  112. data/ext/ffi_c/libffi/acinclude.m4 +0 -377
  113. data/ext/ffi_c/libffi/autogen.sh +0 -2
  114. data/ext/ffi_c/libffi/compile +0 -348
  115. data/ext/ffi_c/libffi/config.guess +0 -1754
  116. data/ext/ffi_c/libffi/config.sub +0 -1892
  117. data/ext/ffi_c/libffi/configure +0 -22791
  118. data/ext/ffi_c/libffi/configure.ac +0 -451
  119. data/ext/ffi_c/libffi/configure.host +0 -337
  120. data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
  121. data/ext/ffi_c/libffi/doc/Makefile.in +0 -818
  122. data/ext/ffi_c/libffi/doc/libffi.texi +0 -1046
  123. data/ext/ffi_c/libffi/doc/version.texi +0 -4
  124. data/ext/ffi_c/libffi/fficonfig.h.in +0 -188
  125. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -312
  126. data/ext/ffi_c/libffi/include/Makefile.am +0 -9
  127. data/ext/ffi_c/libffi/include/Makefile.in +0 -609
  128. data/ext/ffi_c/libffi/include/ffi.h.in +0 -527
  129. data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -76
  130. data/ext/ffi_c/libffi/include/ffi_common.h +0 -182
  131. data/ext/ffi_c/libffi/include/tramp.h +0 -45
  132. data/ext/ffi_c/libffi/install-sh +0 -541
  133. data/ext/ffi_c/libffi/libffi.map.in +0 -76
  134. data/ext/ffi_c/libffi/libffi.pc.in +0 -11
  135. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -997
  136. data/ext/ffi_c/libffi/libtool-ldflags +0 -106
  137. data/ext/ffi_c/libffi/libtool-version +0 -29
  138. data/ext/ffi_c/libffi/ltmain.sh +0 -11448
  139. data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
  140. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -50
  141. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -198
  142. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -158
  143. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -53
  144. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -119
  145. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -49
  146. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -302
  147. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -267
  148. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -89
  149. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +0 -51
  150. data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +0 -37
  151. data/ext/ffi_c/libffi/make_sunver.pl +0 -333
  152. data/ext/ffi_c/libffi/man/Makefile.am +0 -8
  153. data/ext/ffi_c/libffi/man/Makefile.in +0 -565
  154. data/ext/ffi_c/libffi/man/ffi.3 +0 -41
  155. data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
  156. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
  157. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
  158. data/ext/ffi_c/libffi/missing +0 -215
  159. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +0 -33
  160. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +0 -130
  161. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +0 -57
  162. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +0 -4
  163. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +0 -511
  164. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +0 -219
  165. data/ext/ffi_c/libffi/msvcc.sh +0 -353
  166. data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -1129
  167. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -97
  168. data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -100
  169. data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -543
  170. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +0 -506
  171. data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
  172. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
  173. data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
  174. data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
  175. data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -210
  176. data/ext/ffi_c/libffi/src/arc/ffi.c +0 -443
  177. data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -67
  178. data/ext/ffi_c/libffi/src/arm/ffi.c +0 -921
  179. data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -89
  180. data/ext/ffi_c/libffi/src/arm/internal.h +0 -17
  181. data/ext/ffi_c/libffi/src/arm/sysv.S +0 -456
  182. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +0 -311
  183. data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
  184. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
  185. data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
  186. data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
  187. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
  188. data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
  189. data/ext/ffi_c/libffi/src/closures.c +0 -1107
  190. data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
  191. data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
  192. data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
  193. data/ext/ffi_c/libffi/src/csky/ffi.c +0 -395
  194. data/ext/ffi_c/libffi/src/csky/ffitarget.h +0 -63
  195. data/ext/ffi_c/libffi/src/csky/sysv.S +0 -371
  196. data/ext/ffi_c/libffi/src/debug.c +0 -64
  197. data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5171
  198. data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
  199. data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
  200. data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
  201. data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -616
  202. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -56
  203. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
  204. data/ext/ffi_c/libffi/src/ia64/unix.S +0 -585
  205. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
  206. data/ext/ffi_c/libffi/src/kvx/asm.h +0 -5
  207. data/ext/ffi_c/libffi/src/kvx/ffi.c +0 -273
  208. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +0 -75
  209. data/ext/ffi_c/libffi/src/kvx/sysv.S +0 -127
  210. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +0 -621
  211. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +0 -82
  212. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +0 -327
  213. data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -249
  214. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
  215. data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
  216. data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
  217. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
  218. data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
  219. data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
  220. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
  221. data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
  222. data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
  223. data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
  224. data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
  225. data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
  226. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
  227. data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
  228. data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1309
  229. data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -251
  230. data/ext/ffi_c/libffi/src/mips/n32.S +0 -772
  231. data/ext/ffi_c/libffi/src/mips/o32.S +0 -561
  232. data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
  233. data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -310
  234. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
  235. data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
  236. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
  237. data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
  238. data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -341
  239. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
  240. data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
  241. data/ext/ffi_c/libffi/src/pa/ffi.c +0 -673
  242. data/ext/ffi_c/libffi/src/pa/ffi64.c +0 -614
  243. data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -94
  244. data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -417
  245. data/ext/ffi_c/libffi/src/pa/hpux64.S +0 -681
  246. data/ext/ffi_c/libffi/src/pa/linux.S +0 -427
  247. data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -566
  248. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -694
  249. data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
  250. data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
  251. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
  252. data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -175
  253. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1452
  254. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -1153
  255. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -105
  256. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
  257. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -204
  258. data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -293
  259. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -566
  260. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
  261. data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -173
  262. data/ext/ffi_c/libffi/src/powerpc/t-aix +0 -5
  263. data/ext/ffi_c/libffi/src/prep_cif.c +0 -283
  264. data/ext/ffi_c/libffi/src/raw_api.c +0 -267
  265. data/ext/ffi_c/libffi/src/riscv/ffi.c +0 -514
  266. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +0 -69
  267. data/ext/ffi_c/libffi/src/riscv/sysv.S +0 -293
  268. data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
  269. data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
  270. data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
  271. data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
  272. data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
  273. data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
  274. data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
  275. data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
  276. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
  277. data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
  278. data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
  279. data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -624
  280. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
  281. data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
  282. data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
  283. data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
  284. data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
  285. data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
  286. data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
  287. data/ext/ffi_c/libffi/src/tramp.c +0 -716
  288. data/ext/ffi_c/libffi/src/types.c +0 -108
  289. data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
  290. data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
  291. data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
  292. data/ext/ffi_c/libffi/src/wasm32/ffi.c +0 -934
  293. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +0 -62
  294. data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
  295. data/ext/ffi_c/libffi/src/x86/ffi.c +0 -832
  296. data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -950
  297. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -164
  298. data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -361
  299. data/ext/ffi_c/libffi/src/x86/internal.h +0 -43
  300. data/ext/ffi_c/libffi/src/x86/internal64.h +0 -36
  301. data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1272
  302. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +0 -998
  303. data/ext/ffi_c/libffi/src/x86/unix64.S +0 -711
  304. data/ext/ffi_c/libffi/src/x86/win64.S +0 -254
  305. data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -238
  306. data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -306
  307. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -57
  308. data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -268
  309. data/ext/ffi_c/libffi/stamp-h.in +0 -1
  310. data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -135
  311. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -664
  312. data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
  313. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +0 -54
  314. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +0 -63
  315. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +0 -80
  316. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +0 -48
  317. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +0 -7
  318. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +0 -51
  319. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -682
  320. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
  321. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
  322. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +0 -28
  323. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +0 -78
  324. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +0 -50
  325. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +0 -63
  326. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +0 -1746
  327. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +0 -2885
  328. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +0 -747
  329. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
  330. data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +0 -46
  331. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +0 -41
  332. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -54
  333. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
  334. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -163
  335. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
  336. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
  337. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -61
  338. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
  339. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
  340. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -110
  341. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
  342. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
  343. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
  344. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
  345. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
  346. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
  347. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
  348. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
  349. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc_tc.c +0 -114
  350. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
  351. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
  352. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
  353. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
  354. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
  355. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
  356. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
  357. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
  358. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
  359. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -48
  360. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
  361. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -42
  362. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -42
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +0 -60
  365. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -43
  366. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
  367. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
  368. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
  369. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
  370. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +0 -57
  371. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
  372. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
  373. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
  374. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
  375. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
  376. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
  377. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
  378. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
  379. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +0 -63
  380. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +0 -65
  381. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +0 -65
  382. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +0 -67
  383. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +0 -67
  384. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +0 -93
  385. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +0 -61
  386. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +0 -63
  387. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +0 -90
  388. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
  389. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -78
  390. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +0 -220
  391. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +0 -154
  392. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -134
  393. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -134
  394. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -140
  395. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +0 -67
  396. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +0 -90
  397. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +0 -83
  398. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +0 -83
  399. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +0 -102
  400. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +0 -91
  401. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +0 -94
  402. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +0 -92
  403. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +0 -96
  404. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +0 -61
  405. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +0 -112
  406. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +0 -117
  407. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +0 -120
  408. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +0 -131
  409. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +0 -93
  410. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +0 -109
  411. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +0 -113
  412. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +0 -145
  413. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +0 -103
  414. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +0 -114
  415. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +0 -103
  416. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +0 -103
  417. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +0 -113
  418. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +0 -120
  419. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +0 -103
  420. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +0 -137
  421. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +0 -116
  422. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +0 -148
  423. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +0 -140
  424. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +0 -121
  425. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +0 -155
  426. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +0 -121
  427. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +0 -102
  428. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +0 -103
  429. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +0 -103
  430. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +0 -111
  431. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +0 -109
  432. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +0 -111
  433. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +0 -147
  434. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +0 -152
  435. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +0 -113
  436. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +0 -108
  437. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +0 -106
  438. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +0 -109
  439. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +0 -108
  440. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +0 -109
  441. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +0 -111
  442. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +0 -68
  443. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double.c +0 -43
  444. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +0 -69
  445. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +0 -46
  446. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +0 -115
  447. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +0 -80
  448. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_args.c +0 -70
  449. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_many_mixed_float_double.c +0 -55
  450. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +0 -78
  451. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +0 -79
  452. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +0 -94
  453. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +0 -99
  454. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +0 -78
  455. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +0 -94
  456. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +0 -79
  457. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +0 -152
  458. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +0 -47
  459. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +0 -44
  460. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +0 -45
  461. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +0 -125
  462. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +0 -45
  463. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +0 -47
  464. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +0 -49
  465. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +0 -49
  466. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +0 -49
  467. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +0 -46
  468. data/ext/ffi_c/libffi/testsuite/libffi.closures/err_bad_abi.c +0 -36
  469. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +0 -1
  470. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +0 -343
  471. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +0 -175
  472. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +0 -161
  473. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +0 -146
  474. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +0 -137
  475. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +0 -86
  476. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +0 -115
  477. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +0 -119
  478. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +0 -120
  479. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +0 -120
  480. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +0 -121
  481. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +0 -142
  482. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +0 -120
  483. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +0 -142
  484. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +0 -142
  485. data/ext/ffi_c/libffi/testsuite/libffi.closures/problem1.c +0 -90
  486. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +0 -86
  487. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +0 -102
  488. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +0 -101
  489. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large.c +0 -145
  490. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_large2.c +0 -148
  491. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +0 -124
  492. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +0 -125
  493. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +0 -75
  494. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +0 -118
  495. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +0 -55
  496. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
  497. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
  498. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
  499. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
  500. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
  501. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
  502. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
  503. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
  504. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
  505. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
  506. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
  507. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
  508. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
  509. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
  510. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
  511. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
  512. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
  513. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
  514. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
  515. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
  516. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
  517. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
  518. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
  519. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
  520. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
  521. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
  522. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
  523. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
  524. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
  525. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
  526. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
  527. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
  528. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
  529. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
  530. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
  531. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
  532. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
  533. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
  534. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
  535. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
  536. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
  537. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
  538. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
  539. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
  540. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
  541. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
  542. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
  543. data/ext/ffi_c/libffi.bsd.mk +0 -40
  544. data/ext/ffi_c/libffi.darwin.mk +0 -105
  545. data/ext/ffi_c/libffi.gnu.mk +0 -32
  546. data/ext/ffi_c/libffi.mk +0 -18
  547. data/ext/ffi_c/libffi.vc.mk +0 -26
  548. data/ext/ffi_c/libffi.vc64.mk +0 -26
  549. data/ext/ffi_c/rbffi.h +0 -55
  550. data/ext/ffi_c/rbffi_endian.h +0 -59
@@ -1,1309 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- ffi.c - Copyright (c) 2011 Anthony Green
3
- Copyright (c) 2008 David Daney
4
- Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc.
5
-
6
- MIPS Foreign Function Interface
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining
9
- a copy of this software and associated documentation files (the
10
- ``Software''), to deal in the Software without restriction, including
11
- without limitation the rights to use, copy, modify, merge, publish,
12
- distribute, sublicense, and/or sell copies of the Software, and to
13
- permit persons to whom the Software is furnished to do so, subject to
14
- the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included
17
- in all copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
20
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26
- DEALINGS IN THE SOFTWARE.
27
- ----------------------------------------------------------------------- */
28
-
29
- #include <ffi.h>
30
- #include <ffi_common.h>
31
-
32
- #include <stdint.h>
33
- #include <stdlib.h>
34
- #include <stdio.h>
35
-
36
- #ifdef __GNUC__
37
- # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
38
- # define USE__BUILTIN___CLEAR_CACHE 1
39
- # endif
40
- #endif
41
-
42
- #ifndef USE__BUILTIN___CLEAR_CACHE
43
- # if defined(__FreeBSD__)
44
- # include <machine/sysarch.h>
45
- # elif defined(__OpenBSD__)
46
- # include <mips64/sysarch.h>
47
- # else
48
- # include <sys/cachectl.h>
49
- # endif
50
- #endif
51
-
52
- #ifdef FFI_DEBUG
53
- # define FFI_MIPS_STOP_HERE() ffi_stop_here()
54
- #else
55
- # define FFI_MIPS_STOP_HERE() do {} while(0)
56
- #endif
57
-
58
- #ifdef FFI_MIPS_N32
59
- #define FIX_ARGP \
60
- FFI_ASSERT(argp <= &stack[bytes]); \
61
- if (argp == &stack[bytes]) \
62
- { \
63
- argp = stack; \
64
- FFI_MIPS_STOP_HERE(); \
65
- }
66
- #else
67
- #define FIX_ARGP
68
- #endif
69
-
70
-
71
- /* ffi_prep_args is called by the assembly routine once stack space
72
- has been allocated for the function's arguments */
73
-
74
- static void ffi_prep_args(char *stack,
75
- extended_cif *ecif,
76
- int bytes,
77
- int flags)
78
- {
79
- int i;
80
- void **p_argv;
81
- char *argp, *argp_f;
82
- ffi_type **p_arg;
83
-
84
- memset(stack, 0, bytes);
85
-
86
- #ifdef FFI_MIPS_N32
87
- int soft_float = (ecif->cif->abi == FFI_N32_SOFT_FLOAT
88
- || ecif->cif->abi == FFI_N64_SOFT_FLOAT);
89
- /* If more than 8 double words are used, the remainder go
90
- on the stack. We reorder stuff on the stack here to
91
- support this easily. */
92
- /* if ret is _Complex long double, args reg shift2, and a0 should holds pointer to rvalue */
93
- if (ecif->cif->rtype->type == FFI_TYPE_COMPLEX && ecif->cif->rtype->elements[0]->type == FFI_TYPE_LONGDOUBLE)
94
- {
95
- if (bytes + 16 > 8 * sizeof(ffi_arg))
96
- argp = &stack[bytes - (8 * sizeof(ffi_arg))];
97
- else
98
- argp = stack;
99
- * (unsigned long *) argp = (unsigned long) ecif->rvalue;
100
- argp += 16;
101
- }
102
- else
103
- {
104
- if (bytes > 8 * sizeof(ffi_arg))
105
- argp = &stack[bytes - (8 * sizeof(ffi_arg))];
106
- else
107
- argp = stack;
108
- }
109
- #else
110
- argp = stack;
111
- #endif
112
-
113
- argp_f = argp;
114
-
115
- #ifdef FFI_MIPS_N32
116
- if ( ecif->cif->rstruct_flag != 0 )
117
- #else
118
- if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT )
119
- #endif
120
- {
121
- *(ffi_arg *) argp = (ffi_arg) ecif->rvalue;
122
- argp += sizeof(ffi_arg);
123
- FIX_ARGP;
124
- }
125
-
126
- p_argv = ecif->avalue;
127
-
128
- for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++)
129
- {
130
- size_t z;
131
- unsigned int a;
132
-
133
- /* Align if necessary. */
134
- a = (*p_arg)->alignment;
135
- if (a < sizeof(ffi_arg))
136
- a = sizeof(ffi_arg);
137
-
138
- if ((a - 1) & (unsigned long) argp)
139
- {
140
- argp = (char *) FFI_ALIGN(argp, a);
141
- FIX_ARGP;
142
- }
143
-
144
- z = (*p_arg)->size;
145
- if (z <= sizeof(ffi_arg))
146
- {
147
- int type = (*p_arg)->type;
148
- z = sizeof(ffi_arg);
149
-
150
- /* The size of a pointer depends on the ABI */
151
- if (type == FFI_TYPE_POINTER)
152
- type = (ecif->cif->abi == FFI_N64
153
- || ecif->cif->abi == FFI_N64_SOFT_FLOAT)
154
- ? FFI_TYPE_SINT64 : FFI_TYPE_UINT32;
155
-
156
- if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT
157
- || ecif->cif->abi == FFI_N64_SOFT_FLOAT))
158
- {
159
- switch (type)
160
- {
161
- case FFI_TYPE_FLOAT:
162
- type = FFI_TYPE_UINT32;
163
- break;
164
- case FFI_TYPE_DOUBLE:
165
- type = FFI_TYPE_UINT64;
166
- break;
167
- default:
168
- break;
169
- }
170
- }
171
- switch (type)
172
- {
173
- case FFI_TYPE_SINT8:
174
- *(ffi_arg *)argp = *(SINT8 *)(* p_argv);
175
- break;
176
-
177
- case FFI_TYPE_UINT8:
178
- *(ffi_arg *)argp = *(UINT8 *)(* p_argv);
179
- break;
180
-
181
- case FFI_TYPE_SINT16:
182
- *(ffi_arg *)argp = *(SINT16 *)(* p_argv);
183
- break;
184
-
185
- case FFI_TYPE_UINT16:
186
- *(ffi_arg *)argp = *(UINT16 *)(* p_argv);
187
- break;
188
-
189
- case FFI_TYPE_SINT32:
190
- *(ffi_arg *)argp = *(SINT32 *)(* p_argv);
191
- break;
192
-
193
- case FFI_TYPE_UINT32:
194
- #ifdef FFI_MIPS_N32
195
- /* The N32 ABI requires that 32-bit integers
196
- be sign-extended to 64-bits, regardless of
197
- whether they are signed or unsigned. */
198
- *(ffi_arg *)argp = *(SINT32 *)(* p_argv);
199
- #else
200
- *(ffi_arg *)argp = *(UINT32 *)(* p_argv);
201
- #endif
202
- break;
203
-
204
- #ifdef FFI_MIPS_N32
205
- case FFI_TYPE_COMPLEX:
206
- /* expand from 4+4 to 8+8 if pass with fpr reg */
207
- /* argp will wind back to stack when we process all of reg args */
208
- /* all var_args passed with gpr, should be expand */
209
- if(!soft_float
210
- && (*p_arg)->elements[0]->type == FFI_TYPE_FLOAT
211
- && argp>=argp_f
212
- && i < ecif->cif->mips_nfixedargs)
213
- {
214
- *(float *) argp = *(float *)(* p_argv);
215
- argp += z;
216
- char *tmp = (void *) (*p_argv);
217
- *(float *) argp = *(float *)(tmp+4);
218
- }
219
- else
220
- memcpy(argp, *p_argv, (*p_arg)->size);
221
- break;
222
- #endif
223
- /* This can only happen with 64bit slots. */
224
- case FFI_TYPE_FLOAT:
225
- *(float *) argp = *(float *)(* p_argv);
226
- break;
227
-
228
- /* Handle structures. */
229
- default:
230
- memcpy(argp, *p_argv, (*p_arg)->size);
231
- break;
232
- }
233
- }
234
- else
235
- {
236
- #ifdef FFI_MIPS_O32
237
- memcpy(argp, *p_argv, z);
238
- #else
239
- {
240
- unsigned long end = (unsigned long) argp + z;
241
- unsigned long cap = (unsigned long) stack + bytes;
242
-
243
- /* Check if the data will fit within the register space.
244
- Handle it if it doesn't. */
245
-
246
- if (end <= cap)
247
- memcpy(argp, *p_argv, z);
248
- else
249
- {
250
- unsigned long portion = cap - (unsigned long)argp;
251
-
252
- memcpy(argp, *p_argv, portion);
253
- argp = stack;
254
- z -= portion;
255
- memcpy(argp, (void*)((unsigned long)(*p_argv) + portion),
256
- z);
257
- }
258
- }
259
- #endif
260
- }
261
- p_argv++;
262
- argp += z;
263
- FIX_ARGP;
264
- }
265
- }
266
-
267
- #ifdef FFI_MIPS_N32
268
-
269
- /* The n32 spec says that if "a chunk consists solely of a double
270
- float field (but not a double, which is part of a union), it
271
- is passed in a floating point register. Any other chunk is
272
- passed in an integer register". This code traverses structure
273
- definitions and generates the appropriate flags. */
274
-
275
- static int
276
- calc_n32_struct_flags_element(unsigned *flags, ffi_type *e,
277
- unsigned *loc, unsigned *arg_reg)
278
- {
279
- /* Align this object. */
280
- *loc = FFI_ALIGN(*loc, e->alignment);
281
- if (e->type == FFI_TYPE_DOUBLE)
282
- {
283
- /* Already aligned to FFI_SIZEOF_ARG. */
284
- *arg_reg = *loc / FFI_SIZEOF_ARG;
285
- if (*arg_reg > 7)
286
- return 1;
287
- *flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS));
288
- }
289
- *loc += e->size;
290
- return 0;
291
- }
292
-
293
- static unsigned
294
- calc_n32_struct_flags(int soft_float, ffi_type *arg,
295
- unsigned *loc, unsigned *arg_reg)
296
- {
297
- unsigned flags = 0;
298
- unsigned index = 0;
299
-
300
- ffi_type *e;
301
-
302
- if (soft_float)
303
- return 0;
304
-
305
- while ((e = arg->elements[index]))
306
- {
307
- if (e->type == FFI_TYPE_COMPLEX)
308
- {
309
- if (calc_n32_struct_flags_element(&flags, e->elements[0], loc, arg_reg))
310
- break;
311
- if (calc_n32_struct_flags_element(&flags, e->elements[0], loc, arg_reg))
312
- break;
313
- }
314
- else
315
- if (calc_n32_struct_flags_element(&flags, e, loc, arg_reg))
316
- break;
317
- index++;
318
- }
319
- /* Next Argument register at alignment of FFI_SIZEOF_ARG. */
320
- *arg_reg = FFI_ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
321
-
322
- return flags;
323
- }
324
-
325
- static unsigned
326
- calc_n32_return_struct_flags(int soft_float, ffi_type *arg)
327
- {
328
- unsigned flags;
329
- unsigned small = FFI_TYPE_SMALLSTRUCT;
330
- ffi_type *e;
331
-
332
- /* Returning structures under n32 is a tricky thing.
333
- A struct with only one or two floating point fields
334
- is returned in $f0 (and $f2 if necessary). Any other
335
- struct results at most 128 bits are returned in $2
336
- (the first 64 bits) and $3 (remainder, if necessary).
337
- Larger structs are handled normally. */
338
-
339
- if (arg->size > 16)
340
- return 0;
341
-
342
- if (arg->size > 8)
343
- small = FFI_TYPE_SMALLSTRUCT2;
344
-
345
- e = arg->elements[0];
346
-
347
- if (e->type == FFI_TYPE_COMPLEX)
348
- {
349
- int type = e->elements[0]->type;
350
-
351
- if (type != FFI_TYPE_DOUBLE && type != FFI_TYPE_FLOAT)
352
- return small;
353
-
354
- if (arg->elements[1])
355
- {
356
- /* Two floating point fields with more fields!
357
- This must be passed the old way. */
358
- return small;
359
- }
360
-
361
- flags = (type << FFI_FLAG_BITS) + type;
362
- }
363
- else
364
- {
365
- if (e->type != FFI_TYPE_DOUBLE && e->type != FFI_TYPE_FLOAT)
366
- return small;
367
-
368
- flags = e->type;
369
-
370
- if (arg->elements[1])
371
- {
372
- e = arg->elements[1];
373
- if (e->type != FFI_TYPE_DOUBLE && e->type != FFI_TYPE_FLOAT)
374
- return small;
375
-
376
- if (arg->elements[2])
377
- {
378
- /* There are three arguments and the first two are
379
- floats! This must be passed the old way. */
380
- return small;
381
- }
382
-
383
- flags += e->type << FFI_FLAG_BITS;
384
- }
385
- }
386
-
387
- if (soft_float)
388
- flags += FFI_TYPE_STRUCT_SOFT;
389
- return flags;
390
- }
391
-
392
- #endif
393
-
394
- /* Perform machine dependent cif processing */
395
- static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs)
396
- {
397
- cif->flags = 0;
398
- cif->mips_nfixedargs = nfixedargs;
399
-
400
- #ifdef FFI_MIPS_O32
401
- /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT
402
- * does not have special handling for floating point args.
403
- */
404
-
405
- if (cif->rtype->type != FFI_TYPE_STRUCT && cif->rtype->type != FFI_TYPE_COMPLEX && cif->abi == FFI_O32)
406
- {
407
- if (cif->nargs > 0 && cif->nargs == nfixedargs)
408
- {
409
- switch ((cif->arg_types)[0]->type)
410
- {
411
- case FFI_TYPE_FLOAT:
412
- case FFI_TYPE_DOUBLE:
413
- cif->flags += (cif->arg_types)[0]->type;
414
- break;
415
-
416
- default:
417
- break;
418
- }
419
-
420
- if (cif->nargs > 1)
421
- {
422
- /* Only handle the second argument if the first
423
- is a float or double. */
424
- if (cif->flags)
425
- {
426
- switch ((cif->arg_types)[1]->type)
427
- {
428
- case FFI_TYPE_FLOAT:
429
- case FFI_TYPE_DOUBLE:
430
- cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS;
431
- break;
432
-
433
- default:
434
- break;
435
- }
436
- }
437
- }
438
- }
439
- }
440
-
441
- /* Set the return type flag */
442
-
443
- if (cif->abi == FFI_O32_SOFT_FLOAT)
444
- {
445
- switch (cif->rtype->type)
446
- {
447
- case FFI_TYPE_VOID:
448
- case FFI_TYPE_STRUCT:
449
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2);
450
- break;
451
-
452
- case FFI_TYPE_SINT64:
453
- case FFI_TYPE_UINT64:
454
- case FFI_TYPE_DOUBLE:
455
- cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2);
456
- break;
457
-
458
- case FFI_TYPE_FLOAT:
459
- default:
460
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2);
461
- break;
462
- }
463
- }
464
- else
465
- {
466
- /* FFI_O32 */
467
- switch (cif->rtype->type)
468
- {
469
- case FFI_TYPE_VOID:
470
- case FFI_TYPE_STRUCT:
471
- case FFI_TYPE_FLOAT:
472
- case FFI_TYPE_DOUBLE:
473
- case FFI_TYPE_COMPLEX:
474
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2);
475
- if (cif->rtype->type == FFI_TYPE_COMPLEX)
476
- cif->flags += ((*cif->rtype->elements[0]).type) << (FFI_FLAG_BITS * 4);
477
- break;
478
-
479
- case FFI_TYPE_SINT64:
480
- case FFI_TYPE_UINT64:
481
- cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2);
482
- break;
483
-
484
- default:
485
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2);
486
- break;
487
- }
488
- }
489
- #endif
490
-
491
- #ifdef FFI_MIPS_N32
492
- /* Set the flags necessary for N32 processing */
493
- {
494
- unsigned arg_reg = 0;
495
- unsigned loc = 0;
496
- unsigned count = (cif->nargs < 8) ? cif->nargs : 8;
497
- unsigned index = 0;
498
-
499
- unsigned struct_flags = 0;
500
- int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT
501
- || cif->abi == FFI_N64_SOFT_FLOAT);
502
-
503
- if (cif->rtype->type == FFI_TYPE_STRUCT)
504
- {
505
- struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype);
506
-
507
- if (struct_flags == 0)
508
- {
509
- /* This means that the structure is being passed as
510
- a hidden argument */
511
-
512
- arg_reg = 1;
513
- count = (cif->nargs < 7) ? cif->nargs : 7;
514
-
515
- cif->rstruct_flag = !0;
516
- }
517
- else
518
- cif->rstruct_flag = 0;
519
- }
520
- else
521
- cif->rstruct_flag = 0;
522
-
523
- while (count-- > 0 && arg_reg < 8)
524
- {
525
- ffi_type *t = cif->arg_types[index];
526
-
527
- switch (t->type)
528
- {
529
- case FFI_TYPE_FLOAT:
530
- case FFI_TYPE_DOUBLE:
531
- if (!soft_float && index < nfixedargs)
532
- cif->flags += t->type << (arg_reg * FFI_FLAG_BITS);
533
- arg_reg++;
534
- break;
535
- case FFI_TYPE_LONGDOUBLE:
536
- /* Align it. */
537
- arg_reg = FFI_ALIGN(arg_reg, 2);
538
- /* Treat it as two adjacent doubles. */
539
- if (soft_float || index >= nfixedargs)
540
- {
541
- arg_reg += 2;
542
- }
543
- else
544
- {
545
- cif->flags +=
546
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
547
- arg_reg++;
548
- if (arg_reg >= 8)
549
- continue;
550
- cif->flags +=
551
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
552
- arg_reg++;
553
- }
554
- break;
555
-
556
- case FFI_TYPE_COMPLEX:
557
- switch (t->elements[0]->type)
558
- {
559
- case FFI_TYPE_LONGDOUBLE:
560
- arg_reg = FFI_ALIGN(arg_reg, 2);
561
- if (soft_float || index >= nfixedargs)
562
- {
563
- arg_reg += 2;
564
- }
565
- else
566
- {
567
- cif->flags +=
568
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
569
- arg_reg++;
570
- if (arg_reg >= 8)
571
- continue;
572
- cif->flags +=
573
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
574
- arg_reg++;
575
- if (arg_reg >= 8)
576
- continue;
577
- }
578
- /* passthrough */
579
- case FFI_TYPE_FLOAT:
580
- // one fpr can only holds one arg even it is single
581
- cif->bytes += 16;
582
- /* passthrough */
583
- case FFI_TYPE_SINT32:
584
- case FFI_TYPE_UINT32:
585
- case FFI_TYPE_DOUBLE:
586
- if (soft_float || index >= nfixedargs)
587
- {
588
- arg_reg += 2;
589
- }
590
- else
591
- {
592
- uint32_t type = t->elements[0]->type != FFI_TYPE_LONGDOUBLE? t->elements[0]->type: FFI_TYPE_DOUBLE;
593
- cif->flags +=
594
- (type << (arg_reg * FFI_FLAG_BITS));
595
- arg_reg++;
596
- if (arg_reg >= 8)
597
- continue;
598
- cif->flags +=
599
- (type << (arg_reg * FFI_FLAG_BITS));
600
- arg_reg++;
601
- }
602
- break;
603
- default:
604
- arg_reg += 2;
605
- break;
606
- }
607
- break;
608
-
609
- case FFI_TYPE_STRUCT:
610
- loc = arg_reg * FFI_SIZEOF_ARG;
611
- cif->flags += calc_n32_struct_flags(soft_float || index >= nfixedargs,
612
- t, &loc, &arg_reg);
613
- break;
614
-
615
- default:
616
- arg_reg++;
617
- break;
618
- }
619
-
620
- index++;
621
- }
622
-
623
- /* Set the return type flag */
624
- switch (cif->rtype->type)
625
- {
626
- case FFI_TYPE_STRUCT:
627
- {
628
- if (struct_flags == 0)
629
- {
630
- /* The structure is returned through a hidden
631
- first argument. Do nothing, 'cause FFI_TYPE_VOID
632
- is 0 */
633
- }
634
- else
635
- {
636
- /* The structure is returned via some tricky
637
- mechanism */
638
- cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
639
- cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8));
640
- }
641
- break;
642
- }
643
-
644
- case FFI_TYPE_VOID:
645
- /* Do nothing, 'cause FFI_TYPE_VOID is 0 */
646
- break;
647
-
648
- case FFI_TYPE_POINTER:
649
- if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32)
650
- cif->flags += FFI_TYPE_UINT32 << (FFI_FLAG_BITS * 8);
651
- else
652
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
653
- break;
654
-
655
- case FFI_TYPE_FLOAT:
656
- if (soft_float)
657
- {
658
- cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8);
659
- break;
660
- }
661
- /* else fall through */
662
- case FFI_TYPE_DOUBLE:
663
- if (soft_float)
664
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
665
- else
666
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8);
667
- break;
668
-
669
- case FFI_TYPE_LONGDOUBLE:
670
- /* Long double is returned as if it were a struct containing
671
- two doubles. */
672
- if (soft_float)
673
- {
674
- /* if ret is long double, the ret is given by v0 and a0, no idea why
675
- * Let's us VOID | VOID | LONGDOUBLE for it*/
676
- cif->flags += FFI_TYPE_LONGDOUBLE << (FFI_FLAG_BITS * 8);
677
- }
678
- else
679
- {
680
- cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
681
- cif->flags += (FFI_TYPE_DOUBLE
682
- + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS))
683
- << (4 + (FFI_FLAG_BITS * 8));
684
- }
685
- break;
686
- case FFI_TYPE_COMPLEX:
687
- {
688
- int type = cif->rtype->elements[0]->type;
689
-
690
- cif->flags += (FFI_TYPE_COMPLEX << (FFI_FLAG_BITS * 8));
691
- if (soft_float || (type != FFI_TYPE_FLOAT && type != FFI_TYPE_DOUBLE && type != FFI_TYPE_LONGDOUBLE))
692
- {
693
- switch (type)
694
- {
695
- case FFI_TYPE_DOUBLE:
696
- case FFI_TYPE_SINT64:
697
- case FFI_TYPE_UINT64:
698
- case FFI_TYPE_INT:
699
- type = FFI_TYPE_SMALLSTRUCT2;
700
- break;
701
- case FFI_TYPE_LONGDOUBLE:
702
- type = FFI_TYPE_LONGDOUBLE;
703
- break;
704
- case FFI_TYPE_FLOAT:
705
- default:
706
- type = FFI_TYPE_SMALLSTRUCT;
707
- }
708
- cif->flags += type << (4 + (FFI_FLAG_BITS * 8));
709
- }
710
- else
711
- {
712
- //cif->flags += (type + (type << FFI_FLAG_BITS))
713
- // << (4 + (FFI_FLAG_BITS * 8));
714
- cif->flags += type << (4 + (FFI_FLAG_BITS * 8));
715
- }
716
- break;
717
- }
718
- default:
719
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
720
- break;
721
- }
722
- }
723
- #endif
724
- return FFI_OK;
725
- }
726
-
727
- ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
728
- {
729
- return ffi_prep_cif_machdep_int(cif, cif->nargs);
730
- }
731
-
732
- ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
733
- unsigned nfixedargs,
734
- unsigned ntotalargs MAYBE_UNUSED)
735
- {
736
- return ffi_prep_cif_machdep_int(cif, nfixedargs);
737
- }
738
-
739
- /* Low level routine for calling O32 functions */
740
- extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int),
741
- extended_cif *, unsigned,
742
- unsigned, unsigned *, void (*)(void), void *closure);
743
-
744
- /* Low level routine for calling N32 functions */
745
- extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int),
746
- extended_cif *, unsigned,
747
- unsigned, void *, void (*)(void), void *closure);
748
-
749
- void ffi_call_int(ffi_cif *cif, void (*fn)(void), void *rvalue,
750
- void **avalue, void *closure)
751
- {
752
- extended_cif ecif;
753
-
754
- ecif.cif = cif;
755
- ecif.avalue = avalue;
756
-
757
- /* If the return value is a struct and we don't have a return */
758
- /* value address then we need to make one */
759
-
760
- if ((rvalue == NULL) &&
761
- (cif->rtype->type == FFI_TYPE_STRUCT || cif->rtype->type == FFI_TYPE_COMPLEX))
762
- ecif.rvalue = alloca(cif->rtype->size);
763
- else
764
- ecif.rvalue = rvalue;
765
-
766
- switch (cif->abi)
767
- {
768
- #ifdef FFI_MIPS_O32
769
- case FFI_O32:
770
- case FFI_O32_SOFT_FLOAT:
771
- ffi_call_O32(ffi_prep_args, &ecif, cif->bytes,
772
- cif->flags, ecif.rvalue, fn, closure);
773
- break;
774
- #endif
775
-
776
- #ifdef FFI_MIPS_N32
777
- case FFI_N32:
778
- case FFI_N32_SOFT_FLOAT:
779
- case FFI_N64:
780
- case FFI_N64_SOFT_FLOAT:
781
- {
782
- int copy_rvalue = 0;
783
- int copy_offset = 0;
784
- char *rvalue_copy = ecif.rvalue;
785
- if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16)
786
- {
787
- /* For structures smaller than 16 bytes we clobber memory
788
- in 8 byte increments. Make a copy so we don't clobber
789
- the callers memory outside of the struct bounds. */
790
- rvalue_copy = alloca(16);
791
- copy_rvalue = 1;
792
- }
793
- else if (cif->rtype->type == FFI_TYPE_FLOAT
794
- && (cif->abi == FFI_N64_SOFT_FLOAT
795
- || cif->abi == FFI_N32_SOFT_FLOAT))
796
- {
797
- rvalue_copy = alloca (8);
798
- copy_rvalue = 1;
799
- #if defined(__MIPSEB__) || defined(_MIPSEB)
800
- copy_offset = 4;
801
- #endif
802
- }
803
- ffi_call_N32(ffi_prep_args, &ecif, cif->bytes,
804
- cif->flags, rvalue_copy, fn, closure);
805
- if (copy_rvalue)
806
- memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size);
807
- }
808
- break;
809
- #endif
810
-
811
- default:
812
- FFI_ASSERT(0);
813
- break;
814
- }
815
- }
816
-
817
- void
818
- ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
819
- {
820
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
821
- }
822
-
823
- void
824
- ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
825
- void **avalue, void *closure)
826
- {
827
- ffi_call_int (cif, fn, rvalue, avalue, closure);
828
- }
829
-
830
-
831
- #if FFI_CLOSURES
832
- #if defined(FFI_MIPS_O32)
833
- extern void ffi_closure_O32(void);
834
- extern void ffi_go_closure_O32(void);
835
- #else
836
- extern void ffi_closure_N32(void);
837
- extern void ffi_go_closure_N32(void);
838
- #endif /* FFI_MIPS_O32 */
839
-
840
- ffi_status
841
- ffi_prep_closure_loc (ffi_closure *closure,
842
- ffi_cif *cif,
843
- void (*fun)(ffi_cif*,void*,void**,void*),
844
- void *user_data,
845
- void *codeloc)
846
- {
847
- unsigned int *tramp = (unsigned int *) &closure->tramp[0];
848
- void * fn;
849
- char *clear_location = (char *) codeloc;
850
-
851
- #if defined(FFI_MIPS_O32)
852
- if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
853
- return FFI_BAD_ABI;
854
- fn = ffi_closure_O32;
855
- #else
856
- #if _MIPS_SIM ==_ABIN32
857
- if (cif->abi != FFI_N32
858
- && cif->abi != FFI_N32_SOFT_FLOAT)
859
- return FFI_BAD_ABI;
860
- #else
861
- if (cif->abi != FFI_N64
862
- && cif->abi != FFI_N64_SOFT_FLOAT)
863
- return FFI_BAD_ABI;
864
- #endif
865
- fn = ffi_closure_N32;
866
- #endif /* FFI_MIPS_O32 */
867
-
868
- #if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32)
869
- /* lui $25,high(fn) */
870
- tramp[0] = 0x3c190000 | ((unsigned)fn >> 16);
871
- /* ori $25,low(fn) */
872
- tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff);
873
- /* lui $12,high(codeloc) */
874
- tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16);
875
- /* jr $25 */
876
- #if !defined(__mips_isa_rev) || (__mips_isa_rev<6)
877
- tramp[3] = 0x03200008;
878
- #else
879
- tramp[3] = 0x03200009;
880
- #endif
881
- /* ori $12,low(codeloc) */
882
- tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff);
883
- #else
884
- /* N64 has a somewhat larger trampoline. */
885
- /* lui $25,high(fn) */
886
- tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48);
887
- /* lui $12,high(codeloc) */
888
- tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48);
889
- /* ori $25,mid-high(fn) */
890
- tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff);
891
- /* ori $12,mid-high(codeloc) */
892
- tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff);
893
- /* dsll $25,$25,16 */
894
- tramp[4] = 0x0019cc38;
895
- /* dsll $12,$12,16 */
896
- tramp[5] = 0x000c6438;
897
- /* ori $25,mid-low(fn) */
898
- tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff);
899
- /* ori $12,mid-low(codeloc) */
900
- tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff);
901
- /* dsll $25,$25,16 */
902
- tramp[8] = 0x0019cc38;
903
- /* dsll $12,$12,16 */
904
- tramp[9] = 0x000c6438;
905
- /* ori $25,low(fn) */
906
- tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff);
907
- /* jr $25 */
908
- #if !defined(__mips_isa_rev) || (__mips_isa_rev<6)
909
- tramp[11] = 0x03200008;
910
- #else
911
- tramp[11] = 0x03200009;
912
- #endif
913
- /* ori $12,low(codeloc) */
914
- tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff);
915
-
916
- #endif
917
-
918
- closure->cif = cif;
919
- closure->fun = fun;
920
- closure->user_data = user_data;
921
-
922
- #if !defined(__FreeBSD__)
923
- #ifdef USE__BUILTIN___CLEAR_CACHE
924
- __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
925
- #else
926
- cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
927
- #endif
928
- #endif /* ! __FreeBSD__ */
929
- return FFI_OK;
930
- }
931
-
932
- /*
933
- * Decodes the arguments to a function, which will be stored on the
934
- * stack. AR is the pointer to the beginning of the integer arguments
935
- * (and, depending upon the arguments, some floating-point arguments
936
- * as well). FPR is a pointer to the area where floating point
937
- * registers have been saved, if any.
938
- *
939
- * RVALUE is the location where the function return value will be
940
- * stored. CLOSURE is the prepared closure to invoke.
941
- *
942
- * This function should only be called from assembly, which is in
943
- * turn called from a trampoline.
944
- *
945
- * Returns the function return type.
946
- *
947
- * Based on the similar routine for sparc.
948
- */
949
- int
950
- ffi_closure_mips_inner_O32 (ffi_cif *cif,
951
- void (*fun)(ffi_cif*, void*, void**, void*),
952
- void *user_data,
953
- void *rvalue, ffi_arg *ar,
954
- double *fpr)
955
- {
956
- void **avaluep;
957
- ffi_arg *avalue;
958
- ffi_type **arg_types;
959
- int i, avn, argn, seen_int;
960
-
961
- avalue = alloca (cif->nargs * sizeof (ffi_arg));
962
- avaluep = alloca (cif->nargs * sizeof (ffi_arg));
963
-
964
- seen_int = (cif->abi == FFI_O32_SOFT_FLOAT) || (cif->mips_nfixedargs != cif->nargs);
965
- argn = 0;
966
-
967
- if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT)
968
- {
969
- rvalue = (void *)(uintptr_t)ar[0];
970
- argn = 1;
971
- seen_int = 1;
972
- }
973
- if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_COMPLEX)
974
- {
975
- rvalue = fpr;
976
- argn = 1;
977
- }
978
-
979
- i = 0;
980
- avn = cif->nargs;
981
- arg_types = cif->arg_types;
982
-
983
- while (i < avn)
984
- {
985
- if (arg_types[i]->alignment == 8 && (argn & 0x1))
986
- argn++;
987
- if (i < 2 && !seen_int &&
988
- (arg_types[i]->type == FFI_TYPE_FLOAT ||
989
- arg_types[i]->type == FFI_TYPE_DOUBLE ||
990
- arg_types[i]->type == FFI_TYPE_LONGDOUBLE))
991
- {
992
- #if defined(__MIPSEB__) || defined(_MIPSEB)
993
- if (arg_types[i]->type == FFI_TYPE_FLOAT)
994
- avaluep[i] = ((char *) &fpr[i]) + sizeof (float);
995
- else
996
- #endif
997
- avaluep[i] = (char *) &fpr[i];
998
- }
999
- else
1000
- {
1001
- switch (arg_types[i]->type)
1002
- {
1003
- case FFI_TYPE_SINT8:
1004
- avaluep[i] = &avalue[i];
1005
- *(SINT8 *) &avalue[i] = (SINT8) ar[argn];
1006
- break;
1007
-
1008
- case FFI_TYPE_UINT8:
1009
- avaluep[i] = &avalue[i];
1010
- *(UINT8 *) &avalue[i] = (UINT8) ar[argn];
1011
- break;
1012
-
1013
- case FFI_TYPE_SINT16:
1014
- avaluep[i] = &avalue[i];
1015
- *(SINT16 *) &avalue[i] = (SINT16) ar[argn];
1016
- break;
1017
-
1018
- case FFI_TYPE_UINT16:
1019
- avaluep[i] = &avalue[i];
1020
- *(UINT16 *) &avalue[i] = (UINT16) ar[argn];
1021
- break;
1022
-
1023
- default:
1024
- avaluep[i] = (char *) &ar[argn];
1025
- break;
1026
- }
1027
- seen_int = 1;
1028
- }
1029
- argn += FFI_ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
1030
- i++;
1031
- }
1032
-
1033
- /* Invoke the closure. */
1034
- fun(cif, rvalue, avaluep, user_data);
1035
-
1036
- if (cif->abi == FFI_O32_SOFT_FLOAT)
1037
- {
1038
- switch (cif->rtype->type)
1039
- {
1040
- case FFI_TYPE_FLOAT:
1041
- return FFI_TYPE_INT;
1042
- case FFI_TYPE_DOUBLE:
1043
- return FFI_TYPE_UINT64;
1044
- default:
1045
- return cif->rtype->type;
1046
- }
1047
- }
1048
- else
1049
- {
1050
- if (cif->rtype->type == FFI_TYPE_COMPLEX) {
1051
- __asm__ volatile ("move $v1, %0" : : "r"(cif->rtype->size));
1052
- }
1053
- return cif->rtype->type;
1054
- }
1055
- }
1056
-
1057
- #if defined(FFI_MIPS_N32)
1058
-
1059
- static void
1060
- copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type,
1061
- int argn, unsigned arg_offset, ffi_arg *ar,
1062
- ffi_arg *fpr, int soft_float)
1063
- {
1064
- ffi_type **elt_typep = type->elements;
1065
- while(*elt_typep)
1066
- {
1067
- ffi_type *elt_type = *elt_typep;
1068
- unsigned o;
1069
- char *tp;
1070
- char *argp;
1071
- char *fpp;
1072
-
1073
- o = FFI_ALIGN(offset, elt_type->alignment);
1074
- arg_offset += o - offset;
1075
- offset = o;
1076
- argn += arg_offset / sizeof(ffi_arg);
1077
- arg_offset = arg_offset % sizeof(ffi_arg);
1078
-
1079
- argp = (char *)(ar + argn);
1080
- fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn);
1081
-
1082
- tp = target + offset;
1083
-
1084
- if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float)
1085
- *(double *)tp = *(double *)fpp;
1086
- else
1087
- memcpy(tp, argp + arg_offset, elt_type->size);
1088
-
1089
- offset += elt_type->size;
1090
- arg_offset += elt_type->size;
1091
- elt_typep++;
1092
- argn += arg_offset / sizeof(ffi_arg);
1093
- arg_offset = arg_offset % sizeof(ffi_arg);
1094
- }
1095
- }
1096
-
1097
- /*
1098
- * Decodes the arguments to a function, which will be stored on the
1099
- * stack. AR is the pointer to the beginning of the integer
1100
- * arguments. FPR is a pointer to the area where floating point
1101
- * registers have been saved.
1102
- *
1103
- * RVALUE is the location where the function return value will be
1104
- * stored. CLOSURE is the prepared closure to invoke.
1105
- *
1106
- * This function should only be called from assembly, which is in
1107
- * turn called from a trampoline.
1108
- *
1109
- * Returns the function return flags.
1110
- *
1111
- */
1112
- int
1113
- ffi_closure_mips_inner_N32 (ffi_cif *cif,
1114
- void (*fun)(ffi_cif*, void*, void**, void*),
1115
- void *user_data,
1116
- void *rvalue, ffi_arg *ar,
1117
- ffi_arg *fpr)
1118
- {
1119
- void **avaluep;
1120
- ffi_arg *avalue;
1121
- ffi_type **arg_types;
1122
- int i, avn, argn;
1123
- int soft_float;
1124
- ffi_arg *argp;
1125
-
1126
- soft_float = cif->abi == FFI_N64_SOFT_FLOAT
1127
- || cif->abi == FFI_N32_SOFT_FLOAT;
1128
- avalue = alloca (cif->nargs * sizeof (ffi_arg));
1129
- avaluep = alloca (cif->nargs * sizeof (ffi_arg));
1130
-
1131
- argn = 0;
1132
-
1133
- if (cif->rstruct_flag)
1134
- {
1135
- #if _MIPS_SIM==_ABIN32
1136
- rvalue = (void *)(UINT32)ar[0];
1137
- #else /* N64 */
1138
- rvalue = (void *)ar[0];
1139
- #endif
1140
- argn = 1;
1141
- }
1142
- if (cif->rtype->type == FFI_TYPE_COMPLEX && cif->rtype->elements[0]->type == FFI_TYPE_LONGDOUBLE)
1143
- argn = 2;
1144
-
1145
- i = 0;
1146
- avn = cif->nargs;
1147
- arg_types = cif->arg_types;
1148
-
1149
- while (i < avn)
1150
- {
1151
- if (arg_types[i]->type == FFI_TYPE_FLOAT
1152
- || arg_types[i]->type == FFI_TYPE_DOUBLE
1153
- || arg_types[i]->type == FFI_TYPE_LONGDOUBLE)
1154
- {
1155
- argp = (argn >= 8 || i >= cif->mips_nfixedargs || soft_float) ? ar + argn : fpr + argn;
1156
- if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((uintptr_t)argp & (arg_types[i]->alignment-1)))
1157
- {
1158
- argp=(ffi_arg*)FFI_ALIGN(argp,arg_types[i]->alignment);
1159
- argn++;
1160
- }
1161
- #if defined(__MIPSEB__) || defined(_MIPSEB)
1162
- if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8)
1163
- avaluep[i] = ((char *) argp) + sizeof (float);
1164
- else
1165
- #endif
1166
- avaluep[i] = (char *) argp;
1167
- }
1168
- else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
1169
- {
1170
- argp = (argn >= 8 || i >= cif->mips_nfixedargs || soft_float) ? ar + argn : fpr + argn;
1171
- avaluep[i] = (char *) argp;
1172
- }
1173
- else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_LONGDOUBLE)
1174
- {
1175
- /* align long double */
1176
- argn += ((argn & 0x1)? 1 : 0);
1177
- argp = (argn >= 8 || i >= cif->mips_nfixedargs || soft_float) ? ar + argn : fpr + argn;
1178
- avaluep[i] = (char *) argp;
1179
- }
1180
- else if (arg_types[i]->type == FFI_TYPE_COMPLEX && arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT)
1181
- {
1182
- if (argn >= 8 || i >= cif->mips_nfixedargs || soft_float)
1183
- argp = ar + argn;
1184
- else
1185
- {
1186
- argp = fpr + argn;
1187
- /* the normal args for function holds 8bytes, while here we convert it to ptr */
1188
- uint32_t *tmp = (uint32_t *)argp;
1189
- tmp[1] = tmp[2];
1190
- }
1191
- avaluep[i] = (char *) argp;
1192
- }
1193
- else
1194
- {
1195
- unsigned type = arg_types[i]->type;
1196
-
1197
- if (arg_types[i]->alignment > sizeof(ffi_arg))
1198
- argn = FFI_ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg));
1199
-
1200
- argp = ar + argn;
1201
-
1202
- /* The size of a pointer depends on the ABI */
1203
- if (type == FFI_TYPE_POINTER)
1204
- type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT)
1205
- ? FFI_TYPE_SINT64 : FFI_TYPE_UINT32;
1206
-
1207
- if (soft_float && type == FFI_TYPE_FLOAT)
1208
- type = FFI_TYPE_SINT32;
1209
-
1210
- switch (type)
1211
- {
1212
- case FFI_TYPE_SINT8:
1213
- avaluep[i] = &avalue[i];
1214
- *(SINT8 *) &avalue[i] = (SINT8) *argp;
1215
- break;
1216
-
1217
- case FFI_TYPE_UINT8:
1218
- avaluep[i] = &avalue[i];
1219
- *(UINT8 *) &avalue[i] = (UINT8) *argp;
1220
- break;
1221
-
1222
- case FFI_TYPE_SINT16:
1223
- avaluep[i] = &avalue[i];
1224
- *(SINT16 *) &avalue[i] = (SINT16) *argp;
1225
- break;
1226
-
1227
- case FFI_TYPE_UINT16:
1228
- avaluep[i] = &avalue[i];
1229
- *(UINT16 *) &avalue[i] = (UINT16) *argp;
1230
- break;
1231
-
1232
- case FFI_TYPE_SINT32:
1233
- avaluep[i] = &avalue[i];
1234
- *(SINT32 *) &avalue[i] = (SINT32) *argp;
1235
- break;
1236
-
1237
- case FFI_TYPE_UINT32:
1238
- avaluep[i] = &avalue[i];
1239
- *(UINT32 *) &avalue[i] = (UINT32) *argp;
1240
- break;
1241
-
1242
- case FFI_TYPE_STRUCT:
1243
- if (argn < 8)
1244
- {
1245
- /* Allocate space for the struct as at least part of
1246
- it was passed in registers. */
1247
- avaluep[i] = alloca(arg_types[i]->size);
1248
- copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i],
1249
- argn, 0, ar, fpr, i >= cif->mips_nfixedargs || soft_float);
1250
-
1251
- break;
1252
- }
1253
- /* Else fall through. */
1254
- default:
1255
- avaluep[i] = (char *) argp;
1256
- break;
1257
- }
1258
- }
1259
- argn += FFI_ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg);
1260
- i++;
1261
- }
1262
-
1263
- /* Invoke the closure. */
1264
- fun (cif, rvalue, avaluep, user_data);
1265
-
1266
- return cif->flags >> (FFI_FLAG_BITS * 8);
1267
- }
1268
-
1269
- #endif /* FFI_MIPS_N32 */
1270
-
1271
- #if defined(FFI_MIPS_O32)
1272
- extern void ffi_closure_O32(void);
1273
- extern void ffi_go_closure_O32(void);
1274
- #else
1275
- extern void ffi_closure_N32(void);
1276
- extern void ffi_go_closure_N32(void);
1277
- #endif /* FFI_MIPS_O32 */
1278
-
1279
- ffi_status
1280
- ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
1281
- void (*fun)(ffi_cif*,void*,void**,void*))
1282
- {
1283
- void * fn;
1284
-
1285
- #if defined(FFI_MIPS_O32)
1286
- if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
1287
- return FFI_BAD_ABI;
1288
- fn = ffi_go_closure_O32;
1289
- #else
1290
- #if _MIPS_SIM ==_ABIN32
1291
- if (cif->abi != FFI_N32
1292
- && cif->abi != FFI_N32_SOFT_FLOAT)
1293
- return FFI_BAD_ABI;
1294
- #else
1295
- if (cif->abi != FFI_N64
1296
- && cif->abi != FFI_N64_SOFT_FLOAT)
1297
- return FFI_BAD_ABI;
1298
- #endif
1299
- fn = ffi_go_closure_N32;
1300
- #endif /* FFI_MIPS_O32 */
1301
-
1302
- closure->tramp = (void *)fn;
1303
- closure->cif = cif;
1304
- closure->fun = fun;
1305
-
1306
- return FFI_OK;
1307
- }
1308
-
1309
- #endif /* FFI_CLOSURES */