ffi 1.9.21-x86-mingw32 → 1.9.22-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 (551) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +22 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +52 -0
  5. data/.yardopts +5 -0
  6. data/Gemfile +15 -0
  7. data/{spec/ffi/LICENSE.SPECS → LICENSE.SPECS} +1 -1
  8. data/README.md +1 -1
  9. data/Rakefile +28 -3
  10. data/appveyor.yml +22 -0
  11. data/ffi.gemspec +14 -1
  12. data/lib/2.0/ffi_c.so +0 -0
  13. data/lib/2.1/ffi_c.so +0 -0
  14. data/lib/2.2/ffi_c.so +0 -0
  15. data/lib/2.3/ffi_c.so +0 -0
  16. data/lib/2.4/ffi_c.so +0 -0
  17. data/lib/2.5/ffi_c.so +0 -0
  18. data/lib/ffi/library.rb +1 -1
  19. data/lib/ffi/version.rb +1 -1
  20. data/samples/getlogin.rb +8 -0
  21. data/samples/getpid.rb +8 -0
  22. data/samples/gettimeofday.rb +18 -0
  23. data/samples/hello.rb +7 -0
  24. data/samples/inotify.rb +60 -0
  25. data/samples/pty.rb +76 -0
  26. data/samples/qsort.rb +21 -0
  27. data/samples/sample_helper.rb +6 -0
  28. metadata +17 -526
  29. data/ext/ffi_c/AbstractMemory.c +0 -1109
  30. data/ext/ffi_c/AbstractMemory.h +0 -175
  31. data/ext/ffi_c/ArrayType.c +0 -162
  32. data/ext/ffi_c/ArrayType.h +0 -59
  33. data/ext/ffi_c/Buffer.c +0 -365
  34. data/ext/ffi_c/Call.c +0 -517
  35. data/ext/ffi_c/Call.h +0 -110
  36. data/ext/ffi_c/ClosurePool.c +0 -283
  37. data/ext/ffi_c/ClosurePool.h +0 -57
  38. data/ext/ffi_c/DataConverter.c +0 -91
  39. data/ext/ffi_c/DynamicLibrary.c +0 -339
  40. data/ext/ffi_c/DynamicLibrary.h +0 -98
  41. data/ext/ffi_c/Function.c +0 -998
  42. data/ext/ffi_c/Function.h +0 -87
  43. data/ext/ffi_c/FunctionInfo.c +0 -271
  44. data/ext/ffi_c/LastError.c +0 -184
  45. data/ext/ffi_c/LastError.h +0 -47
  46. data/ext/ffi_c/LongDouble.c +0 -63
  47. data/ext/ffi_c/LongDouble.h +0 -51
  48. data/ext/ffi_c/MappedType.c +0 -168
  49. data/ext/ffi_c/MappedType.h +0 -59
  50. data/ext/ffi_c/MemoryPointer.c +0 -197
  51. data/ext/ffi_c/MemoryPointer.h +0 -53
  52. data/ext/ffi_c/MethodHandle.c +0 -358
  53. data/ext/ffi_c/MethodHandle.h +0 -55
  54. data/ext/ffi_c/Platform.c +0 -129
  55. data/ext/ffi_c/Platform.h +0 -45
  56. data/ext/ffi_c/Pointer.c +0 -508
  57. data/ext/ffi_c/Pointer.h +0 -63
  58. data/ext/ffi_c/Struct.c +0 -829
  59. data/ext/ffi_c/Struct.h +0 -106
  60. data/ext/ffi_c/StructByReference.c +0 -190
  61. data/ext/ffi_c/StructByReference.h +0 -50
  62. data/ext/ffi_c/StructByValue.c +0 -150
  63. data/ext/ffi_c/StructByValue.h +0 -55
  64. data/ext/ffi_c/StructLayout.c +0 -698
  65. data/ext/ffi_c/Thread.c +0 -352
  66. data/ext/ffi_c/Thread.h +0 -95
  67. data/ext/ffi_c/Type.c +0 -397
  68. data/ext/ffi_c/Type.h +0 -62
  69. data/ext/ffi_c/Types.c +0 -139
  70. data/ext/ffi_c/Types.h +0 -89
  71. data/ext/ffi_c/Variadic.c +0 -304
  72. data/ext/ffi_c/compat.h +0 -78
  73. data/ext/ffi_c/extconf.rb +0 -71
  74. data/ext/ffi_c/ffi.c +0 -98
  75. data/ext/ffi_c/libffi.bsd.mk +0 -40
  76. data/ext/ffi_c/libffi.darwin.mk +0 -105
  77. data/ext/ffi_c/libffi.gnu.mk +0 -32
  78. data/ext/ffi_c/libffi.mk +0 -18
  79. data/ext/ffi_c/libffi.vc.mk +0 -26
  80. data/ext/ffi_c/libffi.vc64.mk +0 -26
  81. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  82. data/ext/ffi_c/libffi/ChangeLog.libffi-3.1 +0 -6000
  83. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  84. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  85. data/ext/ffi_c/libffi/LICENSE +0 -21
  86. data/ext/ffi_c/libffi/Makefile.am +0 -205
  87. data/ext/ffi_c/libffi/Makefile.in +0 -1805
  88. data/ext/ffi_c/libffi/README +0 -454
  89. data/ext/ffi_c/libffi/acinclude.m4 +0 -473
  90. data/ext/ffi_c/libffi/aclocal.m4 +0 -2134
  91. data/ext/ffi_c/libffi/autogen.sh +0 -2
  92. data/ext/ffi_c/libffi/autom4te.cache/output.0 +0 -21972
  93. data/ext/ffi_c/libffi/autom4te.cache/output.1 +0 -21972
  94. data/ext/ffi_c/libffi/autom4te.cache/output.2 +0 -21972
  95. data/ext/ffi_c/libffi/autom4te.cache/output.3 +0 -21972
  96. data/ext/ffi_c/libffi/autom4te.cache/requests +0 -331
  97. data/ext/ffi_c/libffi/autom4te.cache/traces.0 +0 -4010
  98. data/ext/ffi_c/libffi/autom4te.cache/traces.1 +0 -1005
  99. data/ext/ffi_c/libffi/autom4te.cache/traces.2 +0 -4010
  100. data/ext/ffi_c/libffi/autom4te.cache/traces.3 +0 -4010
  101. data/ext/ffi_c/libffi/compile +0 -347
  102. data/ext/ffi_c/libffi/config.guess +0 -1462
  103. data/ext/ffi_c/libffi/config.sub +0 -1825
  104. data/ext/ffi_c/libffi/configure +0 -21972
  105. data/ext/ffi_c/libffi/configure.ac +0 -388
  106. data/ext/ffi_c/libffi/configure.host +0 -272
  107. data/ext/ffi_c/libffi/depcomp +0 -791
  108. data/ext/ffi_c/libffi/doc/Makefile.am +0 -3
  109. data/ext/ffi_c/libffi/doc/Makefile.in +0 -811
  110. data/ext/ffi_c/libffi/doc/libffi.texi +0 -985
  111. data/ext/ffi_c/libffi/doc/mdate-sh +0 -228
  112. data/ext/ffi_c/libffi/doc/texinfo.tex +0 -10079
  113. data/ext/ffi_c/libffi/doc/version.texi +0 -4
  114. data/ext/ffi_c/libffi/fficonfig.h.in +0 -210
  115. data/ext/ffi_c/libffi/fficonfig.h.in~ +0 -210
  116. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +0 -207
  117. data/ext/ffi_c/libffi/include/Makefile.am +0 -9
  118. data/ext/ffi_c/libffi/include/Makefile.in +0 -604
  119. data/ext/ffi_c/libffi/include/ffi.h.in +0 -484
  120. data/ext/ffi_c/libffi/include/ffi_cfi.h +0 -55
  121. data/ext/ffi_c/libffi/include/ffi_common.h +0 -147
  122. data/ext/ffi_c/libffi/install-sh +0 -508
  123. data/ext/ffi_c/libffi/libffi.map.in +0 -80
  124. data/ext/ffi_c/libffi/libffi.pc.in +0 -11
  125. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +0 -637
  126. data/ext/ffi_c/libffi/libtool-ldflags +0 -106
  127. data/ext/ffi_c/libffi/libtool-version +0 -29
  128. data/ext/ffi_c/libffi/ltmain.sh +0 -11156
  129. data/ext/ffi_c/libffi/m4/asmcfi.m4 +0 -13
  130. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +0 -69
  131. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +0 -181
  132. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +0 -122
  133. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +0 -72
  134. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +0 -84
  135. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +0 -70
  136. data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +0 -301
  137. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +0 -225
  138. data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +0 -79
  139. data/ext/ffi_c/libffi/m4/libtool.m4 +0 -8387
  140. data/ext/ffi_c/libffi/m4/ltoptions.m4 +0 -437
  141. data/ext/ffi_c/libffi/m4/ltsugar.m4 +0 -124
  142. data/ext/ffi_c/libffi/m4/ltversion.m4 +0 -23
  143. data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +0 -99
  144. data/ext/ffi_c/libffi/man/Makefile.am +0 -8
  145. data/ext/ffi_c/libffi/man/Makefile.in +0 -558
  146. data/ext/ffi_c/libffi/man/ffi.3 +0 -41
  147. data/ext/ffi_c/libffi/man/ffi_call.3 +0 -103
  148. data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +0 -68
  149. data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +0 -73
  150. data/ext/ffi_c/libffi/missing +0 -215
  151. data/ext/ffi_c/libffi/msvcc.sh +0 -260
  152. data/ext/ffi_c/libffi/src/aarch64/ffi.c +0 -941
  153. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +0 -81
  154. data/ext/ffi_c/libffi/src/aarch64/internal.h +0 -67
  155. data/ext/ffi_c/libffi/src/aarch64/sysv.S +0 -438
  156. data/ext/ffi_c/libffi/src/alpha/ffi.c +0 -521
  157. data/ext/ffi_c/libffi/src/alpha/ffitarget.h +0 -57
  158. data/ext/ffi_c/libffi/src/alpha/internal.h +0 -23
  159. data/ext/ffi_c/libffi/src/alpha/osf.S +0 -282
  160. data/ext/ffi_c/libffi/src/arc/arcompact.S +0 -135
  161. data/ext/ffi_c/libffi/src/arc/ffi.c +0 -266
  162. data/ext/ffi_c/libffi/src/arc/ffitarget.h +0 -53
  163. data/ext/ffi_c/libffi/src/arm/ffi.c +0 -808
  164. data/ext/ffi_c/libffi/src/arm/ffitarget.h +0 -82
  165. data/ext/ffi_c/libffi/src/arm/internal.h +0 -7
  166. data/ext/ffi_c/libffi/src/arm/sysv.S +0 -383
  167. data/ext/ffi_c/libffi/src/avr32/ffi.c +0 -423
  168. data/ext/ffi_c/libffi/src/avr32/ffitarget.h +0 -55
  169. data/ext/ffi_c/libffi/src/avr32/sysv.S +0 -208
  170. data/ext/ffi_c/libffi/src/bfin/ffi.c +0 -196
  171. data/ext/ffi_c/libffi/src/bfin/ffitarget.h +0 -43
  172. data/ext/ffi_c/libffi/src/bfin/sysv.S +0 -179
  173. data/ext/ffi_c/libffi/src/closures.c +0 -890
  174. data/ext/ffi_c/libffi/src/cris/ffi.c +0 -386
  175. data/ext/ffi_c/libffi/src/cris/ffitarget.h +0 -56
  176. data/ext/ffi_c/libffi/src/cris/sysv.S +0 -215
  177. data/ext/ffi_c/libffi/src/debug.c +0 -64
  178. data/ext/ffi_c/libffi/src/dlmalloc.c +0 -5166
  179. data/ext/ffi_c/libffi/src/frv/eabi.S +0 -128
  180. data/ext/ffi_c/libffi/src/frv/ffi.c +0 -292
  181. data/ext/ffi_c/libffi/src/frv/ffitarget.h +0 -62
  182. data/ext/ffi_c/libffi/src/ia64/ffi.c +0 -586
  183. data/ext/ffi_c/libffi/src/ia64/ffitarget.h +0 -55
  184. data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +0 -40
  185. data/ext/ffi_c/libffi/src/ia64/unix.S +0 -560
  186. data/ext/ffi_c/libffi/src/java_raw_api.c +0 -374
  187. data/ext/ffi_c/libffi/src/m32r/ffi.c +0 -232
  188. data/ext/ffi_c/libffi/src/m32r/ffitarget.h +0 -53
  189. data/ext/ffi_c/libffi/src/m32r/sysv.S +0 -121
  190. data/ext/ffi_c/libffi/src/m68k/ffi.c +0 -362
  191. data/ext/ffi_c/libffi/src/m68k/ffitarget.h +0 -54
  192. data/ext/ffi_c/libffi/src/m68k/sysv.S +0 -357
  193. data/ext/ffi_c/libffi/src/m88k/ffi.c +0 -400
  194. data/ext/ffi_c/libffi/src/m88k/ffitarget.h +0 -49
  195. data/ext/ffi_c/libffi/src/m88k/obsd.S +0 -209
  196. data/ext/ffi_c/libffi/src/metag/ffi.c +0 -330
  197. data/ext/ffi_c/libffi/src/metag/ffitarget.h +0 -53
  198. data/ext/ffi_c/libffi/src/metag/sysv.S +0 -311
  199. data/ext/ffi_c/libffi/src/microblaze/ffi.c +0 -321
  200. data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +0 -53
  201. data/ext/ffi_c/libffi/src/microblaze/sysv.S +0 -302
  202. data/ext/ffi_c/libffi/src/mips/ffi.c +0 -1105
  203. data/ext/ffi_c/libffi/src/mips/ffitarget.h +0 -249
  204. data/ext/ffi_c/libffi/src/mips/n32.S +0 -661
  205. data/ext/ffi_c/libffi/src/mips/o32.S +0 -502
  206. data/ext/ffi_c/libffi/src/moxie/eabi.S +0 -101
  207. data/ext/ffi_c/libffi/src/moxie/ffi.c +0 -272
  208. data/ext/ffi_c/libffi/src/moxie/ffitarget.h +0 -52
  209. data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
  210. data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
  211. data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
  212. data/ext/ffi_c/libffi/src/or1k/ffi.c +0 -328
  213. data/ext/ffi_c/libffi/src/or1k/ffitarget.h +0 -58
  214. data/ext/ffi_c/libffi/src/or1k/sysv.S +0 -107
  215. data/ext/ffi_c/libffi/src/pa/ffi.c +0 -719
  216. data/ext/ffi_c/libffi/src/pa/ffitarget.h +0 -85
  217. data/ext/ffi_c/libffi/src/pa/hpux32.S +0 -368
  218. data/ext/ffi_c/libffi/src/pa/linux.S +0 -357
  219. data/ext/ffi_c/libffi/src/powerpc/aix.S +0 -328
  220. data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +0 -447
  221. data/ext/ffi_c/libffi/src/powerpc/asm.h +0 -125
  222. data/ext/ffi_c/libffi/src/powerpc/darwin.S +0 -378
  223. data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +0 -571
  224. data/ext/ffi_c/libffi/src/powerpc/ffi.c +0 -173
  225. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +0 -1359
  226. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +0 -945
  227. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +0 -94
  228. data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +0 -923
  229. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +0 -195
  230. data/ext/ffi_c/libffi/src/powerpc/linux64.S +0 -228
  231. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +0 -488
  232. data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +0 -397
  233. data/ext/ffi_c/libffi/src/powerpc/sysv.S +0 -175
  234. data/ext/ffi_c/libffi/src/prep_cif.c +0 -261
  235. data/ext/ffi_c/libffi/src/raw_api.c +0 -267
  236. data/ext/ffi_c/libffi/src/s390/ffi.c +0 -756
  237. data/ext/ffi_c/libffi/src/s390/ffitarget.h +0 -70
  238. data/ext/ffi_c/libffi/src/s390/internal.h +0 -11
  239. data/ext/ffi_c/libffi/src/s390/sysv.S +0 -325
  240. data/ext/ffi_c/libffi/src/sh/ffi.c +0 -717
  241. data/ext/ffi_c/libffi/src/sh/ffitarget.h +0 -54
  242. data/ext/ffi_c/libffi/src/sh/sysv.S +0 -850
  243. data/ext/ffi_c/libffi/src/sh64/ffi.c +0 -469
  244. data/ext/ffi_c/libffi/src/sh64/ffitarget.h +0 -58
  245. data/ext/ffi_c/libffi/src/sh64/sysv.S +0 -539
  246. data/ext/ffi_c/libffi/src/sparc/ffi.c +0 -468
  247. data/ext/ffi_c/libffi/src/sparc/ffi64.c +0 -608
  248. data/ext/ffi_c/libffi/src/sparc/ffitarget.h +0 -81
  249. data/ext/ffi_c/libffi/src/sparc/internal.h +0 -26
  250. data/ext/ffi_c/libffi/src/sparc/v8.S +0 -443
  251. data/ext/ffi_c/libffi/src/sparc/v9.S +0 -440
  252. data/ext/ffi_c/libffi/src/tile/ffi.c +0 -355
  253. data/ext/ffi_c/libffi/src/tile/ffitarget.h +0 -65
  254. data/ext/ffi_c/libffi/src/tile/tile.S +0 -360
  255. data/ext/ffi_c/libffi/src/types.c +0 -106
  256. data/ext/ffi_c/libffi/src/vax/elfbsd.S +0 -195
  257. data/ext/ffi_c/libffi/src/vax/ffi.c +0 -276
  258. data/ext/ffi_c/libffi/src/vax/ffitarget.h +0 -49
  259. data/ext/ffi_c/libffi/src/x86/asmnames.h +0 -30
  260. data/ext/ffi_c/libffi/src/x86/ffi.c +0 -733
  261. data/ext/ffi_c/libffi/src/x86/ffi64.c +0 -857
  262. data/ext/ffi_c/libffi/src/x86/ffitarget.h +0 -141
  263. data/ext/ffi_c/libffi/src/x86/ffiw64.c +0 -287
  264. data/ext/ffi_c/libffi/src/x86/internal.h +0 -29
  265. data/ext/ffi_c/libffi/src/x86/internal64.h +0 -22
  266. data/ext/ffi_c/libffi/src/x86/sysv.S +0 -1043
  267. data/ext/ffi_c/libffi/src/x86/unix64.S +0 -525
  268. data/ext/ffi_c/libffi/src/x86/win64.S +0 -232
  269. data/ext/ffi_c/libffi/src/x86/win64_intel.S +0 -237
  270. data/ext/ffi_c/libffi/src/xtensa/ffi.c +0 -298
  271. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +0 -53
  272. data/ext/ffi_c/libffi/src/xtensa/sysv.S +0 -253
  273. data/ext/ffi_c/libffi/stamp-h.in +0 -1
  274. data/ext/ffi_c/libffi/testsuite/Makefile.am +0 -85
  275. data/ext/ffi_c/libffi/testsuite/Makefile.in +0 -607
  276. data/ext/ffi_c/libffi/testsuite/config/default.exp +0 -1
  277. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +0 -445
  278. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +0 -283
  279. data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +0 -45
  280. data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +0 -46
  281. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +0 -30
  282. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +0 -89
  283. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +0 -81
  284. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +0 -81
  285. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +0 -82
  286. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +0 -89
  287. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +0 -92
  288. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +0 -90
  289. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +0 -95
  290. data/ext/ffi_c/libffi/testsuite/libffi.call/closure_simple.c +0 -55
  291. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +0 -94
  292. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +0 -95
  293. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +0 -96
  294. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +0 -102
  295. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +0 -89
  296. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +0 -91
  297. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +0 -93
  298. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +0 -113
  299. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +0 -90
  300. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +0 -95
  301. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +0 -90
  302. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +0 -90
  303. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +0 -98
  304. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +0 -90
  305. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +0 -109
  306. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +0 -98
  307. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +0 -124
  308. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +0 -113
  309. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +0 -99
  310. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +0 -117
  311. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +0 -97
  312. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +0 -88
  313. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +0 -90
  314. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +0 -91
  315. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +0 -93
  316. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +0 -91
  317. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +0 -92
  318. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +0 -132
  319. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +0 -115
  320. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +0 -95
  321. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +0 -91
  322. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +0 -91
  323. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +0 -92
  324. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +0 -91
  325. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +0 -91
  326. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +0 -93
  327. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +0 -66
  328. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +0 -43
  329. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +0 -61
  330. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +0 -42
  331. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +0 -105
  332. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +0 -61
  333. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_args.c +0 -70
  334. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +0 -55
  335. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +0 -74
  336. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +0 -74
  337. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +0 -86
  338. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +0 -91
  339. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +0 -74
  340. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +0 -86
  341. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +0 -74
  342. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +0 -142
  343. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +0 -44
  344. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +0 -42
  345. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +0 -42
  346. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_struct_va1.c +0 -114
  347. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +0 -42
  348. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
  349. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +0 -43
  350. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint_va.c +0 -45
  351. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulong_va.c +0 -45
  352. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +0 -47
  353. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +0 -43
  354. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
  355. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +0 -36
  356. data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +0 -26
  357. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +0 -136
  358. data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +0 -59
  359. data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +0 -60
  360. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +0 -60
  361. data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +0 -74
  362. data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +0 -62
  363. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +0 -107
  364. data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +0 -341
  365. data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +0 -59
  366. data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +0 -57
  367. data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +0 -70
  368. data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +0 -78
  369. data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +0 -52
  370. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +0 -152
  371. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +0 -161
  372. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +0 -133
  373. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct11.c +0 -121
  374. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +0 -110
  375. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +0 -111
  376. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +0 -111
  377. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +0 -112
  378. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +0 -131
  379. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +0 -111
  380. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +0 -131
  381. data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +0 -131
  382. data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +0 -46
  383. data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +0 -127
  384. data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +0 -90
  385. data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +0 -59
  386. data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +0 -114
  387. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +0 -36
  388. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +0 -43
  389. data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +0 -42
  390. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +0 -35
  391. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +0 -36
  392. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +0 -49
  393. data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +0 -42
  394. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +0 -34
  395. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +0 -41
  396. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +0 -43
  397. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +0 -36
  398. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +0 -38
  399. data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +0 -38
  400. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +0 -38
  401. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +0 -145
  402. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +0 -148
  403. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +0 -124
  404. data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +0 -125
  405. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +0 -44
  406. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +0 -49
  407. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +0 -49
  408. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +0 -55
  409. data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +0 -67
  410. data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +0 -67
  411. data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +0 -60
  412. data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +0 -64
  413. data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +0 -66
  414. data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +0 -64
  415. data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +0 -74
  416. data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +0 -81
  417. data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +0 -68
  418. data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +0 -70
  419. data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +0 -61
  420. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +0 -117
  421. data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +0 -54
  422. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +0 -196
  423. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +0 -121
  424. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +0 -123
  425. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +0 -125
  426. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +0 -91
  427. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +0 -10
  428. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +0 -10
  429. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +0 -10
  430. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +0 -42
  431. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +0 -10
  432. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +0 -10
  433. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +0 -10
  434. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +0 -71
  435. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +0 -10
  436. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +0 -10
  437. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +0 -10
  438. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +0 -80
  439. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +0 -10
  440. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +0 -16
  441. data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +0 -10
  442. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +0 -36
  443. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +0 -51
  444. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +0 -7
  445. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +0 -7
  446. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +0 -7
  447. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +0 -10
  448. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +0 -10
  449. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +0 -86
  450. data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +0 -10
  451. data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +0 -1
  452. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +0 -78
  453. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +0 -10
  454. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +0 -10
  455. data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +0 -10
  456. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +0 -37
  457. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +0 -41
  458. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +0 -10
  459. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +0 -10
  460. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +0 -10
  461. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +0 -44
  462. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +0 -10
  463. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +0 -10
  464. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +0 -10
  465. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +0 -10
  466. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +0 -10
  467. data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +0 -10
  468. data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +0 -34
  469. data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +0 -28
  470. data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +0 -1
  471. data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +0 -36
  472. data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +0 -19
  473. data/ext/ffi_c/rbffi.h +0 -57
  474. data/ext/ffi_c/rbffi_endian.h +0 -59
  475. data/ext/ffi_c/win32/stdbool.h +0 -8
  476. data/ext/ffi_c/win32/stdint.h +0 -201
  477. data/gen/Rakefile +0 -30
  478. data/libtest/Benchmark.c +0 -52
  479. data/libtest/BoolTest.c +0 -34
  480. data/libtest/BufferTest.c +0 -31
  481. data/libtest/ClosureTest.c +0 -205
  482. data/libtest/EnumTest.c +0 -51
  483. data/libtest/FunctionTest.c +0 -70
  484. data/libtest/GNUmakefile +0 -149
  485. data/libtest/GlobalVariable.c +0 -62
  486. data/libtest/LastErrorTest.c +0 -21
  487. data/libtest/NumberTest.c +0 -132
  488. data/libtest/PointerTest.c +0 -63
  489. data/libtest/ReferenceTest.c +0 -23
  490. data/libtest/StringTest.c +0 -34
  491. data/libtest/StructTest.c +0 -243
  492. data/libtest/UnionTest.c +0 -43
  493. data/libtest/VariadicTest.c +0 -99
  494. data/spec/ffi/async_callback_spec.rb +0 -35
  495. data/spec/ffi/bitmask_spec.rb +0 -575
  496. data/spec/ffi/bool_spec.rb +0 -32
  497. data/spec/ffi/buffer_spec.rb +0 -279
  498. data/spec/ffi/callback_spec.rb +0 -773
  499. data/spec/ffi/custom_param_type.rb +0 -37
  500. data/spec/ffi/custom_type_spec.rb +0 -74
  501. data/spec/ffi/dup_spec.rb +0 -52
  502. data/spec/ffi/embed-test/ext/Makefile +0 -242
  503. data/spec/ffi/enum_spec.rb +0 -423
  504. data/spec/ffi/errno_spec.rb +0 -20
  505. data/spec/ffi/ffi_spec.rb +0 -28
  506. data/spec/ffi/fixtures/Benchmark.c +0 -52
  507. data/spec/ffi/fixtures/BitmaskTest.c +0 -51
  508. data/spec/ffi/fixtures/BoolTest.c +0 -34
  509. data/spec/ffi/fixtures/BufferTest.c +0 -31
  510. data/spec/ffi/fixtures/ClosureTest.c +0 -205
  511. data/spec/ffi/fixtures/EnumTest.c +0 -51
  512. data/spec/ffi/fixtures/FunctionTest.c +0 -142
  513. data/spec/ffi/fixtures/GNUmakefile +0 -149
  514. data/spec/ffi/fixtures/GlobalVariable.c +0 -62
  515. data/spec/ffi/fixtures/LastErrorTest.c +0 -21
  516. data/spec/ffi/fixtures/NumberTest.c +0 -132
  517. data/spec/ffi/fixtures/PipeHelper.h +0 -21
  518. data/spec/ffi/fixtures/PipeHelperPosix.c +0 -41
  519. data/spec/ffi/fixtures/PipeHelperWindows.c +0 -72
  520. data/spec/ffi/fixtures/PointerTest.c +0 -63
  521. data/spec/ffi/fixtures/ReferenceTest.c +0 -23
  522. data/spec/ffi/fixtures/StringTest.c +0 -34
  523. data/spec/ffi/fixtures/StructTest.c +0 -243
  524. data/spec/ffi/fixtures/UnionTest.c +0 -43
  525. data/spec/ffi/fixtures/VariadicTest.c +0 -99
  526. data/spec/ffi/fixtures/classes.rb +0 -438
  527. data/spec/ffi/function_spec.rb +0 -97
  528. data/spec/ffi/io_spec.rb +0 -16
  529. data/spec/ffi/library_spec.rb +0 -286
  530. data/spec/ffi/long_double.rb +0 -30
  531. data/spec/ffi/managed_struct_spec.rb +0 -68
  532. data/spec/ffi/memorypointer_spec.rb +0 -78
  533. data/spec/ffi/number_spec.rb +0 -247
  534. data/spec/ffi/platform_spec.rb +0 -114
  535. data/spec/ffi/pointer_spec.rb +0 -285
  536. data/spec/ffi/rbx/attach_function_spec.rb +0 -34
  537. data/spec/ffi/rbx/memory_pointer_spec.rb +0 -198
  538. data/spec/ffi/rbx/spec_helper.rb +0 -6
  539. data/spec/ffi/rbx/struct_spec.rb +0 -18
  540. data/spec/ffi/spec_helper.rb +0 -93
  541. data/spec/ffi/string_spec.rb +0 -118
  542. data/spec/ffi/strptr_spec.rb +0 -50
  543. data/spec/ffi/struct_by_ref_spec.rb +0 -43
  544. data/spec/ffi/struct_callback_spec.rb +0 -69
  545. data/spec/ffi/struct_initialize_spec.rb +0 -35
  546. data/spec/ffi/struct_packed_spec.rb +0 -50
  547. data/spec/ffi/struct_spec.rb +0 -882
  548. data/spec/ffi/typedef_spec.rb +0 -91
  549. data/spec/ffi/union_spec.rb +0 -67
  550. data/spec/ffi/variadic_spec.rb +0 -132
  551. data/spec/spec.opts +0 -4
