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,945 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
- ffi_linux64.c - Copyright (C) 2013 IBM
3
- Copyright (C) 2011 Anthony Green
4
- Copyright (C) 2011 Kyle Moffett
5
- Copyright (C) 2008 Red Hat, Inc
6
- Copyright (C) 2007, 2008 Free Software Foundation, Inc
7
- Copyright (c) 1998 Geoffrey Keating
8
-
9
- PowerPC Foreign Function Interface
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining
12
- a copy of this software and associated documentation files (the
13
- ``Software''), to deal in the Software without restriction, including
14
- without limitation the rights to use, copy, modify, merge, publish,
15
- distribute, sublicense, and/or sell copies of the Software, and to
16
- permit persons to whom the Software is furnished to do so, subject to
17
- the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included
20
- in all copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
23
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
26
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28
- OTHER DEALINGS IN THE SOFTWARE.
29
- ----------------------------------------------------------------------- */
30
-
31
- #include "ffi.h"
32
-
33
- #ifdef POWERPC64
34
- #include "ffi_common.h"
35
- #include "ffi_powerpc.h"
36
-
37
-
38
- /* About the LINUX64 ABI. */
39
- enum {
40
- NUM_GPR_ARG_REGISTERS64 = 8,
41
- NUM_FPR_ARG_REGISTERS64 = 13
42
- };
43
- enum { ASM_NEEDS_REGISTERS64 = 4 };
44
-
45
-
46
- #if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
47
- /* Adjust size of ffi_type_longdouble. */
48
- void FFI_HIDDEN
49
- ffi_prep_types_linux64 (ffi_abi abi)
50
- {
51
- if ((abi & (FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128)) == FFI_LINUX)
52
- {
53
- ffi_type_longdouble.size = 8;
54
- ffi_type_longdouble.alignment = 8;
55
- }
56
- else
57
- {
58
- ffi_type_longdouble.size = 16;
59
- ffi_type_longdouble.alignment = 16;
60
- }
61
- }
62
- #endif
63
-
64
-
65
- #if _CALL_ELF == 2
66
- static unsigned int
67
- discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
68
- {
69
- switch (t->type)
70
- {
71
- case FFI_TYPE_FLOAT:
72
- case FFI_TYPE_DOUBLE:
73
- *elnum = 1;
74
- return (int) t->type;
75
-
76
- case FFI_TYPE_STRUCT:;
77
- {
78
- unsigned int base_elt = 0, total_elnum = 0;
79
- ffi_type **el = t->elements;
80
- while (*el)
81
- {
82
- unsigned int el_elt, el_elnum = 0;
83
- el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
84
- if (el_elt == 0
85
- || (base_elt && base_elt != el_elt))
86
- return 0;
87
- base_elt = el_elt;
88
- total_elnum += el_elnum;
89
- if (total_elnum > 8)
90
- return 0;
91
- el++;
92
- }
93
- *elnum = total_elnum;
94
- return base_elt;
95
- }
96
-
97
- default:
98
- return 0;
99
- }
100
- }
101
- #endif
102
-
103
-
104
- /* Perform machine dependent cif processing */
105
- static ffi_status
106
- ffi_prep_cif_linux64_core (ffi_cif *cif)
107
- {
108
- ffi_type **ptr;
109
- unsigned bytes;
110
- unsigned i, fparg_count = 0, intarg_count = 0;
111
- unsigned flags = cif->flags;
112
- #if _CALL_ELF == 2
113
- unsigned int elt, elnum;
114
- #endif
115
-
116
- #if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE
117
- /* If compiled without long double support.. */
118
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
119
- return FFI_BAD_ABI;
120
- #endif
121
-
122
- /* The machine-independent calculation of cif->bytes doesn't work
123
- for us. Redo the calculation. */
124
- #if _CALL_ELF == 2
125
- /* Space for backchain, CR, LR, TOC and the asm's temp regs. */
126
- bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long);
127
-
128
- /* Space for the general registers. */
129
- bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long);
130
- #else
131
- /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp
132
- regs. */
133
- bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long);
134
-
135
- /* Space for the mandatory parm save area and general registers. */
136
- bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long);
137
- #endif
138
-
139
- /* Return value handling. */
140
- switch (cif->rtype->type)
141
- {
142
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
143
- case FFI_TYPE_LONGDOUBLE:
144
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
145
- flags |= FLAG_RETURNS_128BITS;
146
- /* Fall through. */
147
- #endif
148
- case FFI_TYPE_DOUBLE:
149
- flags |= FLAG_RETURNS_64BITS;
150
- /* Fall through. */
151
- case FFI_TYPE_FLOAT:
152
- flags |= FLAG_RETURNS_FP;
153
- break;
154
-
155
- case FFI_TYPE_UINT128:
156
- flags |= FLAG_RETURNS_128BITS;
157
- /* Fall through. */
158
- case FFI_TYPE_UINT64:
159
- case FFI_TYPE_SINT64:
160
- flags |= FLAG_RETURNS_64BITS;
161
- break;
162
-
163
- case FFI_TYPE_STRUCT:
164
- #if _CALL_ELF == 2
165
- elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
166
- if (elt)
167
- {
168
- if (elt == FFI_TYPE_DOUBLE)
169
- flags |= FLAG_RETURNS_64BITS;
170
- flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST;
171
- break;
172
- }
173
- if (cif->rtype->size <= 16)
174
- {
175
- flags |= FLAG_RETURNS_SMST;
176
- break;
177
- }
178
- #endif
179
- intarg_count++;
180
- flags |= FLAG_RETVAL_REFERENCE;
181
- /* Fall through. */
182
- case FFI_TYPE_VOID:
183
- flags |= FLAG_RETURNS_NOTHING;
184
- break;
185
-
186
- default:
187
- /* Returns 32-bit integer, or similar. Nothing to do here. */
188
- break;
189
- }
190
-
191
- for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
192
- {
193
- unsigned int align;
194
-
195
- switch ((*ptr)->type)
196
- {
197
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
198
- case FFI_TYPE_LONGDOUBLE:
199
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
200
- {
201
- fparg_count++;
202
- intarg_count++;
203
- }
204
- /* Fall through. */
205
- #endif
206
- case FFI_TYPE_DOUBLE:
207
- case FFI_TYPE_FLOAT:
208
- fparg_count++;
209
- intarg_count++;
210
- if (fparg_count > NUM_FPR_ARG_REGISTERS64)
211
- flags |= FLAG_ARG_NEEDS_PSAVE;
212
- break;
213
-
214
- case FFI_TYPE_STRUCT:
215
- if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
216
- {
217
- align = (*ptr)->alignment;
218
- if (align > 16)
219
- align = 16;
220
- align = align / 8;
221
- if (align > 1)
222
- intarg_count = FFI_ALIGN (intarg_count, align);
223
- }
224
- intarg_count += ((*ptr)->size + 7) / 8;
225
- #if _CALL_ELF == 2
226
- elt = discover_homogeneous_aggregate (*ptr, &elnum);
227
- if (elt)
228
- {
229
- fparg_count += elnum;
230
- if (fparg_count > NUM_FPR_ARG_REGISTERS64)
231
- flags |= FLAG_ARG_NEEDS_PSAVE;
232
- }
233
- else
234
- #endif
235
- {
236
- if (intarg_count > NUM_GPR_ARG_REGISTERS64)
237
- flags |= FLAG_ARG_NEEDS_PSAVE;
238
- }
239
- break;
240
-
241
- case FFI_TYPE_POINTER:
242
- case FFI_TYPE_UINT64:
243
- case FFI_TYPE_SINT64:
244
- case FFI_TYPE_INT:
245
- case FFI_TYPE_UINT32:
246
- case FFI_TYPE_SINT32:
247
- case FFI_TYPE_UINT16:
248
- case FFI_TYPE_SINT16:
249
- case FFI_TYPE_UINT8:
250
- case FFI_TYPE_SINT8:
251
- /* Everything else is passed as a 8-byte word in a GPR, either
252
- the object itself or a pointer to it. */
253
- intarg_count++;
254
- if (intarg_count > NUM_GPR_ARG_REGISTERS64)
255
- flags |= FLAG_ARG_NEEDS_PSAVE;
256
- break;
257
- default:
258
- FFI_ASSERT (0);
259
- }
260
- }
261
-
262
- if (fparg_count != 0)
263
- flags |= FLAG_FP_ARGUMENTS;
264
- if (intarg_count > 4)
265
- flags |= FLAG_4_GPR_ARGUMENTS;
266
-
267
- /* Space for the FPR registers, if needed. */
268
- if (fparg_count != 0)
269
- bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
270
-
271
- /* Stack space. */
272
- #if _CALL_ELF == 2
273
- if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
274
- bytes += intarg_count * sizeof (long);
275
- #else
276
- if (intarg_count > NUM_GPR_ARG_REGISTERS64)
277
- bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
278
- #endif
279
-
280
- /* The stack space allocated needs to be a multiple of 16 bytes. */
281
- bytes = (bytes + 15) & ~0xF;
282
-
283
- cif->flags = flags;
284
- cif->bytes = bytes;
285
-
286
- return FFI_OK;
287
- }
288
-
289
- ffi_status FFI_HIDDEN
290
- ffi_prep_cif_linux64 (ffi_cif *cif)
291
- {
292
- if ((cif->abi & FFI_LINUX) != 0)
293
- cif->nfixedargs = cif->nargs;
294
- #if _CALL_ELF != 2
295
- else if (cif->abi == FFI_COMPAT_LINUX64)
296
- {
297
- /* This call is from old code. Don't touch cif->nfixedargs
298
- since old code will be using a smaller cif. */
299
- cif->flags |= FLAG_COMPAT;
300
- /* Translate to new abi value. */
301
- cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128;
302
- }
303
- #endif
304
- else
305
- return FFI_BAD_ABI;
306
- return ffi_prep_cif_linux64_core (cif);
307
- }
308
-
309
- ffi_status FFI_HIDDEN
310
- ffi_prep_cif_linux64_var (ffi_cif *cif,
311
- unsigned int nfixedargs,
312
- unsigned int ntotalargs MAYBE_UNUSED)
313
- {
314
- if ((cif->abi & FFI_LINUX) != 0)
315
- cif->nfixedargs = nfixedargs;
316
- #if _CALL_ELF != 2
317
- else if (cif->abi == FFI_COMPAT_LINUX64)
318
- {
319
- /* This call is from old code. Don't touch cif->nfixedargs
320
- since old code will be using a smaller cif. */
321
- cif->flags |= FLAG_COMPAT;
322
- /* Translate to new abi value. */
323
- cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128;
324
- }
325
- #endif
326
- else
327
- return FFI_BAD_ABI;
328
- #if _CALL_ELF == 2
329
- cif->flags |= FLAG_ARG_NEEDS_PSAVE;
330
- #endif
331
- return ffi_prep_cif_linux64_core (cif);
332
- }
333
-
334
-
335
- /* ffi_prep_args64 is called by the assembly routine once stack space
336
- has been allocated for the function's arguments.
337
-
338
- The stack layout we want looks like this:
339
-
340
- | Ret addr from ffi_call_LINUX64 8bytes | higher addresses
341
- |--------------------------------------------|
342
- | CR save area 8bytes |
343
- |--------------------------------------------|
344
- | Previous backchain pointer 8 | stack pointer here
345
- |--------------------------------------------|<+ <<< on entry to
346
- | Saved r28-r31 4*8 | | ffi_call_LINUX64
347
- |--------------------------------------------| |
348
- | GPR registers r3-r10 8*8 | |
349
- |--------------------------------------------| |
350
- | FPR registers f1-f13 (optional) 13*8 | |
351
- |--------------------------------------------| |
352
- | Parameter save area | |
353
- |--------------------------------------------| |
354
- | TOC save area 8 | |
355
- |--------------------------------------------| | stack |
356
- | Linker doubleword 8 | | grows |
357
- |--------------------------------------------| | down V
358
- | Compiler doubleword 8 | |
359
- |--------------------------------------------| | lower addresses
360
- | Space for callee's LR 8 | |
361
- |--------------------------------------------| |
362
- | CR save area 8 | |
363
- |--------------------------------------------| | stack pointer here
364
- | Current backchain pointer 8 |-/ during
365
- |--------------------------------------------| <<< ffi_call_LINUX64
366
-
367
- */
368
-
369
- void FFI_HIDDEN
370
- ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
371
- {
372
- const unsigned long bytes = ecif->cif->bytes;
373
- const unsigned long flags = ecif->cif->flags;
374
-
375
- typedef union
376
- {
377
- char *c;
378
- unsigned long *ul;
379
- float *f;
380
- double *d;
381
- size_t p;
382
- } valp;
383
-
384
- /* 'stacktop' points at the previous backchain pointer. */
385
- valp stacktop;
386
-
387
- /* 'next_arg' points at the space for gpr3, and grows upwards as
388
- we use GPR registers, then continues at rest. */
389
- valp gpr_base;
390
- valp gpr_end;
391
- valp rest;
392
- valp next_arg;
393
-
394
- /* 'fpr_base' points at the space for fpr3, and grows upwards as
395
- we use FPR registers. */
396
- valp fpr_base;
397
- unsigned int fparg_count;
398
-
399
- unsigned int i, words, nargs, nfixedargs;
400
- ffi_type **ptr;
401
- double double_tmp;
402
- union
403
- {
404
- void **v;
405
- char **c;
406
- signed char **sc;
407
- unsigned char **uc;
408
- signed short **ss;
409
- unsigned short **us;
410
- signed int **si;
411
- unsigned int **ui;
412
- unsigned long **ul;
413
- float **f;
414
- double **d;
415
- } p_argv;
416
- unsigned long gprvalue;
417
- unsigned long align;
418
-
419
- stacktop.c = (char *) stack + bytes;
420
- gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64;
421
- gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64;
422
- #if _CALL_ELF == 2
423
- rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64;
424
- #else
425
- rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64;
426
- #endif
427
- fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
428
- fparg_count = 0;
429
- next_arg.ul = gpr_base.ul;
430
-
431
- /* Check that everything starts aligned properly. */
432
- FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
433
- FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
434
- FFI_ASSERT ((bytes & 0xF) == 0);
435
-
436
- /* Deal with return values that are actually pass-by-reference. */
437
- if (flags & FLAG_RETVAL_REFERENCE)
438
- *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue;
439
-
440
- /* Now for the arguments. */
441
- p_argv.v = ecif->avalue;
442
- nargs = ecif->cif->nargs;
443
- #if _CALL_ELF != 2
444
- nfixedargs = (unsigned) -1;
445
- if ((flags & FLAG_COMPAT) == 0)
446
- #endif
447
- nfixedargs = ecif->cif->nfixedargs;
448
- for (ptr = ecif->cif->arg_types, i = 0;
449
- i < nargs;
450
- i++, ptr++, p_argv.v++)
451
- {
452
- #if _CALL_ELF == 2
453
- unsigned int elt, elnum;
454
- #endif
455
-
456
- switch ((*ptr)->type)
457
- {
458
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
459
- case FFI_TYPE_LONGDOUBLE:
460
- if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
461
- {
462
- double_tmp = (*p_argv.d)[0];
463
- if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
464
- {
465
- *fpr_base.d++ = double_tmp;
466
- # if _CALL_ELF != 2
467
- if ((flags & FLAG_COMPAT) != 0)
468
- *next_arg.d = double_tmp;
469
- # endif
470
- }
471
- else
472
- *next_arg.d = double_tmp;
473
- if (++next_arg.ul == gpr_end.ul)
474
- next_arg.ul = rest.ul;
475
- fparg_count++;
476
- double_tmp = (*p_argv.d)[1];
477
- if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
478
- {
479
- *fpr_base.d++ = double_tmp;
480
- # if _CALL_ELF != 2
481
- if ((flags & FLAG_COMPAT) != 0)
482
- *next_arg.d = double_tmp;
483
- # endif
484
- }
485
- else
486
- *next_arg.d = double_tmp;
487
- if (++next_arg.ul == gpr_end.ul)
488
- next_arg.ul = rest.ul;
489
- fparg_count++;
490
- FFI_ASSERT (__LDBL_MANT_DIG__ == 106);
491
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
492
- break;
493
- }
494
- /* Fall through. */
495
- #endif
496
- case FFI_TYPE_DOUBLE:
497
- double_tmp = **p_argv.d;
498
- if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
499
- {
500
- *fpr_base.d++ = double_tmp;
501
- #if _CALL_ELF != 2
502
- if ((flags & FLAG_COMPAT) != 0)
503
- *next_arg.d = double_tmp;
504
- #endif
505
- }
506
- else
507
- *next_arg.d = double_tmp;
508
- if (++next_arg.ul == gpr_end.ul)
509
- next_arg.ul = rest.ul;
510
- fparg_count++;
511
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
512
- break;
513
-
514
- case FFI_TYPE_FLOAT:
515
- double_tmp = **p_argv.f;
516
- if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
517
- {
518
- *fpr_base.d++ = double_tmp;
519
- #if _CALL_ELF != 2
520
- if ((flags & FLAG_COMPAT) != 0)
521
- *next_arg.f = (float) double_tmp;
522
- #endif
523
- }
524
- else
525
- *next_arg.f = (float) double_tmp;
526
- if (++next_arg.ul == gpr_end.ul)
527
- next_arg.ul = rest.ul;
528
- fparg_count++;
529
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
530
- break;
531
-
532
- case FFI_TYPE_STRUCT:
533
- if ((ecif->cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
534
- {
535
- align = (*ptr)->alignment;
536
- if (align > 16)
537
- align = 16;
538
- if (align > 1)
539
- next_arg.p = FFI_ALIGN (next_arg.p, align);
540
- }
541
- #if _CALL_ELF == 2
542
- elt = discover_homogeneous_aggregate (*ptr, &elnum);
543
- if (elt)
544
- {
545
- union {
546
- void *v;
547
- float *f;
548
- double *d;
549
- } arg;
550
-
551
- arg.v = *p_argv.v;
552
- if (elt == FFI_TYPE_FLOAT)
553
- {
554
- do
555
- {
556
- double_tmp = *arg.f++;
557
- if (fparg_count < NUM_FPR_ARG_REGISTERS64
558
- && i < nfixedargs)
559
- *fpr_base.d++ = double_tmp;
560
- else
561
- *next_arg.f = (float) double_tmp;
562
- if (++next_arg.f == gpr_end.f)
563
- next_arg.f = rest.f;
564
- fparg_count++;
565
- }
566
- while (--elnum != 0);
567
- if ((next_arg.p & 3) != 0)
568
- {
569
- if (++next_arg.f == gpr_end.f)
570
- next_arg.f = rest.f;
571
- }
572
- }
573
- else
574
- do
575
- {
576
- double_tmp = *arg.d++;
577
- if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
578
- *fpr_base.d++ = double_tmp;
579
- else
580
- *next_arg.d = double_tmp;
581
- if (++next_arg.d == gpr_end.d)
582
- next_arg.d = rest.d;
583
- fparg_count++;
584
- }
585
- while (--elnum != 0);
586
- }
587
- else
588
- #endif
589
- {
590
- words = ((*ptr)->size + 7) / 8;
591
- if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul)
592
- {
593
- size_t first = gpr_end.c - next_arg.c;
594
- memcpy (next_arg.c, *p_argv.c, first);
595
- memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first);
596
- next_arg.c = rest.c + words * 8 - first;
597
- }
598
- else
599
- {
600
- char *where = next_arg.c;
601
-
602
- #ifndef __LITTLE_ENDIAN__
603
- /* Structures with size less than eight bytes are passed
604
- left-padded. */
605
- if ((*ptr)->size < 8)
606
- where += 8 - (*ptr)->size;
607
- #endif
608
- memcpy (where, *p_argv.c, (*ptr)->size);
609
- next_arg.ul += words;
610
- if (next_arg.ul == gpr_end.ul)
611
- next_arg.ul = rest.ul;
612
- }
613
- }
614
- break;
615
-
616
- case FFI_TYPE_UINT8:
617
- gprvalue = **p_argv.uc;
618
- goto putgpr;
619
- case FFI_TYPE_SINT8:
620
- gprvalue = **p_argv.sc;
621
- goto putgpr;
622
- case FFI_TYPE_UINT16:
623
- gprvalue = **p_argv.us;
624
- goto putgpr;
625
- case FFI_TYPE_SINT16:
626
- gprvalue = **p_argv.ss;
627
- goto putgpr;
628
- case FFI_TYPE_UINT32:
629
- gprvalue = **p_argv.ui;
630
- goto putgpr;
631
- case FFI_TYPE_INT:
632
- case FFI_TYPE_SINT32:
633
- gprvalue = **p_argv.si;
634
- goto putgpr;
635
-
636
- case FFI_TYPE_UINT64:
637
- case FFI_TYPE_SINT64:
638
- case FFI_TYPE_POINTER:
639
- gprvalue = **p_argv.ul;
640
- putgpr:
641
- *next_arg.ul++ = gprvalue;
642
- if (next_arg.ul == gpr_end.ul)
643
- next_arg.ul = rest.ul;
644
- break;
645
- }
646
- }
647
-
648
- FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS
649
- || (next_arg.ul >= gpr_base.ul
650
- && next_arg.ul <= gpr_base.ul + 4));
651
- }
652
-
653
-
654
- #if _CALL_ELF == 2
655
- #define MIN_CACHE_LINE_SIZE 8
656
-
657
- static void
658
- flush_icache (char *wraddr, char *xaddr, int size)
659
- {
660
- int i;
661
- for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE)
662
- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
663
- : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
664
- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;"
665
- : : "r"(xaddr + size - 1), "r"(wraddr + size - 1)
666
- : "memory");
667
- }
668
- #endif
669
-
670
-
671
- ffi_status FFI_HIDDEN
672
- ffi_prep_closure_loc_linux64 (ffi_closure *closure,
673
- ffi_cif *cif,
674
- void (*fun) (ffi_cif *, void *, void **, void *),
675
- void *user_data,
676
- void *codeloc)
677
- {
678
- #if _CALL_ELF == 2
679
- unsigned int *tramp = (unsigned int *) &closure->tramp[0];
680
-
681
- if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI)
682
- return FFI_BAD_ABI;
683
-
684
- tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */
685
- tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */
686
- tramp[2] = 0x7d8903a6; /* mtctr 12 */
687
- tramp[3] = 0x4e800420; /* bctr */
688
- /* 1: .quad function_addr */
689
- /* 2: .quad context */
690
- *(void **) &tramp[4] = (void *) ffi_closure_LINUX64;
691
- *(void **) &tramp[6] = codeloc;
692
- flush_icache ((char *) tramp, (char *) codeloc, 4 * 4);
693
- #else
694
- void **tramp = (void **) &closure->tramp[0];
695
-
696
- if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI)
697
- return FFI_BAD_ABI;
698
-
699
- /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */
700
- memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *));
701
- tramp[1] = codeloc;
702
- memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *));
703
- #endif
704
-
705
- closure->cif = cif;
706
- closure->fun = fun;
707
- closure->user_data = user_data;
708
-
709
- return FFI_OK;
710
- }
711
-
712
-
713
- int FFI_HIDDEN
714
- ffi_closure_helper_LINUX64 (ffi_cif *cif,
715
- void (*fun) (ffi_cif *, void *, void **, void *),
716
- void *user_data,
717
- void *rvalue,
718
- unsigned long *pst,
719
- ffi_dblfl *pfr)
720
- {
721
- /* rvalue is the pointer to space for return value in closure assembly */
722
- /* pst is the pointer to parameter save area
723
- (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
724
- /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
725
-
726
- void **avalue;
727
- ffi_type **arg_types;
728
- unsigned long i, avn, nfixedargs;
729
- ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
730
- unsigned long align;
731
-
732
- avalue = alloca (cif->nargs * sizeof (void *));
733
-
734
- /* Copy the caller's structure return value address so that the
735
- closure returns the data directly to the caller. */
736
- if (cif->rtype->type == FFI_TYPE_STRUCT
737
- && (cif->flags & FLAG_RETURNS_SMST) == 0)
738
- {
739
- rvalue = (void *) *pst;
740
- pst++;
741
- }
742
-
743
- i = 0;
744
- avn = cif->nargs;
745
- #if _CALL_ELF != 2
746
- nfixedargs = (unsigned) -1;
747
- if ((cif->flags & FLAG_COMPAT) == 0)
748
- #endif
749
- nfixedargs = cif->nfixedargs;
750
- arg_types = cif->arg_types;
751
-
752
- /* Grab the addresses of the arguments from the stack frame. */
753
- while (i < avn)
754
- {
755
- unsigned int elt, elnum;
756
-
757
- switch (arg_types[i]->type)
758
- {
759
- case FFI_TYPE_SINT8:
760
- case FFI_TYPE_UINT8:
761
- #ifndef __LITTLE_ENDIAN__
762
- avalue[i] = (char *) pst + 7;
763
- pst++;
764
- break;
765
- #endif
766
-
767
- case FFI_TYPE_SINT16:
768
- case FFI_TYPE_UINT16:
769
- #ifndef __LITTLE_ENDIAN__
770
- avalue[i] = (char *) pst + 6;
771
- pst++;
772
- break;
773
- #endif
774
-
775
- case FFI_TYPE_SINT32:
776
- case FFI_TYPE_UINT32:
777
- #ifndef __LITTLE_ENDIAN__
778
- avalue[i] = (char *) pst + 4;
779
- pst++;
780
- break;
781
- #endif
782
-
783
- case FFI_TYPE_SINT64:
784
- case FFI_TYPE_UINT64:
785
- case FFI_TYPE_POINTER:
786
- avalue[i] = pst;
787
- pst++;
788
- break;
789
-
790
- case FFI_TYPE_STRUCT:
791
- if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
792
- {
793
- align = arg_types[i]->alignment;
794
- if (align > 16)
795
- align = 16;
796
- if (align > 1)
797
- pst = (unsigned long *) FFI_ALIGN ((size_t) pst, align);
798
- }
799
- elt = 0;
800
- #if _CALL_ELF == 2
801
- elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
802
- #endif
803
- if (elt)
804
- {
805
- union {
806
- void *v;
807
- unsigned long *ul;
808
- float *f;
809
- double *d;
810
- size_t p;
811
- } to, from;
812
-
813
- /* Repackage the aggregate from its parts. The
814
- aggregate size is not greater than the space taken by
815
- the registers so store back to the register/parameter
816
- save arrays. */
817
- if (pfr + elnum <= end_pfr)
818
- to.v = pfr;
819
- else
820
- to.v = pst;
821
-
822
- avalue[i] = to.v;
823
- from.ul = pst;
824
- if (elt == FFI_TYPE_FLOAT)
825
- {
826
- do
827
- {
828
- if (pfr < end_pfr && i < nfixedargs)
829
- {
830
- *to.f = (float) pfr->d;
831
- pfr++;
832
- }
833
- else
834
- *to.f = *from.f;
835
- to.f++;
836
- from.f++;
837
- }
838
- while (--elnum != 0);
839
- }
840
- else
841
- {
842
- do
843
- {
844
- if (pfr < end_pfr && i < nfixedargs)
845
- {
846
- *to.d = pfr->d;
847
- pfr++;
848
- }
849
- else
850
- *to.d = *from.d;
851
- to.d++;
852
- from.d++;
853
- }
854
- while (--elnum != 0);
855
- }
856
- }
857
- else
858
- {
859
- #ifndef __LITTLE_ENDIAN__
860
- /* Structures with size less than eight bytes are passed
861
- left-padded. */
862
- if (arg_types[i]->size < 8)
863
- avalue[i] = (char *) pst + 8 - arg_types[i]->size;
864
- else
865
- #endif
866
- avalue[i] = pst;
867
- }
868
- pst += (arg_types[i]->size + 7) / 8;
869
- break;
870
-
871
- #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
872
- case FFI_TYPE_LONGDOUBLE:
873
- if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
874
- {
875
- if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
876
- {
877
- avalue[i] = pfr;
878
- pfr += 2;
879
- }
880
- else
881
- {
882
- if (pfr < end_pfr && i < nfixedargs)
883
- {
884
- /* Passed partly in f13 and partly on the stack.
885
- Move it all to the stack. */
886
- *pst = *(unsigned long *) pfr;
887
- pfr++;
888
- }
889
- avalue[i] = pst;
890
- }
891
- pst += 2;
892
- break;
893
- }
894
- /* Fall through. */
895
- #endif
896
- case FFI_TYPE_DOUBLE:
897
- /* On the outgoing stack all values are aligned to 8 */
898
- /* there are 13 64bit floating point registers */
899
-
900
- if (pfr < end_pfr && i < nfixedargs)
901
- {
902
- avalue[i] = pfr;
903
- pfr++;
904
- }
905
- else
906
- avalue[i] = pst;
907
- pst++;
908
- break;
909
-
910
- case FFI_TYPE_FLOAT:
911
- if (pfr < end_pfr && i < nfixedargs)
912
- {
913
- /* Float values are stored as doubles in the
914
- ffi_closure_LINUX64 code. Fix them here. */
915
- pfr->f = (float) pfr->d;
916
- avalue[i] = pfr;
917
- pfr++;
918
- }
919
- else
920
- avalue[i] = pst;
921
- pst++;
922
- break;
923
-
924
- default:
925
- FFI_ASSERT (0);
926
- }
927
-
928
- i++;
929
- }
930
-
931
- (*fun) (cif, rvalue, avalue, user_data);
932
-
933
- /* Tell ffi_closure_LINUX64 how to perform return type promotions. */
934
- if ((cif->flags & FLAG_RETURNS_SMST) != 0)
935
- {
936
- if ((cif->flags & FLAG_RETURNS_FP) == 0)
937
- return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
938
- else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
939
- return FFI_V2_TYPE_DOUBLE_HOMOG;
940
- else
941
- return FFI_V2_TYPE_FLOAT_HOMOG;
942
- }
943
- return cif->rtype->type;
944
- }
945
- #endif