@@ -1,53 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc
3
-
4
- Target configuration macros for MicroBlaze.
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- ``Software''), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included
15
- in all copies or substantial portions of the Software.
16
-
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
- ----------------------------------------------------------------------- */
26
-
27
- #ifndef LIBFFI_TARGET_H
28
- #define LIBFFI_TARGET_H
29
-
30
- #ifndef LIBFFI_H
31
- #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
32
- #endif
33
-
34
- #ifndef LIBFFI_ASM
35
- typedef unsigned long ffi_arg;
36
- typedef signed long ffi_sarg;
37
-
38
- typedef enum ffi_abi {
39
- FFI_FIRST_ABI = 0,
40
- FFI_SYSV,
41
- FFI_LAST_ABI,
42
- FFI_DEFAULT_ABI = FFI_SYSV
43
- } ffi_abi;
44
- #endif
45
-
46
- /* Definitions for closures */
47
-
48
- #define FFI_CLOSURES 1
49
- #define FFI_NATIVE_RAW_API 0
50
-
51
- #define FFI_TRAMPOLINE_SIZE (4*8)
52
-
53
- #endif
@@ -1,302 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc
3
-
4
- MicroBlaze Foreign Function Interface
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining
7
- a copy of this software and associated documentation files (the
8
- ``Software''), to deal in the Software without restriction, including
9
- without limitation the rights to use, copy, modify, merge, publish,
10
- distribute, sublicense, and/or sell copies of the Software, and to
11
- permit persons to whom the Software is furnished to do so, subject to
12
- the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included
15
- in all copies or substantial portions of the Software.
16
-
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
- ----------------------------------------------------------------------- */
26
-
27
- #define LIBFFI_ASM
28
- #include <fficonfig.h>
29
- #include <ffi.h>
30
-
31
- /*
32
- * arg[0] (r5) = ffi_prep_args,
33
- * arg[1] (r6) = &ecif,
34
- * arg[2] (r7) = cif->bytes,
35
- * arg[3] (r8) = cif->flags,
36
- * arg[4] (r9) = ecif.rvalue,
37
- * arg[5] (r10) = fn
38
- * arg[6] (sp[0]) = cif->rtype->type
39
- * arg[7] (sp[4]) = cif->rtype->size
40
- */
41
- .text
42
- .globl ffi_call_SYSV
43
- .type ffi_call_SYSV, @function
44
- ffi_call_SYSV:
45
- /* push callee saves */
46
- addik r1, r1, -20
47
- swi r19, r1, 0 /* Frame Pointer */
48
- swi r20, r1, 4 /* PIC register */
49
- swi r21, r1, 8 /* PIC register */
50
- swi r22, r1, 12 /* save for locals */
51
- swi r23, r1, 16 /* save for locals */
52
-
53
- /* save the r5-r10 registers in the stack */
54
- addik r1, r1, -24 /* increment sp to store 6x 32-bit words */
55
- swi r5, r1, 0
56
- swi r6, r1, 4
57
- swi r7, r1, 8
58
- swi r8, r1, 12
59
- swi r9, r1, 16
60
- swi r10, r1, 20
61
-
62
- /* save function pointer */
63
- addik r3, r5, 0 /* copy ffi_prep_args into r3 */
64
- addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */
65
- addik r23, r10, 0 /* save function address into r23 (callee-saved) */
66
-
67
- /* prepare stack with allocation for n (bytes = r7) args */
68
- rsub r1, r7, r1 /* subtract bytes from sp */
69
-
70
- /* prep args for ffi_prep_args call */
71
- addik r5, r1, 0 /* store stack pointer into arg[0] */
72
- /* r6 still holds ecif for arg[1] */
73
-
74
- /* Call ffi_prep_args(stack, &ecif). */
75
- addik r1, r1, -4
76
- swi r15, r1, 0 /* store the link register in the frame */
77
- brald r15, r3
78
- nop /* branch has delay slot */
79
- lwi r15, r1, 0
80
- addik r1, r1, 4 /* restore the link register from the frame */
81
- /* returns calling stack pointer location */
82
-
83
- /* prepare args for fn call, prep_args populates them onto the stack */
84
- lwi r5, r1, 0 /* arg[0] */
85
- lwi r6, r1, 4 /* arg[1] */
86
- lwi r7, r1, 8 /* arg[2] */
87
- lwi r8, r1, 12 /* arg[3] */
88
- lwi r9, r1, 16 /* arg[4] */
89
- lwi r10, r1, 20 /* arg[5] */
90
-
91
- /* call (fn) (...). */
92
- addik r1, r1, -4
93
- swi r15, r1, 0 /* store the link register in the frame */
94
- brald r15, r23
95
- nop /* branch has delay slot */
96
- lwi r15, r1, 0
97
- addik r1, r1, 4 /* restore the link register from the frame */
98
-
99
- /* Remove the space we pushed for the args. */
100
- addik r1, r22, 0 /* restore old SP */
101
-
102
- /* restore this functions parameters */
103
- lwi r5, r1, 0 /* arg[0] */
104
- lwi r6, r1, 4 /* arg[1] */
105
- lwi r7, r1, 8 /* arg[2] */
106
- lwi r8, r1, 12 /* arg[3] */
107
- lwi r9, r1, 16 /* arg[4] */
108
- lwi r10, r1, 20 /* arg[5] */
109
- addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */
110
-
111
- /* If the return value pointer is NULL, assume no return value. */
112
- beqi r9, ffi_call_SYSV_end
113
-
114
- lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */
115
- lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */
116
-
117
- /* Check if return type is actually a struct, do nothing */
118
- rsubi r11, r22, FFI_TYPE_STRUCT
119
- beqi r11, ffi_call_SYSV_end
120
-
121
- /* Return 8bit */
122
- rsubi r11, r23, 1
123
- beqi r11, ffi_call_SYSV_store8
124
-
125
- /* Return 16bit */
126
- rsubi r11, r23, 2
127
- beqi r11, ffi_call_SYSV_store16
128
-
129
- /* Return 32bit */
130
- rsubi r11, r23, 4
131
- beqi r11, ffi_call_SYSV_store32
132
-
133
- /* Return 64bit */
134
- rsubi r11, r23, 8
135
- beqi r11, ffi_call_SYSV_store64
136
-
137
- /* Didn't match anything */
138
- bri ffi_call_SYSV_end
139
-
140
- ffi_call_SYSV_store64:
141
- swi r3, r9, 0 /* store word r3 into return value */
142
- swi r4, r9, 4 /* store word r4 into return value */
143
- bri ffi_call_SYSV_end
144
-
145
- ffi_call_SYSV_store32:
146
- swi r3, r9, 0 /* store word r3 into return value */
147
- bri ffi_call_SYSV_end
148
-
149
- ffi_call_SYSV_store16:
150
- #ifdef __BIG_ENDIAN__
151
- shi r3, r9, 2 /* store half-word r3 into return value */
152
- #else
153
- shi r3, r9, 0 /* store half-word r3 into return value */
154
- #endif
155
- bri ffi_call_SYSV_end
156
-
157
- ffi_call_SYSV_store8:
158
- #ifdef __BIG_ENDIAN__
159
- sbi r3, r9, 3 /* store byte r3 into return value */
160
- #else
161
- sbi r3, r9, 0 /* store byte r3 into return value */
162
- #endif
163
- bri ffi_call_SYSV_end
164
-
165
- ffi_call_SYSV_end:
166
- /* callee restores */
167
- lwi r19, r1, 0 /* frame pointer */
168
- lwi r20, r1, 4 /* PIC register */
169
- lwi r21, r1, 8 /* PIC register */
170
- lwi r22, r1, 12
171
- lwi r23, r1, 16
172
- addik r1, r1, 20
173
-
174
- /* return from sub-routine (with delay slot) */
175
- rtsd r15, 8
176
- nop
177
-
178
- .size ffi_call_SYSV, . - ffi_call_SYSV
179
-
180
- /* ------------------------------------------------------------------------- */
181
-
182
- /*
183
- * args passed into this function, are passed down to the callee.
184
- * this function is the target of the closure trampoline, as such r12 is
185
- * a pointer to the closure object.
186
- */
187
- .text
188
- .globl ffi_closure_SYSV
189
- .type ffi_closure_SYSV, @function
190
- ffi_closure_SYSV:
191
- /* push callee saves */
192
- addik r11, r1, 28 /* save stack args start location (excluding regs/link) */
193
- addik r1, r1, -12
194
- swi r19, r1, 0 /* Frame Pointer */
195
- swi r20, r1, 4 /* PIC register */
196
- swi r21, r1, 8 /* PIC register */
197
-
198
- /* store register args on stack */
199
- addik r1, r1, -24
200
- swi r5, r1, 0
201
- swi r6, r1, 4
202
- swi r7, r1, 8
203
- swi r8, r1, 12
204
- swi r9, r1, 16
205
- swi r10, r1, 20
206
-
207
- /* setup args */
208
- addik r5, r1, 0 /* register_args */
209
- addik r6, r11, 0 /* stack_args */
210
- addik r7, r12, 0 /* closure object */
211
- addik r1, r1, -8 /* allocate return value */
212
- addik r8, r1, 0 /* void* rvalue */
213
- addik r1, r1, -8 /* allocate for return type/size values */
214
- addik r9, r1, 0 /* void* rtype */
215
- addik r10, r1, 4 /* void* rsize */
216
-
217
- /* call the wrap_call function */
218
- addik r1, r1, -28 /* allocate args + link reg */
219
- swi r15, r1, 0 /* store the link register in the frame */
220
- brald r15, r3
221
- nop /* branch has delay slot */
222
- lwi r15, r1, 0
223
- addik r1, r1, 28 /* restore the link register from the frame */
224
-
225
- ffi_closure_SYSV_prepare_return:
226
- lwi r9, r1, 0 /* rtype */
227
- lwi r10, r1, 4 /* rsize */
228
- addik r1, r1, 8 /* de-allocate return info values */
229
-
230
- /* Check if return type is actually a struct, store 4 bytes */
231
- rsubi r11, r9, FFI_TYPE_STRUCT
232
- beqi r11, ffi_closure_SYSV_store32
233
-
234
- /* Return 8bit */
235
- rsubi r11, r10, 1
236
- beqi r11, ffi_closure_SYSV_store8
237
-
238
- /* Return 16bit */
239
- rsubi r11, r10, 2
240
- beqi r11, ffi_closure_SYSV_store16
241
-
242
- /* Return 32bit */
243
- rsubi r11, r10, 4
244
- beqi r11, ffi_closure_SYSV_store32
245
-
246
- /* Return 64bit */
247
- rsubi r11, r10, 8
248
- beqi r11, ffi_closure_SYSV_store64
249
-
250
- /* Didn't match anything */
251
- bri ffi_closure_SYSV_end
252
-
253
- ffi_closure_SYSV_store64:
254
- lwi r3, r1, 0 /* store word r3 into return value */
255
- lwi r4, r1, 4 /* store word r4 into return value */
256
- /* 64 bits == 2 words, no sign extend occurs */
257
- bri ffi_closure_SYSV_end
258
-
259
- ffi_closure_SYSV_store32:
260
- lwi r3, r1, 0 /* store word r3 into return value */
261
- /* 32 bits == 1 word, no sign extend occurs */
262
- bri ffi_closure_SYSV_end
263
-
264
- ffi_closure_SYSV_store16:
265
- #ifdef __BIG_ENDIAN__
266
- lhui r3, r1, 2 /* store half-word r3 into return value */
267
- #else
268
- lhui r3, r1, 0 /* store half-word r3 into return value */
269
- #endif
270
- rsubi r11, r9, FFI_TYPE_SINT16
271
- bnei r11, ffi_closure_SYSV_end
272
- sext16 r3, r3 /* fix sign extend of sint8 */
273
- bri ffi_closure_SYSV_end
274
-
275
- ffi_closure_SYSV_store8:
276
- #ifdef __BIG_ENDIAN__
277
- lbui r3, r1, 3 /* store byte r3 into return value */
278
- #else
279
- lbui r3, r1, 0 /* store byte r3 into return value */
280
- #endif
281
- rsubi r11, r9, FFI_TYPE_SINT8
282
- bnei r11, ffi_closure_SYSV_end
283
- sext8 r3, r3 /* fix sign extend of sint8 */
284
- bri ffi_closure_SYSV_end
285
-
286
- ffi_closure_SYSV_end:
287
- addik r1, r1, 8 /* de-allocate return value */
288
-
289
- /* de-allocate stored args */
290
- addik r1, r1, 24
291
-
292
- /* callee restores */
293
- lwi r19, r1, 0 /* frame pointer */
294
- lwi r20, r1, 4 /* PIC register */
295
- lwi r21, r1, 8 /* PIC register */
296
- addik r1, r1, 12
297
-
298
- /* return from sub-routine (with delay slot) */
299
- rtsd r15, 8
300
- nop
301
-
302
- .size ffi_closure_SYSV, . - ffi_closure_SYSV
@@ -1,1105 +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 <stdlib.h>
33
-
34
- #ifdef __GNUC__
35
- # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
36
- # define USE__BUILTIN___CLEAR_CACHE 1
37
- # endif
38
- #endif
39
-
40
- #ifndef USE__BUILTIN___CLEAR_CACHE
41
- # if defined(__OpenBSD__)
42
- # include <mips64/sysarch.h>
43
- # else
44
- # include <sys/cachectl.h>
45
- # endif
46
- #endif
47
-
48
- #ifdef FFI_DEBUG
49
- # define FFI_MIPS_STOP_HERE() ffi_stop_here()
50
- #else
51
- # define FFI_MIPS_STOP_HERE() do {} while(0)
52
- #endif
53
-
54
- #ifdef FFI_MIPS_N32
55
- #define FIX_ARGP \
56
- FFI_ASSERT(argp <= &stack[bytes]); \
57
- if (argp == &stack[bytes]) \
58
- { \
59
- argp = stack; \
60
- FFI_MIPS_STOP_HERE(); \
61
- }
62
- #else
63
- #define FIX_ARGP
64
- #endif
65
-
66
-
67
- /* ffi_prep_args is called by the assembly routine once stack space
68
- has been allocated for the function's arguments */
69
-
70
- static void ffi_prep_args(char *stack,
71
- extended_cif *ecif,
72
- int bytes,
73
- int flags)
74
- {
75
- int i;
76
- void **p_argv;
77
- char *argp;
78
- ffi_type **p_arg;
79
-
80
- #ifdef FFI_MIPS_N32
81
- /* If more than 8 double words are used, the remainder go
82
- on the stack. We reorder stuff on the stack here to
83
- support this easily. */
84
- if (bytes > 8 * sizeof(ffi_arg))
85
- argp = &stack[bytes - (8 * sizeof(ffi_arg))];
86
- else
87
- argp = stack;
88
- #else
89
- argp = stack;
90
- #endif
91
-
92
- memset(stack, 0, bytes);
93
-
94
- #ifdef FFI_MIPS_N32
95
- if ( ecif->cif->rstruct_flag != 0 )
96
- #else
97
- if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT )
98
- #endif
99
- {
100
- *(ffi_arg *) argp = (ffi_arg) ecif->rvalue;
101
- argp += sizeof(ffi_arg);
102
- FIX_ARGP;
103
- }
104
-
105
- p_argv = ecif->avalue;
106
-
107
- for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++)
108
- {
109
- size_t z;
110
- unsigned int a;
111
-
112
- /* Align if necessary. */
113
- a = (*p_arg)->alignment;
114
- if (a < sizeof(ffi_arg))
115
- a = sizeof(ffi_arg);
116
-
117
- if ((a - 1) & (unsigned long) argp)
118
- {
119
- argp = (char *) FFI_ALIGN(argp, a);
120
- FIX_ARGP;
121
- }
122
-
123
- z = (*p_arg)->size;
124
- if (z <= sizeof(ffi_arg))
125
- {
126
- int type = (*p_arg)->type;
127
- z = sizeof(ffi_arg);
128
-
129
- /* The size of a pointer depends on the ABI */
130
- if (type == FFI_TYPE_POINTER)
131
- type = (ecif->cif->abi == FFI_N64
132
- || ecif->cif->abi == FFI_N64_SOFT_FLOAT)
133
- ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32;
134
-
135
- if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT
136
- || ecif->cif->abi == FFI_N64_SOFT_FLOAT))
137
- {
138
- switch (type)
139
- {
140
- case FFI_TYPE_FLOAT:
141
- type = FFI_TYPE_UINT32;
142
- break;
143
- case FFI_TYPE_DOUBLE:
144
- type = FFI_TYPE_UINT64;
145
- break;
146
- default:
147
- break;
148
- }
149
- }
150
- switch (type)
151
- {
152
- case FFI_TYPE_SINT8:
153
- *(ffi_arg *)argp = *(SINT8 *)(* p_argv);
154
- break;
155
-
156
- case FFI_TYPE_UINT8:
157
- *(ffi_arg *)argp = *(UINT8 *)(* p_argv);
158
- break;
159
-
160
- case FFI_TYPE_SINT16:
161
- *(ffi_arg *)argp = *(SINT16 *)(* p_argv);
162
- break;
163
-
164
- case FFI_TYPE_UINT16:
165
- *(ffi_arg *)argp = *(UINT16 *)(* p_argv);
166
- break;
167
-
168
- case FFI_TYPE_SINT32:
169
- *(ffi_arg *)argp = *(SINT32 *)(* p_argv);
170
- break;
171
-
172
- case FFI_TYPE_UINT32:
173
- #ifdef FFI_MIPS_N32
174
- /* The N32 ABI requires that 32-bit integers
175
- be sign-extended to 64-bits, regardless of
176
- whether they are signed or unsigned. */
177
- *(ffi_arg *)argp = *(SINT32 *)(* p_argv);
178
- #else
179
- *(ffi_arg *)argp = *(UINT32 *)(* p_argv);
180
- #endif
181
- break;
182
-
183
- /* This can only happen with 64bit slots. */
184
- case FFI_TYPE_FLOAT:
185
- *(float *) argp = *(float *)(* p_argv);
186
- break;
187
-
188
- /* Handle structures. */
189
- default:
190
- memcpy(argp, *p_argv, (*p_arg)->size);
191
- break;
192
- }
193
- }
194
- else
195
- {
196
- #ifdef FFI_MIPS_O32
197
- memcpy(argp, *p_argv, z);
198
- #else
199
- {
200
- unsigned long end = (unsigned long) argp + z;
201
- unsigned long cap = (unsigned long) stack + bytes;
202
-
203
- /* Check if the data will fit within the register space.
204
- Handle it if it doesn't. */
205
-
206
- if (end <= cap)
207
- memcpy(argp, *p_argv, z);
208
- else
209
- {
210
- unsigned long portion = cap - (unsigned long)argp;
211
-
212
- memcpy(argp, *p_argv, portion);
213
- argp = stack;
214
- z -= portion;
215
- memcpy(argp, (void*)((unsigned long)(*p_argv) + portion),
216
- z);
217
- }
218
- }
219
- #endif
220
- }
221
- p_argv++;
222
- argp += z;
223
- FIX_ARGP;
224
- }
225
- }
226
-
227
- #ifdef FFI_MIPS_N32
228
-
229
- /* The n32 spec says that if "a chunk consists solely of a double
230
- float field (but not a double, which is part of a union), it
231
- is passed in a floating point register. Any other chunk is
232
- passed in an integer register". This code traverses structure
233
- definitions and generates the appropriate flags. */
234
-
235
- static unsigned
236
- calc_n32_struct_flags(int soft_float, ffi_type *arg,
237
- unsigned *loc, unsigned *arg_reg)
238
- {
239
- unsigned flags = 0;
240
- unsigned index = 0;
241
-
242
- ffi_type *e;
243
-
244
- if (soft_float)
245
- return 0;
246
-
247
- while ((e = arg->elements[index]))
248
- {
249
- /* Align this object. */
250
- *loc = FFI_ALIGN(*loc, e->alignment);
251
- if (e->type == FFI_TYPE_DOUBLE)
252
- {
253
- /* Already aligned to FFI_SIZEOF_ARG. */
254
- *arg_reg = *loc / FFI_SIZEOF_ARG;
255
- if (*arg_reg > 7)
256
- break;
257
- flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS));
258
- *loc += e->size;
259
- }
260
- else
261
- *loc += e->size;
262
- index++;
263
- }
264
- /* Next Argument register at alignment of FFI_SIZEOF_ARG. */
265
- *arg_reg = FFI_ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
266
-
267
- return flags;
268
- }
269
-
270
- static unsigned
271
- calc_n32_return_struct_flags(int soft_float, ffi_type *arg)
272
- {
273
- unsigned flags = 0;
274
- unsigned small = FFI_TYPE_SMALLSTRUCT;
275
- ffi_type *e;
276
-
277
- /* Returning structures under n32 is a tricky thing.
278
- A struct with only one or two floating point fields
279
- is returned in $f0 (and $f2 if necessary). Any other
280
- struct results at most 128 bits are returned in $2
281
- (the first 64 bits) and $3 (remainder, if necessary).
282
- Larger structs are handled normally. */
283
-
284
- if (arg->size > 16)
285
- return 0;
286
-
287
- if (arg->size > 8)
288
- small = FFI_TYPE_SMALLSTRUCT2;
289
-
290
- e = arg->elements[0];
291
-
292
- if (e->type == FFI_TYPE_DOUBLE)
293
- flags = FFI_TYPE_DOUBLE;
294
- else if (e->type == FFI_TYPE_FLOAT)
295
- flags = FFI_TYPE_FLOAT;
296
-
297
- if (flags && (e = arg->elements[1]))
298
- {
299
- if (e->type == FFI_TYPE_DOUBLE)
300
- flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS;
301
- else if (e->type == FFI_TYPE_FLOAT)
302
- flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS;
303
- else
304
- return small;
305
-
306
- if (flags && (arg->elements[2]))
307
- {
308
- /* There are three arguments and the first two are
309
- floats! This must be passed the old way. */
310
- return small;
311
- }
312
- if (soft_float)
313
- flags += FFI_TYPE_STRUCT_SOFT;
314
- }
315
- else
316
- if (!flags)
317
- return small;
318
-
319
- return flags;
320
- }
321
-
322
- #endif
323
-
324
- /* Perform machine dependent cif processing */
325
- ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
326
- {
327
- cif->flags = 0;
328
-
329
- #ifdef FFI_MIPS_O32
330
- /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT
331
- * does not have special handling for floating point args.
332
- */
333
-
334
- if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32)
335
- {
336
- if (cif->nargs > 0)
337
- {
338
- switch ((cif->arg_types)[0]->type)
339
- {
340
- case FFI_TYPE_FLOAT:
341
- case FFI_TYPE_DOUBLE:
342
- cif->flags += (cif->arg_types)[0]->type;
343
- break;
344
-
345
- default:
346
- break;
347
- }
348
-
349
- if (cif->nargs > 1)
350
- {
351
- /* Only handle the second argument if the first
352
- is a float or double. */
353
- if (cif->flags)
354
- {
355
- switch ((cif->arg_types)[1]->type)
356
- {
357
- case FFI_TYPE_FLOAT:
358
- case FFI_TYPE_DOUBLE:
359
- cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS;
360
- break;
361
-
362
- default:
363
- break;
364
- }
365
- }
366
- }
367
- }
368
- }
369
-
370
- /* Set the return type flag */
371
-
372
- if (cif->abi == FFI_O32_SOFT_FLOAT)
373
- {
374
- switch (cif->rtype->type)
375
- {
376
- case FFI_TYPE_VOID:
377
- case FFI_TYPE_STRUCT:
378
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2);
379
- break;
380
-
381
- case FFI_TYPE_SINT64:
382
- case FFI_TYPE_UINT64:
383
- case FFI_TYPE_DOUBLE:
384
- cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2);
385
- break;
386
-
387
- case FFI_TYPE_FLOAT:
388
- default:
389
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2);
390
- break;
391
- }
392
- }
393
- else
394
- {
395
- /* FFI_O32 */
396
- switch (cif->rtype->type)
397
- {
398
- case FFI_TYPE_VOID:
399
- case FFI_TYPE_STRUCT:
400
- case FFI_TYPE_FLOAT:
401
- case FFI_TYPE_DOUBLE:
402
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2);
403
- break;
404
-
405
- case FFI_TYPE_SINT64:
406
- case FFI_TYPE_UINT64:
407
- cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2);
408
- break;
409
-
410
- default:
411
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2);
412
- break;
413
- }
414
- }
415
- #endif
416
-
417
- #ifdef FFI_MIPS_N32
418
- /* Set the flags necessary for N32 processing */
419
- {
420
- int type;
421
- unsigned arg_reg = 0;
422
- unsigned loc = 0;
423
- unsigned count = (cif->nargs < 8) ? cif->nargs : 8;
424
- unsigned index = 0;
425
-
426
- unsigned struct_flags = 0;
427
- int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT
428
- || cif->abi == FFI_N64_SOFT_FLOAT);
429
-
430
- if (cif->rtype->type == FFI_TYPE_STRUCT)
431
- {
432
- struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype);
433
-
434
- if (struct_flags == 0)
435
- {
436
- /* This means that the structure is being passed as
437
- a hidden argument */
438
-
439
- arg_reg = 1;
440
- count = (cif->nargs < 7) ? cif->nargs : 7;
441
-
442
- cif->rstruct_flag = !0;
443
- }
444
- else
445
- cif->rstruct_flag = 0;
446
- }
447
- else
448
- cif->rstruct_flag = 0;
449
-
450
- while (count-- > 0 && arg_reg < 8)
451
- {
452
- type = (cif->arg_types)[index]->type;
453
- if (soft_float)
454
- {
455
- switch (type)
456
- {
457
- case FFI_TYPE_FLOAT:
458
- type = FFI_TYPE_UINT32;
459
- break;
460
- case FFI_TYPE_DOUBLE:
461
- type = FFI_TYPE_UINT64;
462
- break;
463
- default:
464
- break;
465
- }
466
- }
467
- switch (type)
468
- {
469
- case FFI_TYPE_FLOAT:
470
- case FFI_TYPE_DOUBLE:
471
- cif->flags +=
472
- ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS));
473
- arg_reg++;
474
- break;
475
- case FFI_TYPE_LONGDOUBLE:
476
- /* Align it. */
477
- arg_reg = FFI_ALIGN(arg_reg, 2);
478
- /* Treat it as two adjacent doubles. */
479
- if (soft_float)
480
- {
481
- arg_reg += 2;
482
- }
483
- else
484
- {
485
- cif->flags +=
486
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
487
- arg_reg++;
488
- cif->flags +=
489
- (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
490
- arg_reg++;
491
- }
492
- break;
493
-
494
- case FFI_TYPE_STRUCT:
495
- loc = arg_reg * FFI_SIZEOF_ARG;
496
- cif->flags += calc_n32_struct_flags(soft_float,
497
- (cif->arg_types)[index],
498
- &loc, &arg_reg);
499
- break;
500
-
501
- default:
502
- arg_reg++;
503
- break;
504
- }
505
-
506
- index++;
507
- }
508
-
509
- /* Set the return type flag */
510
- switch (cif->rtype->type)
511
- {
512
- case FFI_TYPE_STRUCT:
513
- {
514
- if (struct_flags == 0)
515
- {
516
- /* The structure is returned through a hidden
517
- first argument. Do nothing, 'cause FFI_TYPE_VOID
518
- is 0 */
519
- }
520
- else
521
- {
522
- /* The structure is returned via some tricky
523
- mechanism */
524
- cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
525
- cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8));
526
- }
527
- break;
528
- }
529
-
530
- case FFI_TYPE_VOID:
531
- /* Do nothing, 'cause FFI_TYPE_VOID is 0 */
532
- break;
533
-
534
- case FFI_TYPE_POINTER:
535
- if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32)
536
- cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8);
537
- else
538
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
539
- break;
540
-
541
- case FFI_TYPE_FLOAT:
542
- if (soft_float)
543
- {
544
- cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8);
545
- break;
546
- }
547
- /* else fall through */
548
- case FFI_TYPE_DOUBLE:
549
- if (soft_float)
550
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
551
- else
552
- cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8);
553
- break;
554
-
555
- case FFI_TYPE_LONGDOUBLE:
556
- /* Long double is returned as if it were a struct containing
557
- two doubles. */
558
- if (soft_float)
559
- {
560
- cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
561
- cif->flags += FFI_TYPE_SMALLSTRUCT2 << (4 + (FFI_FLAG_BITS * 8));
562
- }
563
- else
564
- {
565
- cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
566
- cif->flags += (FFI_TYPE_DOUBLE
567
- + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS))
568
- << (4 + (FFI_FLAG_BITS * 8));
569
- }
570
- break;
571
- default:
572
- cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
573
- break;
574
- }
575
- }
576
- #endif
577
-
578
- return FFI_OK;
579
- }
580
-
581
- /* Low level routine for calling O32 functions */
582
- extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int),
583
- extended_cif *, unsigned,
584
- unsigned, unsigned *, void (*)(void), void *closure);
585
-
586
- /* Low level routine for calling N32 functions */
587
- extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int),
588
- extended_cif *, unsigned,
589
- unsigned, void *, void (*)(void), void *closure);
590
-
591
- void ffi_call_int(ffi_cif *cif, void (*fn)(void), void *rvalue,
592
- void **avalue, void *closure)
593
- {
594
- extended_cif ecif;
595
-
596
- ecif.cif = cif;
597
- ecif.avalue = avalue;
598
-
599
- /* If the return value is a struct and we don't have a return */
600
- /* value address then we need to make one */
601
-
602
- if ((rvalue == NULL) &&
603
- (cif->rtype->type == FFI_TYPE_STRUCT))
604
- ecif.rvalue = alloca(cif->rtype->size);
605
- else
606
- ecif.rvalue = rvalue;
607
-
608
- switch (cif->abi)
609
- {
610
- #ifdef FFI_MIPS_O32
611
- case FFI_O32:
612
- case FFI_O32_SOFT_FLOAT:
613
- ffi_call_O32(ffi_prep_args, &ecif, cif->bytes,
614
- cif->flags, ecif.rvalue, fn, closure);
615
- break;
616
- #endif
617
-
618
- #ifdef FFI_MIPS_N32
619
- case FFI_N32:
620
- case FFI_N32_SOFT_FLOAT:
621
- case FFI_N64:
622
- case FFI_N64_SOFT_FLOAT:
623
- {
624
- int copy_rvalue = 0;
625
- int copy_offset = 0;
626
- char *rvalue_copy = ecif.rvalue;
627
- if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16)
628
- {
629
- /* For structures smaller than 16 bytes we clobber memory
630
- in 8 byte increments. Make a copy so we don't clobber
631
- the callers memory outside of the struct bounds. */
632
- rvalue_copy = alloca(16);
633
- copy_rvalue = 1;
634
- }
635
- else if (cif->rtype->type == FFI_TYPE_FLOAT
636
- && (cif->abi == FFI_N64_SOFT_FLOAT
637
- || cif->abi == FFI_N32_SOFT_FLOAT))
638
- {
639
- rvalue_copy = alloca (8);
640
- copy_rvalue = 1;
641
- #if defined(__MIPSEB__) || defined(_MIPSEB)
642
- copy_offset = 4;
643
- #endif
644
- }
645
- ffi_call_N32(ffi_prep_args, &ecif, cif->bytes,
646
- cif->flags, rvalue_copy, fn, closure);
647
- if (copy_rvalue)
648
- memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size);
649
- }
650
- break;
651
- #endif
652
-
653
- default:
654
- FFI_ASSERT(0);
655
- break;
656
- }
657
- }
658
-
659
- void
660
- ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
661
- {
662
- ffi_call_int (cif, fn, rvalue, avalue, NULL);
663
- }
664
-
665
- void
666
- ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
667
- void **avalue, void *closure)
668
- {
669
- ffi_call_int (cif, fn, rvalue, avalue, closure);
670
- }
671
-
672
-
673
- #if FFI_CLOSURES
674
- #if defined(FFI_MIPS_O32)
675
- extern void ffi_closure_O32(void);
676
- extern void ffi_go_closure_O32(void);
677
- #else
678
- extern void ffi_closure_N32(void);
679
- extern void ffi_go_closure_N32(void);
680
- #endif /* FFI_MIPS_O32 */
681
-
682
- ffi_status
683
- ffi_prep_closure_loc (ffi_closure *closure,
684
- ffi_cif *cif,
685
- void (*fun)(ffi_cif*,void*,void**,void*),
686
- void *user_data,
687
- void *codeloc)
688
- {
689
- unsigned int *tramp = (unsigned int *) &closure->tramp[0];
690
- void * fn;
691
- char *clear_location = (char *) codeloc;
692
-
693
- #if defined(FFI_MIPS_O32)
694
- if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
695
- return FFI_BAD_ABI;
696
- fn = ffi_closure_O32;
697
- #else
698
- #if _MIPS_SIM ==_ABIN32
699
- if (cif->abi != FFI_N32
700
- && cif->abi != FFI_N32_SOFT_FLOAT)
701
- return FFI_BAD_ABI;
702
- #else
703
- if (cif->abi != FFI_N64
704
- && cif->abi != FFI_N64_SOFT_FLOAT)
705
- return FFI_BAD_ABI;
706
- #endif
707
- fn = ffi_closure_N32;
708
- #endif /* FFI_MIPS_O32 */
709
-
710
- #if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32)
711
- /* lui $25,high(fn) */
712
- tramp[0] = 0x3c190000 | ((unsigned)fn >> 16);
713
- /* ori $25,low(fn) */
714
- tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff);
715
- /* lui $12,high(codeloc) */
716
- tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16);
717
- /* jr $25 */
718
- tramp[3] = 0x03200008;
719
- /* ori $12,low(codeloc) */
720
- tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff);
721
- #else
722
- /* N64 has a somewhat larger trampoline. */
723
- /* lui $25,high(fn) */
724
- tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48);
725
- /* lui $12,high(codeloc) */
726
- tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48);
727
- /* ori $25,mid-high(fn) */
728
- tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff);
729
- /* ori $12,mid-high(codeloc) */
730
- tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff);
731
- /* dsll $25,$25,16 */
732
- tramp[4] = 0x0019cc38;
733
- /* dsll $12,$12,16 */
734
- tramp[5] = 0x000c6438;
735
- /* ori $25,mid-low(fn) */
736
- tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff);
737
- /* ori $12,mid-low(codeloc) */
738
- tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff);
739
- /* dsll $25,$25,16 */
740
- tramp[8] = 0x0019cc38;
741
- /* dsll $12,$12,16 */
742
- tramp[9] = 0x000c6438;
743
- /* ori $25,low(fn) */
744
- tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff);
745
- /* jr $25 */
746
- tramp[11] = 0x03200008;
747
- /* ori $12,low(codeloc) */
748
- tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff);
749
-
750
- #endif
751
-
752
- closure->cif = cif;
753
- closure->fun = fun;
754
- closure->user_data = user_data;
755
-
756
- #ifdef USE__BUILTIN___CLEAR_CACHE
757
- __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
758
- #else
759
- cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
760
- #endif
761
- return FFI_OK;
762
- }
763
-
764
- /*
765
- * Decodes the arguments to a function, which will be stored on the
766
- * stack. AR is the pointer to the beginning of the integer arguments
767
- * (and, depending upon the arguments, some floating-point arguments
768
- * as well). FPR is a pointer to the area where floating point
769
- * registers have been saved, if any.
770
- *
771
- * RVALUE is the location where the function return value will be
772
- * stored. CLOSURE is the prepared closure to invoke.
773
- *
774
- * This function should only be called from assembly, which is in
775
- * turn called from a trampoline.
776
- *
777
- * Returns the function return type.
778
- *
779
- * Based on the similar routine for sparc.
780
- */
781
- int
782
- ffi_closure_mips_inner_O32 (ffi_cif *cif,
783
- void (*fun)(ffi_cif*, void*, void**, void*),
784
- void *user_data,
785
- void *rvalue, ffi_arg *ar,
786
- double *fpr)
787
- {
788
- void **avaluep;
789
- ffi_arg *avalue;
790
- ffi_type **arg_types;
791
- int i, avn, argn, seen_int;
792
-
793
- avalue = alloca (cif->nargs * sizeof (ffi_arg));
794
- avaluep = alloca (cif->nargs * sizeof (ffi_arg));
795
-
796
- seen_int = (cif->abi == FFI_O32_SOFT_FLOAT);
797
- argn = 0;
798
-
799
- if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT)
800
- {
801
- rvalue = (void *)(UINT32)ar[0];
802
- argn = 1;
803
- }
804
-
805
- i = 0;
806
- avn = cif->nargs;
807
- arg_types = cif->arg_types;
808
-
809
- while (i < avn)
810
- {
811
- if (i < 2 && !seen_int &&
812
- (arg_types[i]->type == FFI_TYPE_FLOAT ||
813
- arg_types[i]->type == FFI_TYPE_DOUBLE ||
814
- arg_types[i]->type == FFI_TYPE_LONGDOUBLE))
815
- {
816
- #if defined(__MIPSEB__) || defined(_MIPSEB)
817
- if (arg_types[i]->type == FFI_TYPE_FLOAT)
818
- avaluep[i] = ((char *) &fpr[i]) + sizeof (float);
819
- else
820
- #endif
821
- avaluep[i] = (char *) &fpr[i];
822
- }
823
- else
824
- {
825
- if (arg_types[i]->alignment == 8 && (argn & 0x1))
826
- argn++;
827
- switch (arg_types[i]->type)
828
- {
829
- case FFI_TYPE_SINT8:
830
- avaluep[i] = &avalue[i];
831
- *(SINT8 *) &avalue[i] = (SINT8) ar[argn];
832
- break;
833
-
834
- case FFI_TYPE_UINT8:
835
- avaluep[i] = &avalue[i];
836
- *(UINT8 *) &avalue[i] = (UINT8) ar[argn];
837
- break;
838
-
839
- case FFI_TYPE_SINT16:
840
- avaluep[i] = &avalue[i];
841
- *(SINT16 *) &avalue[i] = (SINT16) ar[argn];
842
- break;
843
-
844
- case FFI_TYPE_UINT16:
845
- avaluep[i] = &avalue[i];
846
- *(UINT16 *) &avalue[i] = (UINT16) ar[argn];
847
- break;
848
-
849
- default:
850
- avaluep[i] = (char *) &ar[argn];
851
- break;
852
- }
853
- seen_int = 1;
854
- }
855
- argn += FFI_ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
856
- i++;
857
- }
858
-
859
- /* Invoke the closure. */
860
- fun(cif, rvalue, avaluep, user_data);
861
-
862
- if (cif->abi == FFI_O32_SOFT_FLOAT)
863
- {
864
- switch (cif->rtype->type)
865
- {
866
- case FFI_TYPE_FLOAT:
867
- return FFI_TYPE_INT;
868
- case FFI_TYPE_DOUBLE:
869
- return FFI_TYPE_UINT64;
870
- default:
871
- return cif->rtype->type;
872
- }
873
- }
874
- else
875
- {
876
- return cif->rtype->type;
877
- }
878
- }
879
-
880
- #if defined(FFI_MIPS_N32)
881
-
882
- static void
883
- copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type,
884
- int argn, unsigned arg_offset, ffi_arg *ar,
885
- ffi_arg *fpr, int soft_float)
886
- {
887
- ffi_type **elt_typep = type->elements;
888
- while(*elt_typep)
889
- {
890
- ffi_type *elt_type = *elt_typep;
891
- unsigned o;
892
- char *tp;
893
- char *argp;
894
- char *fpp;
895
-
896
- o = FFI_ALIGN(offset, elt_type->alignment);
897
- arg_offset += o - offset;
898
- offset = o;
899
- argn += arg_offset / sizeof(ffi_arg);
900
- arg_offset = arg_offset % sizeof(ffi_arg);
901
-
902
- argp = (char *)(ar + argn);
903
- fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn);
904
-
905
- tp = target + offset;
906
-
907
- if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float)
908
- *(double *)tp = *(double *)fpp;
909
- else
910
- memcpy(tp, argp + arg_offset, elt_type->size);
911
-
912
- offset += elt_type->size;
913
- arg_offset += elt_type->size;
914
- elt_typep++;
915
- argn += arg_offset / sizeof(ffi_arg);
916
- arg_offset = arg_offset % sizeof(ffi_arg);
917
- }
918
- }
919
-
920
- /*
921
- * Decodes the arguments to a function, which will be stored on the
922
- * stack. AR is the pointer to the beginning of the integer
923
- * arguments. FPR is a pointer to the area where floating point
924
- * registers have been saved.
925
- *
926
- * RVALUE is the location where the function return value will be
927
- * stored. CLOSURE is the prepared closure to invoke.
928
- *
929
- * This function should only be called from assembly, which is in
930
- * turn called from a trampoline.
931
- *
932
- * Returns the function return flags.
933
- *
934
- */
935
- int
936
- ffi_closure_mips_inner_N32 (ffi_cif *cif,
937
- void (*fun)(ffi_cif*, void*, void**, void*),
938
- void *user_data,
939
- void *rvalue, ffi_arg *ar,
940
- ffi_arg *fpr)
941
- {
942
- void **avaluep;
943
- ffi_arg *avalue;
944
- ffi_type **arg_types;
945
- int i, avn, argn;
946
- int soft_float;
947
- ffi_arg *argp;
948
-
949
- soft_float = cif->abi == FFI_N64_SOFT_FLOAT
950
- || cif->abi == FFI_N32_SOFT_FLOAT;
951
- avalue = alloca (cif->nargs * sizeof (ffi_arg));
952
- avaluep = alloca (cif->nargs * sizeof (ffi_arg));
953
-
954
- argn = 0;
955
-
956
- if (cif->rstruct_flag)
957
- {
958
- #if _MIPS_SIM==_ABIN32
959
- rvalue = (void *)(UINT32)ar[0];
960
- #else /* N64 */
961
- rvalue = (void *)ar[0];
962
- #endif
963
- argn = 1;
964
- }
965
-
966
- i = 0;
967
- avn = cif->nargs;
968
- arg_types = cif->arg_types;
969
-
970
- while (i < avn)
971
- {
972
- if (arg_types[i]->type == FFI_TYPE_FLOAT
973
- || arg_types[i]->type == FFI_TYPE_DOUBLE
974
- || arg_types[i]->type == FFI_TYPE_LONGDOUBLE)
975
- {
976
- argp = (argn >= 8 || soft_float) ? ar + argn : fpr + argn;
977
- if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((unsigned)argp & (arg_types[i]->alignment-1)))
978
- {
979
- argp=(ffi_arg*)FFI_ALIGN(argp,arg_types[i]->alignment);
980
- argn++;
981
- }
982
- #if defined(__MIPSEB__) || defined(_MIPSEB)
983
- if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8)
984
- avaluep[i] = ((char *) argp) + sizeof (float);
985
- else
986
- #endif
987
- avaluep[i] = (char *) argp;
988
- }
989
- else
990
- {
991
- unsigned type = arg_types[i]->type;
992
-
993
- if (arg_types[i]->alignment > sizeof(ffi_arg))
994
- argn = FFI_ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg));
995
-
996
- argp = ar + argn;
997
-
998
- /* The size of a pointer depends on the ABI */
999
- if (type == FFI_TYPE_POINTER)
1000
- type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT)
1001
- ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32;
1002
-
1003
- if (soft_float && type == FFI_TYPE_FLOAT)
1004
- type = FFI_TYPE_UINT32;
1005
-
1006
- switch (type)
1007
- {
1008
- case FFI_TYPE_SINT8:
1009
- avaluep[i] = &avalue[i];
1010
- *(SINT8 *) &avalue[i] = (SINT8) *argp;
1011
- break;
1012
-
1013
- case FFI_TYPE_UINT8:
1014
- avaluep[i] = &avalue[i];
1015
- *(UINT8 *) &avalue[i] = (UINT8) *argp;
1016
- break;
1017
-
1018
- case FFI_TYPE_SINT16:
1019
- avaluep[i] = &avalue[i];
1020
- *(SINT16 *) &avalue[i] = (SINT16) *argp;
1021
- break;
1022
-
1023
- case FFI_TYPE_UINT16:
1024
- avaluep[i] = &avalue[i];
1025
- *(UINT16 *) &avalue[i] = (UINT16) *argp;
1026
- break;
1027
-
1028
- case FFI_TYPE_SINT32:
1029
- avaluep[i] = &avalue[i];
1030
- *(SINT32 *) &avalue[i] = (SINT32) *argp;
1031
- break;
1032
-
1033
- case FFI_TYPE_UINT32:
1034
- avaluep[i] = &avalue[i];
1035
- *(UINT32 *) &avalue[i] = (UINT32) *argp;
1036
- break;
1037
-
1038
- case FFI_TYPE_STRUCT:
1039
- if (argn < 8)
1040
- {
1041
- /* Allocate space for the struct as at least part of
1042
- it was passed in registers. */
1043
- avaluep[i] = alloca(arg_types[i]->size);
1044
- copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i],
1045
- argn, 0, ar, fpr, soft_float);
1046
-
1047
- break;
1048
- }
1049
- /* Else fall through. */
1050
- default:
1051
- avaluep[i] = (char *) argp;
1052
- break;
1053
- }
1054
- }
1055
- argn += FFI_ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg);
1056
- i++;
1057
- }
1058
-
1059
- /* Invoke the closure. */
1060
- fun (cif, rvalue, avaluep, user_data);
1061
-
1062
- return cif->flags >> (FFI_FLAG_BITS * 8);
1063
- }
1064
-
1065
- #endif /* FFI_MIPS_N32 */
1066
-
1067
- #if defined(FFI_MIPS_O32)
1068
- extern void ffi_closure_O32(void);
1069
- extern void ffi_go_closure_O32(void);
1070
- #else
1071
- extern void ffi_closure_N32(void);
1072
- extern void ffi_go_closure_N32(void);
1073
- #endif /* FFI_MIPS_O32 */
1074
-
1075
- ffi_status
1076
- ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
1077
- void (*fun)(ffi_cif*,void*,void**,void*))
1078
- {
1079
- void * fn;
1080
-
1081
- #if defined(FFI_MIPS_O32)
1082
- if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
1083
- return FFI_BAD_ABI;
1084
- fn = ffi_go_closure_O32;
1085
- #else
1086
- #if _MIPS_SIM ==_ABIN32
1087
- if (cif->abi != FFI_N32
1088
- && cif->abi != FFI_N32_SOFT_FLOAT)
1089
- return FFI_BAD_ABI;
1090
- #else
1091
- if (cif->abi != FFI_N64
1092
- && cif->abi != FFI_N64_SOFT_FLOAT)
1093
- return FFI_BAD_ABI;
1094
- #endif
1095
- fn = ffi_go_closure_N32;
1096
- #endif /* FFI_MIPS_O32 */
1097
-
1098
- closure->tramp = (void *)fn;
1099
- closure->cif = cif;
1100
- closure->fun = fun;
1101
-
1102
- return FFI_OK;
1103
- }
1104
-
1105
- #endif /* FFI_CLOSURES */