ffi 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.gitmodules +4 -0
- data/.travis.yml +42 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +131 -0
- data/COPYING +49 -0
- data/Gemfile +15 -0
- data/LICENSE +24 -0
- data/LICENSE.SPECS +22 -0
- data/README.md +115 -0
- data/Rakefile +195 -0
- data/appveyor.yml +27 -0
- data/ext/ffi_c/AbstractMemory.c +1109 -0
- data/ext/ffi_c/AbstractMemory.h +175 -0
- data/ext/ffi_c/ArrayType.c +162 -0
- data/ext/ffi_c/ArrayType.h +59 -0
- data/ext/ffi_c/Buffer.c +365 -0
- data/ext/ffi_c/Call.c +503 -0
- data/ext/ffi_c/Call.h +107 -0
- data/ext/ffi_c/ClosurePool.c +283 -0
- data/ext/ffi_c/ClosurePool.h +57 -0
- data/ext/ffi_c/DynamicLibrary.c +339 -0
- data/ext/ffi_c/DynamicLibrary.h +98 -0
- data/ext/ffi_c/Function.c +917 -0
- data/ext/ffi_c/Function.h +87 -0
- data/ext/ffi_c/FunctionInfo.c +271 -0
- data/ext/ffi_c/LastError.c +229 -0
- data/ext/ffi_c/LastError.h +47 -0
- data/ext/ffi_c/LongDouble.c +63 -0
- data/ext/ffi_c/LongDouble.h +51 -0
- data/ext/ffi_c/MappedType.c +168 -0
- data/ext/ffi_c/MappedType.h +59 -0
- data/ext/ffi_c/MemoryPointer.c +197 -0
- data/ext/ffi_c/MemoryPointer.h +53 -0
- data/ext/ffi_c/MethodHandle.c +358 -0
- data/ext/ffi_c/MethodHandle.h +55 -0
- data/ext/ffi_c/Platform.c +82 -0
- data/ext/ffi_c/Platform.h +45 -0
- data/ext/ffi_c/Pointer.c +508 -0
- data/ext/ffi_c/Pointer.h +63 -0
- data/ext/ffi_c/Struct.c +829 -0
- data/ext/ffi_c/Struct.h +106 -0
- data/ext/ffi_c/StructByValue.c +150 -0
- data/ext/ffi_c/StructByValue.h +55 -0
- data/ext/ffi_c/StructLayout.c +698 -0
- data/ext/ffi_c/Thread.c +137 -0
- data/ext/ffi_c/Thread.h +84 -0
- data/ext/ffi_c/Type.c +379 -0
- data/ext/ffi_c/Type.h +61 -0
- data/ext/ffi_c/Types.c +139 -0
- data/ext/ffi_c/Types.h +89 -0
- data/ext/ffi_c/Variadic.c +298 -0
- data/ext/ffi_c/compat.h +78 -0
- data/ext/ffi_c/extconf.rb +86 -0
- data/ext/ffi_c/ffi.c +93 -0
- data/ext/ffi_c/libffi.bsd.mk +40 -0
- data/ext/ffi_c/libffi.darwin.mk +105 -0
- data/ext/ffi_c/libffi.gnu.mk +32 -0
- data/ext/ffi_c/libffi.mk +18 -0
- data/ext/ffi_c/libffi.vc.mk +26 -0
- data/ext/ffi_c/libffi.vc64.mk +26 -0
- data/ext/ffi_c/libffi/.appveyor.yml +50 -0
- data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.gitignore +38 -0
- data/ext/ffi_c/libffi/.travis.yml +34 -0
- data/ext/ffi_c/libffi/.travis/ar-lib +270 -0
- data/ext/ffi_c/libffi/.travis/build.sh +34 -0
- data/ext/ffi_c/libffi/.travis/compile +351 -0
- data/ext/ffi_c/libffi/.travis/install.sh +22 -0
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +60 -0
- data/ext/ffi_c/libffi/.travis/site.exp +18 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi +584 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi-3.1 +6000 -0
- data/ext/ffi_c/libffi/ChangeLog.libgcj +40 -0
- data/ext/ffi_c/libffi/ChangeLog.v1 +764 -0
- data/ext/ffi_c/libffi/LICENSE +21 -0
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +352 -0
- data/ext/ffi_c/libffi/Makefile.am +166 -0
- data/ext/ffi_c/libffi/README.md +461 -0
- data/ext/ffi_c/libffi/acinclude.m4 +479 -0
- data/ext/ffi_c/libffi/autogen.sh +2 -0
- data/ext/ffi_c/libffi/config.guess +1466 -0
- data/ext/ffi_c/libffi/config.sub +1836 -0
- data/ext/ffi_c/libffi/configure.ac +394 -0
- data/ext/ffi_c/libffi/configure.host +289 -0
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +203 -0
- data/ext/ffi_c/libffi/include/Makefile.am +9 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +511 -0
- data/ext/ffi_c/libffi/include/ffi_cfi.h +55 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +149 -0
- data/ext/ffi_c/libffi/libffi.map.in +80 -0
- data/ext/ffi_c/libffi/libffi.pc.in +11 -0
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +1043 -0
- data/ext/ffi_c/libffi/libtool-version +29 -0
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +71 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +194 -0
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +122 -0
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +74 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +87 -0
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +70 -0
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +302 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +263 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +89 -0
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/man/Makefile.am +8 -0
- data/ext/ffi_c/libffi/man/ffi.3 +41 -0
- data/ext/ffi_c/libffi/man/ffi_call.3 +103 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +68 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
- data/ext/ffi_c/libffi/msvcc.sh +328 -0
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +941 -0
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +81 -0
- data/ext/ffi_c/libffi/src/aarch64/internal.h +67 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +438 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +521 -0
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +282 -0
- data/ext/ffi_c/libffi/src/arc/arcompact.S +135 -0
- data/ext/ffi_c/libffi/src/arc/ffi.c +266 -0
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +819 -0
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/arm/internal.h +7 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +383 -0
- data/ext/ffi_c/libffi/src/avr32/ffi.c +423 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +55 -0
- data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
- data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
- data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
- data/ext/ffi_c/libffi/src/closures.c +966 -0
- data/ext/ffi_c/libffi/src/cris/ffi.c +386 -0
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +56 -0
- data/ext/ffi_c/libffi/src/cris/sysv.S +215 -0
- data/ext/ffi_c/libffi/src/debug.c +64 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +5166 -0
- data/ext/ffi_c/libffi/src/frv/eabi.S +128 -0
- data/ext/ffi_c/libffi/src/frv/ffi.c +292 -0
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/ia64/ffi.c +604 -0
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +56 -0
- data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +40 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +567 -0
- data/ext/ffi_c/libffi/src/java_raw_api.c +374 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +232 -0
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/m32r/sysv.S +121 -0
- data/ext/ffi_c/libffi/src/m68k/ffi.c +362 -0
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +54 -0
- data/ext/ffi_c/libffi/src/m68k/sysv.S +357 -0
- data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
- data/ext/ffi_c/libffi/src/metag/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +1130 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +244 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +663 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +502 -0
- data/ext/ffi_c/libffi/src/moxie/eabi.S +101 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +285 -0
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +328 -0
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +719 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +85 -0
- data/ext/ffi_c/libffi/src/pa/hpux32.S +368 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +357 -0
- data/ext/ffi_c/libffi/src/powerpc/aix.S +566 -0
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +694 -0
- data/ext/ffi_c/libffi/src/powerpc/asm.h +125 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +378 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +571 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +173 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +1440 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +974 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +94 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +198 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +228 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +488 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +397 -0
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +175 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +261 -0
- data/ext/ffi_c/libffi/src/raw_api.c +267 -0
- data/ext/ffi_c/libffi/src/riscv/ffi.c +481 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +69 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +293 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +756 -0
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +70 -0
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +325 -0
- data/ext/ffi_c/libffi/src/sh/ffi.c +717 -0
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +54 -0
- data/ext/ffi_c/libffi/src/sh/sysv.S +850 -0
- data/ext/ffi_c/libffi/src/sh64/ffi.c +469 -0
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/sh64/sysv.S +539 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +468 -0
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +608 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +81 -0
- data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +443 -0
- data/ext/ffi_c/libffi/src/sparc/v9.S +440 -0
- data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
- data/ext/ffi_c/libffi/src/types.c +108 -0
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
- data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +754 -0
- data/ext/ffi_c/libffi/src/x86/ffi64.c +884 -0
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +147 -0
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +308 -0
- data/ext/ffi_c/libffi/src/x86/internal.h +29 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +22 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +1129 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +566 -0
- data/ext/ffi_c/libffi/src/x86/win64.S +232 -0
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +237 -0
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +298 -0
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +258 -0
- data/ext/ffi_c/libffi/stamp-h.in +1 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +117 -0
- data/ext/ffi_c/libffi/testsuite/config/default.exp +1 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +636 -0
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +283 -0
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1745 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +743 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +82 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_simple.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +94 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +96 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3float.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +109 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +97 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +88 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +132 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +115 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +105 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_args.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +142 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_struct_va1.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint_va.c +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulong_va.c +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +47 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +26 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +138 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +62 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +107 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +341 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +52 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +152 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +161 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct11.c +121 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +112 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +145 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +148 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +125 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +68 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +54 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +196 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +121 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +123 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +125 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
- data/ext/ffi_c/rbffi.h +55 -0
- data/ext/ffi_c/rbffi_endian.h +59 -0
- data/ext/ffi_c/win32/stdbool.h +8 -0
- data/ext/ffi_c/win32/stdint.h +201 -0
- data/ffi.gemspec +43 -0
- data/lib/ffi.rb +20 -0
- data/lib/ffi/autopointer.rb +203 -0
- data/lib/ffi/buffer.rb +4 -0
- data/lib/ffi/callback.rb +4 -0
- data/lib/ffi/data_converter.rb +67 -0
- data/lib/ffi/enum.rb +296 -0
- data/lib/ffi/errno.rb +43 -0
- data/lib/ffi/ffi.rb +45 -0
- data/lib/ffi/io.rb +62 -0
- data/lib/ffi/library.rb +588 -0
- data/lib/ffi/managedstruct.rb +84 -0
- data/lib/ffi/memorypointer.rb +1 -0
- data/lib/ffi/platform.rb +172 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/lib/ffi/platform/mips64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/lib/ffi/platform/sparc64-linux/types.conf +102 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +128 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +120 -0
- data/lib/ffi/pointer.rb +160 -0
- data/lib/ffi/struct.rb +311 -0
- data/lib/ffi/struct_by_reference.rb +72 -0
- data/lib/ffi/struct_layout.rb +96 -0
- data/lib/ffi/struct_layout_builder.rb +227 -0
- data/lib/ffi/tools/const_generator.rb +230 -0
- data/lib/ffi/tools/generator.rb +105 -0
- data/lib/ffi/tools/generator_task.rb +32 -0
- data/lib/ffi/tools/struct_generator.rb +194 -0
- data/lib/ffi/tools/types_generator.rb +134 -0
- data/lib/ffi/types.rb +194 -0
- data/lib/ffi/union.rb +43 -0
- data/lib/ffi/variadic.rb +78 -0
- data/lib/ffi/version.rb +3 -0
- data/samples/getlogin.rb +8 -0
- data/samples/getpid.rb +8 -0
- data/samples/gettimeofday.rb +18 -0
- data/samples/hello.rb +7 -0
- data/samples/inotify.rb +60 -0
- data/samples/pty.rb +76 -0
- data/samples/qsort.rb +21 -0
- data/samples/sample_helper.rb +6 -0
- metadata +663 -0
@@ -0,0 +1,244 @@
|
|
1
|
+
/* -----------------------------------------------------------------*-C-*-
|
2
|
+
ffitarget.h - Copyright (c) 2012 Anthony Green
|
3
|
+
Copyright (c) 1996-2003 Red Hat, Inc.
|
4
|
+
Target configuration macros for MIPS.
|
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
|
+
|
28
|
+
#ifndef LIBFFI_TARGET_H
|
29
|
+
#define LIBFFI_TARGET_H
|
30
|
+
|
31
|
+
#ifndef LIBFFI_H
|
32
|
+
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#ifdef __linux__
|
36
|
+
# include <asm/sgidefs.h>
|
37
|
+
#elif defined(__rtems__)
|
38
|
+
/*
|
39
|
+
* Subprogram calling convention - copied from sgidefs.h
|
40
|
+
*/
|
41
|
+
#define _MIPS_SIM_ABI32 1
|
42
|
+
#define _MIPS_SIM_NABI32 2
|
43
|
+
#define _MIPS_SIM_ABI64 3
|
44
|
+
#elif !defined(__OpenBSD__)
|
45
|
+
# include <sgidefs.h>
|
46
|
+
#endif
|
47
|
+
|
48
|
+
# ifndef _ABIN32
|
49
|
+
# define _ABIN32 _MIPS_SIM_NABI32
|
50
|
+
# endif
|
51
|
+
# ifndef _ABI64
|
52
|
+
# define _ABI64 _MIPS_SIM_ABI64
|
53
|
+
# endif
|
54
|
+
# ifndef _ABIO32
|
55
|
+
# define _ABIO32 _MIPS_SIM_ABI32
|
56
|
+
# endif
|
57
|
+
|
58
|
+
#if !defined(_MIPS_SIM)
|
59
|
+
# error -- something is very wrong --
|
60
|
+
#else
|
61
|
+
# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
|
62
|
+
# define FFI_MIPS_N32
|
63
|
+
# else
|
64
|
+
# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
|
65
|
+
# define FFI_MIPS_O32
|
66
|
+
# else
|
67
|
+
# error -- this is an unsupported platform --
|
68
|
+
# endif
|
69
|
+
# endif
|
70
|
+
#endif
|
71
|
+
|
72
|
+
#ifdef FFI_MIPS_O32
|
73
|
+
/* O32 stack frames have 32bit integer args */
|
74
|
+
# define FFI_SIZEOF_ARG 4
|
75
|
+
#else
|
76
|
+
/* N32 and N64 frames have 64bit integer args */
|
77
|
+
# define FFI_SIZEOF_ARG 8
|
78
|
+
# if _MIPS_SIM == _ABIN32
|
79
|
+
# define FFI_SIZEOF_JAVA_RAW 4
|
80
|
+
# endif
|
81
|
+
#endif
|
82
|
+
|
83
|
+
#define FFI_FLAG_BITS 2
|
84
|
+
|
85
|
+
/* SGI's strange assembler requires that we multiply by 4 rather
|
86
|
+
than shift left by FFI_FLAG_BITS */
|
87
|
+
|
88
|
+
#define FFI_ARGS_D FFI_TYPE_DOUBLE
|
89
|
+
#define FFI_ARGS_F FFI_TYPE_FLOAT
|
90
|
+
#define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE
|
91
|
+
#define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT
|
92
|
+
#define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT
|
93
|
+
#define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE
|
94
|
+
|
95
|
+
/* Needed for N32 structure returns */
|
96
|
+
#define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8
|
97
|
+
#define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8
|
98
|
+
|
99
|
+
#if 0
|
100
|
+
/* The SGI assembler can't handle this.. */
|
101
|
+
#define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT
|
102
|
+
/* (and so on) */
|
103
|
+
#else
|
104
|
+
/* ...so we calculate these by hand! */
|
105
|
+
#define FFI_TYPE_STRUCT_D 61
|
106
|
+
#define FFI_TYPE_STRUCT_F 45
|
107
|
+
#define FFI_TYPE_STRUCT_DD 253
|
108
|
+
#define FFI_TYPE_STRUCT_FF 173
|
109
|
+
#define FFI_TYPE_STRUCT_FD 237
|
110
|
+
#define FFI_TYPE_STRUCT_DF 189
|
111
|
+
#define FFI_TYPE_STRUCT_SMALL 93
|
112
|
+
#define FFI_TYPE_STRUCT_SMALL2 109
|
113
|
+
|
114
|
+
/* and for n32 soft float, add 16 * 2^4 */
|
115
|
+
#define FFI_TYPE_STRUCT_D_SOFT 317
|
116
|
+
#define FFI_TYPE_STRUCT_F_SOFT 301
|
117
|
+
#define FFI_TYPE_STRUCT_DD_SOFT 509
|
118
|
+
#define FFI_TYPE_STRUCT_FF_SOFT 429
|
119
|
+
#define FFI_TYPE_STRUCT_FD_SOFT 493
|
120
|
+
#define FFI_TYPE_STRUCT_DF_SOFT 445
|
121
|
+
#define FFI_TYPE_STRUCT_SOFT 16
|
122
|
+
#endif
|
123
|
+
|
124
|
+
#ifdef LIBFFI_ASM
|
125
|
+
#define v0 $2
|
126
|
+
#define v1 $3
|
127
|
+
#define a0 $4
|
128
|
+
#define a1 $5
|
129
|
+
#define a2 $6
|
130
|
+
#define a3 $7
|
131
|
+
#define a4 $8
|
132
|
+
#define a5 $9
|
133
|
+
#define a6 $10
|
134
|
+
#define a7 $11
|
135
|
+
#define t0 $8
|
136
|
+
#define t1 $9
|
137
|
+
#define t2 $10
|
138
|
+
#define t3 $11
|
139
|
+
#define t4 $12
|
140
|
+
#define t5 $13
|
141
|
+
#define t6 $14
|
142
|
+
#define t7 $15
|
143
|
+
#define t8 $24
|
144
|
+
#define t9 $25
|
145
|
+
#define ra $31
|
146
|
+
|
147
|
+
#ifdef FFI_MIPS_O32
|
148
|
+
# define REG_L lw
|
149
|
+
# define REG_S sw
|
150
|
+
# define SUBU subu
|
151
|
+
# define ADDU addu
|
152
|
+
# define SRL srl
|
153
|
+
# define LI li
|
154
|
+
#else /* !FFI_MIPS_O32 */
|
155
|
+
# define REG_L ld
|
156
|
+
# define REG_S sd
|
157
|
+
# define SUBU dsubu
|
158
|
+
# define ADDU daddu
|
159
|
+
# define SRL dsrl
|
160
|
+
# define LI dli
|
161
|
+
# if (_MIPS_SIM==_ABI64)
|
162
|
+
# define LA dla
|
163
|
+
# define EH_FRAME_ALIGN 3
|
164
|
+
# define FDE_ADDR_BYTES .8byte
|
165
|
+
# else
|
166
|
+
# define LA la
|
167
|
+
# define EH_FRAME_ALIGN 2
|
168
|
+
# define FDE_ADDR_BYTES .4byte
|
169
|
+
# endif /* _MIPS_SIM==_ABI64 */
|
170
|
+
#endif /* !FFI_MIPS_O32 */
|
171
|
+
#else /* !LIBFFI_ASM */
|
172
|
+
# ifdef __GNUC__
|
173
|
+
# ifdef FFI_MIPS_O32
|
174
|
+
/* O32 stack frames have 32bit integer args */
|
175
|
+
typedef unsigned int ffi_arg __attribute__((__mode__(__SI__)));
|
176
|
+
typedef signed int ffi_sarg __attribute__((__mode__(__SI__)));
|
177
|
+
#else
|
178
|
+
/* N32 and N64 frames have 64bit integer args */
|
179
|
+
typedef unsigned int ffi_arg __attribute__((__mode__(__DI__)));
|
180
|
+
typedef signed int ffi_sarg __attribute__((__mode__(__DI__)));
|
181
|
+
# endif
|
182
|
+
# else
|
183
|
+
# ifdef FFI_MIPS_O32
|
184
|
+
/* O32 stack frames have 32bit integer args */
|
185
|
+
typedef __uint32_t ffi_arg;
|
186
|
+
typedef __int32_t ffi_sarg;
|
187
|
+
# else
|
188
|
+
/* N32 and N64 frames have 64bit integer args */
|
189
|
+
typedef __uint64_t ffi_arg;
|
190
|
+
typedef __int64_t ffi_sarg;
|
191
|
+
# endif
|
192
|
+
# endif /* __GNUC__ */
|
193
|
+
|
194
|
+
typedef enum ffi_abi {
|
195
|
+
FFI_FIRST_ABI = 0,
|
196
|
+
FFI_O32,
|
197
|
+
FFI_N32,
|
198
|
+
FFI_N64,
|
199
|
+
FFI_O32_SOFT_FLOAT,
|
200
|
+
FFI_N32_SOFT_FLOAT,
|
201
|
+
FFI_N64_SOFT_FLOAT,
|
202
|
+
FFI_LAST_ABI,
|
203
|
+
|
204
|
+
#ifdef FFI_MIPS_O32
|
205
|
+
#ifdef __mips_soft_float
|
206
|
+
FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT
|
207
|
+
#else
|
208
|
+
FFI_DEFAULT_ABI = FFI_O32
|
209
|
+
#endif
|
210
|
+
#else
|
211
|
+
# if _MIPS_SIM==_ABI64
|
212
|
+
# ifdef __mips_soft_float
|
213
|
+
FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT
|
214
|
+
# else
|
215
|
+
FFI_DEFAULT_ABI = FFI_N64
|
216
|
+
# endif
|
217
|
+
# else
|
218
|
+
# ifdef __mips_soft_float
|
219
|
+
FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT
|
220
|
+
# else
|
221
|
+
FFI_DEFAULT_ABI = FFI_N32
|
222
|
+
# endif
|
223
|
+
# endif
|
224
|
+
#endif
|
225
|
+
} ffi_abi;
|
226
|
+
|
227
|
+
#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag; unsigned mips_nfixedargs
|
228
|
+
#define FFI_TARGET_SPECIFIC_VARIADIC
|
229
|
+
#endif /* !LIBFFI_ASM */
|
230
|
+
|
231
|
+
/* ---- Definitions for closures ----------------------------------------- */
|
232
|
+
|
233
|
+
#define FFI_CLOSURES 1
|
234
|
+
#define FFI_GO_CLOSURES 1
|
235
|
+
#define FFI_NATIVE_RAW_API 0
|
236
|
+
|
237
|
+
#if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32)
|
238
|
+
# define FFI_TRAMPOLINE_SIZE 20
|
239
|
+
#else
|
240
|
+
# define FFI_TRAMPOLINE_SIZE 56
|
241
|
+
#endif
|
242
|
+
|
243
|
+
#endif
|
244
|
+
|
@@ -0,0 +1,663 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc.
|
3
|
+
|
4
|
+
MIPS 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
|
+
/* Only build this code if we are compiling for n32 */
|
32
|
+
|
33
|
+
#if defined(FFI_MIPS_N32)
|
34
|
+
|
35
|
+
#define callback a0
|
36
|
+
#define bytes a2
|
37
|
+
#define flags a3
|
38
|
+
#define raddr a4
|
39
|
+
#define fn a5
|
40
|
+
#define closure a6
|
41
|
+
|
42
|
+
/* Note: to keep stack 16 byte aligned we need even number slots
|
43
|
+
used 9 slots here
|
44
|
+
*/
|
45
|
+
#define SIZEOF_FRAME ( 10 * FFI_SIZEOF_ARG )
|
46
|
+
|
47
|
+
#ifdef __GNUC__
|
48
|
+
.abicalls
|
49
|
+
#endif
|
50
|
+
#if !defined(__mips_isa_rev) || (__mips_isa_rev<6)
|
51
|
+
.set mips4
|
52
|
+
#endif
|
53
|
+
.text
|
54
|
+
.align 2
|
55
|
+
.globl ffi_call_N32
|
56
|
+
.ent ffi_call_N32
|
57
|
+
ffi_call_N32:
|
58
|
+
.LFB0:
|
59
|
+
.frame $fp, SIZEOF_FRAME, ra
|
60
|
+
.mask 0xc0000000,-FFI_SIZEOF_ARG
|
61
|
+
.fmask 0x00000000,0
|
62
|
+
|
63
|
+
# Prologue
|
64
|
+
SUBU $sp, SIZEOF_FRAME # Frame size
|
65
|
+
.LCFI00:
|
66
|
+
REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
|
67
|
+
REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
|
68
|
+
.LCFI01:
|
69
|
+
move $fp, $sp
|
70
|
+
.LCFI02:
|
71
|
+
move t9, callback # callback function pointer
|
72
|
+
REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes
|
73
|
+
REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags
|
74
|
+
REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr
|
75
|
+
REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn
|
76
|
+
REG_S closure, 6*FFI_SIZEOF_ARG($fp) # closure
|
77
|
+
|
78
|
+
# Allocate at least 4 words in the argstack
|
79
|
+
move v0, bytes
|
80
|
+
bge bytes, 4 * FFI_SIZEOF_ARG, bigger
|
81
|
+
LI v0, 4 * FFI_SIZEOF_ARG
|
82
|
+
b sixteen
|
83
|
+
|
84
|
+
bigger:
|
85
|
+
ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned
|
86
|
+
and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry.
|
87
|
+
|
88
|
+
sixteen:
|
89
|
+
SUBU $sp, $sp, v0 # move the stack pointer to reflect the
|
90
|
+
# arg space
|
91
|
+
|
92
|
+
move a0, $sp # 4 * FFI_SIZEOF_ARG
|
93
|
+
ADDU a3, $fp, 3 * FFI_SIZEOF_ARG
|
94
|
+
|
95
|
+
# Call ffi_prep_args
|
96
|
+
jal t9
|
97
|
+
|
98
|
+
# Copy the stack pointer to t9
|
99
|
+
move t9, $sp
|
100
|
+
|
101
|
+
# Fix the stack if there are more than 8 64bit slots worth
|
102
|
+
# of arguments.
|
103
|
+
|
104
|
+
# Load the number of bytes
|
105
|
+
REG_L t6, 2*FFI_SIZEOF_ARG($fp)
|
106
|
+
|
107
|
+
# Is it bigger than 8 * FFI_SIZEOF_ARG?
|
108
|
+
daddiu t8, t6, -(8 * FFI_SIZEOF_ARG)
|
109
|
+
bltz t8, loadregs
|
110
|
+
|
111
|
+
ADDU t9, t9, t8
|
112
|
+
|
113
|
+
loadregs:
|
114
|
+
|
115
|
+
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
|
116
|
+
|
117
|
+
#ifdef __mips_soft_float
|
118
|
+
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
|
119
|
+
REG_L a1, 1*FFI_SIZEOF_ARG(t9)
|
120
|
+
REG_L a2, 2*FFI_SIZEOF_ARG(t9)
|
121
|
+
REG_L a3, 3*FFI_SIZEOF_ARG(t9)
|
122
|
+
REG_L a4, 4*FFI_SIZEOF_ARG(t9)
|
123
|
+
REG_L a5, 5*FFI_SIZEOF_ARG(t9)
|
124
|
+
REG_L a6, 6*FFI_SIZEOF_ARG(t9)
|
125
|
+
REG_L a7, 7*FFI_SIZEOF_ARG(t9)
|
126
|
+
#else
|
127
|
+
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
|
128
|
+
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
|
129
|
+
beqz t4, arg1_next
|
130
|
+
bne t4, FFI_TYPE_FLOAT, arg1_doublep
|
131
|
+
l.s $f12, 0*FFI_SIZEOF_ARG(t9)
|
132
|
+
b arg1_next
|
133
|
+
arg1_doublep:
|
134
|
+
l.d $f12, 0*FFI_SIZEOF_ARG(t9)
|
135
|
+
arg1_next:
|
136
|
+
|
137
|
+
SRL t4, t6, 1*FFI_FLAG_BITS
|
138
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
139
|
+
REG_L a1, 1*FFI_SIZEOF_ARG(t9)
|
140
|
+
beqz t4, arg2_next
|
141
|
+
bne t4, FFI_TYPE_FLOAT, arg2_doublep
|
142
|
+
l.s $f13, 1*FFI_SIZEOF_ARG(t9)
|
143
|
+
b arg2_next
|
144
|
+
arg2_doublep:
|
145
|
+
l.d $f13, 1*FFI_SIZEOF_ARG(t9)
|
146
|
+
arg2_next:
|
147
|
+
|
148
|
+
SRL t4, t6, 2*FFI_FLAG_BITS
|
149
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
150
|
+
REG_L a2, 2*FFI_SIZEOF_ARG(t9)
|
151
|
+
beqz t4, arg3_next
|
152
|
+
bne t4, FFI_TYPE_FLOAT, arg3_doublep
|
153
|
+
l.s $f14, 2*FFI_SIZEOF_ARG(t9)
|
154
|
+
b arg3_next
|
155
|
+
arg3_doublep:
|
156
|
+
l.d $f14, 2*FFI_SIZEOF_ARG(t9)
|
157
|
+
arg3_next:
|
158
|
+
|
159
|
+
SRL t4, t6, 3*FFI_FLAG_BITS
|
160
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
161
|
+
REG_L a3, 3*FFI_SIZEOF_ARG(t9)
|
162
|
+
beqz t4, arg4_next
|
163
|
+
bne t4, FFI_TYPE_FLOAT, arg4_doublep
|
164
|
+
l.s $f15, 3*FFI_SIZEOF_ARG(t9)
|
165
|
+
b arg4_next
|
166
|
+
arg4_doublep:
|
167
|
+
l.d $f15, 3*FFI_SIZEOF_ARG(t9)
|
168
|
+
arg4_next:
|
169
|
+
|
170
|
+
SRL t4, t6, 4*FFI_FLAG_BITS
|
171
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
172
|
+
REG_L a4, 4*FFI_SIZEOF_ARG(t9)
|
173
|
+
beqz t4, arg5_next
|
174
|
+
bne t4, FFI_TYPE_FLOAT, arg5_doublep
|
175
|
+
l.s $f16, 4*FFI_SIZEOF_ARG(t9)
|
176
|
+
b arg5_next
|
177
|
+
arg5_doublep:
|
178
|
+
l.d $f16, 4*FFI_SIZEOF_ARG(t9)
|
179
|
+
arg5_next:
|
180
|
+
|
181
|
+
SRL t4, t6, 5*FFI_FLAG_BITS
|
182
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
183
|
+
REG_L a5, 5*FFI_SIZEOF_ARG(t9)
|
184
|
+
beqz t4, arg6_next
|
185
|
+
bne t4, FFI_TYPE_FLOAT, arg6_doublep
|
186
|
+
l.s $f17, 5*FFI_SIZEOF_ARG(t9)
|
187
|
+
b arg6_next
|
188
|
+
arg6_doublep:
|
189
|
+
l.d $f17, 5*FFI_SIZEOF_ARG(t9)
|
190
|
+
arg6_next:
|
191
|
+
|
192
|
+
SRL t4, t6, 6*FFI_FLAG_BITS
|
193
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
194
|
+
REG_L a6, 6*FFI_SIZEOF_ARG(t9)
|
195
|
+
beqz t4, arg7_next
|
196
|
+
bne t4, FFI_TYPE_FLOAT, arg7_doublep
|
197
|
+
l.s $f18, 6*FFI_SIZEOF_ARG(t9)
|
198
|
+
b arg7_next
|
199
|
+
arg7_doublep:
|
200
|
+
l.d $f18, 6*FFI_SIZEOF_ARG(t9)
|
201
|
+
arg7_next:
|
202
|
+
|
203
|
+
SRL t4, t6, 7*FFI_FLAG_BITS
|
204
|
+
and t4, ((1<<FFI_FLAG_BITS)-1)
|
205
|
+
REG_L a7, 7*FFI_SIZEOF_ARG(t9)
|
206
|
+
beqz t4, arg8_next
|
207
|
+
bne t4, FFI_TYPE_FLOAT, arg8_doublep
|
208
|
+
l.s $f19, 7*FFI_SIZEOF_ARG(t9)
|
209
|
+
b arg8_next
|
210
|
+
arg8_doublep:
|
211
|
+
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
|
212
|
+
arg8_next:
|
213
|
+
#endif
|
214
|
+
|
215
|
+
callit:
|
216
|
+
# Load the function pointer
|
217
|
+
REG_L t9, 5*FFI_SIZEOF_ARG($fp)
|
218
|
+
|
219
|
+
# install the static chain(t7=$15)
|
220
|
+
REG_L t7, 6*FFI_SIZEOF_ARG($fp)
|
221
|
+
|
222
|
+
# If the return value pointer is NULL, assume no return value.
|
223
|
+
REG_L t5, 4*FFI_SIZEOF_ARG($fp)
|
224
|
+
beqz t5, noretval
|
225
|
+
|
226
|
+
# Shift the return type flag over
|
227
|
+
SRL t6, 8*FFI_FLAG_BITS
|
228
|
+
|
229
|
+
beq t6, FFI_TYPE_SINT32, retint
|
230
|
+
bne t6, FFI_TYPE_INT, retfloat
|
231
|
+
retint:
|
232
|
+
jal t9
|
233
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
234
|
+
REG_S v0, 0(t4)
|
235
|
+
b epilogue
|
236
|
+
|
237
|
+
retfloat:
|
238
|
+
#ifndef __mips_soft_float
|
239
|
+
bne t6, FFI_TYPE_FLOAT, retdouble
|
240
|
+
jal t9
|
241
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
242
|
+
s.s $f0, 0(t4)
|
243
|
+
b epilogue
|
244
|
+
|
245
|
+
retdouble:
|
246
|
+
bne t6, FFI_TYPE_DOUBLE, retstruct_d
|
247
|
+
jal t9
|
248
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
249
|
+
s.d $f0, 0(t4)
|
250
|
+
b epilogue
|
251
|
+
|
252
|
+
retstruct_d:
|
253
|
+
bne t6, FFI_TYPE_STRUCT_D, retstruct_f
|
254
|
+
jal t9
|
255
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
256
|
+
s.d $f0, 0(t4)
|
257
|
+
b epilogue
|
258
|
+
|
259
|
+
retstruct_f:
|
260
|
+
bne t6, FFI_TYPE_STRUCT_F, retstruct_d_d
|
261
|
+
jal t9
|
262
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
263
|
+
s.s $f0, 0(t4)
|
264
|
+
b epilogue
|
265
|
+
|
266
|
+
retstruct_d_d:
|
267
|
+
bne t6, FFI_TYPE_STRUCT_DD, retstruct_f_f
|
268
|
+
jal t9
|
269
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
270
|
+
s.d $f0, 0(t4)
|
271
|
+
s.d $f2, 8(t4)
|
272
|
+
b epilogue
|
273
|
+
|
274
|
+
retstruct_f_f:
|
275
|
+
bne t6, FFI_TYPE_STRUCT_FF, retstruct_d_f
|
276
|
+
jal t9
|
277
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
278
|
+
s.s $f0, 0(t4)
|
279
|
+
s.s $f2, 4(t4)
|
280
|
+
b epilogue
|
281
|
+
|
282
|
+
retstruct_d_f:
|
283
|
+
bne t6, FFI_TYPE_STRUCT_DF, retstruct_f_d
|
284
|
+
jal t9
|
285
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
286
|
+
s.d $f0, 0(t4)
|
287
|
+
s.s $f2, 8(t4)
|
288
|
+
b epilogue
|
289
|
+
|
290
|
+
retstruct_f_d:
|
291
|
+
bne t6, FFI_TYPE_STRUCT_FD, retstruct_d_soft
|
292
|
+
jal t9
|
293
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
294
|
+
s.s $f0, 0(t4)
|
295
|
+
s.d $f2, 8(t4)
|
296
|
+
b epilogue
|
297
|
+
#endif
|
298
|
+
|
299
|
+
retstruct_d_soft:
|
300
|
+
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
|
301
|
+
jal t9
|
302
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
303
|
+
sd v0, 0(t4)
|
304
|
+
b epilogue
|
305
|
+
|
306
|
+
retstruct_f_soft:
|
307
|
+
bne t6, FFI_TYPE_STRUCT_F_SOFT, retstruct_d_d_soft
|
308
|
+
jal t9
|
309
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
310
|
+
sw v0, 0(t4)
|
311
|
+
b epilogue
|
312
|
+
|
313
|
+
retstruct_d_d_soft:
|
314
|
+
bne t6, FFI_TYPE_STRUCT_DD_SOFT, retstruct_f_f_soft
|
315
|
+
jal t9
|
316
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
317
|
+
sd v0, 0(t4)
|
318
|
+
sd v1, 8(t4)
|
319
|
+
b epilogue
|
320
|
+
|
321
|
+
retstruct_f_f_soft:
|
322
|
+
bne t6, FFI_TYPE_STRUCT_FF_SOFT, retstruct_d_f_soft
|
323
|
+
jal t9
|
324
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
325
|
+
sw v0, 0(t4)
|
326
|
+
sw v1, 4(t4)
|
327
|
+
b epilogue
|
328
|
+
|
329
|
+
retstruct_d_f_soft:
|
330
|
+
bne t6, FFI_TYPE_STRUCT_DF_SOFT, retstruct_f_d_soft
|
331
|
+
jal t9
|
332
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
333
|
+
sd v0, 0(t4)
|
334
|
+
sw v1, 8(t4)
|
335
|
+
b epilogue
|
336
|
+
|
337
|
+
retstruct_f_d_soft:
|
338
|
+
bne t6, FFI_TYPE_STRUCT_FD_SOFT, retstruct_small
|
339
|
+
jal t9
|
340
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
341
|
+
sw v0, 0(t4)
|
342
|
+
sd v1, 8(t4)
|
343
|
+
b epilogue
|
344
|
+
|
345
|
+
retstruct_small:
|
346
|
+
bne t6, FFI_TYPE_STRUCT_SMALL, retstruct_small2
|
347
|
+
jal t9
|
348
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
349
|
+
REG_S v0, 0(t4)
|
350
|
+
b epilogue
|
351
|
+
|
352
|
+
retstruct_small2:
|
353
|
+
bne t6, FFI_TYPE_STRUCT_SMALL2, retstruct
|
354
|
+
jal t9
|
355
|
+
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
|
356
|
+
REG_S v0, 0(t4)
|
357
|
+
REG_S v1, 8(t4)
|
358
|
+
b epilogue
|
359
|
+
|
360
|
+
retstruct:
|
361
|
+
noretval:
|
362
|
+
jal t9
|
363
|
+
|
364
|
+
# Epilogue
|
365
|
+
epilogue:
|
366
|
+
move $sp, $fp
|
367
|
+
REG_L $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer
|
368
|
+
REG_L ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Restore return address
|
369
|
+
ADDU $sp, SIZEOF_FRAME # Fix stack pointer
|
370
|
+
j ra
|
371
|
+
|
372
|
+
.LFE0:
|
373
|
+
.end ffi_call_N32
|
374
|
+
|
375
|
+
/* ffi_closure_N32. Expects address of the passed-in ffi_closure in t0
|
376
|
+
($12). Stores any arguments passed in registers onto the stack,
|
377
|
+
then calls ffi_closure_mips_inner_N32, which then decodes
|
378
|
+
them.
|
379
|
+
|
380
|
+
Stack layout:
|
381
|
+
|
382
|
+
20 - Start of parameters, original sp
|
383
|
+
19 - Called function a7 save
|
384
|
+
18 - Called function a6 save
|
385
|
+
17 - Called function a5 save
|
386
|
+
16 - Called function a4 save
|
387
|
+
15 - Called function a3 save
|
388
|
+
14 - Called function a2 save
|
389
|
+
13 - Called function a1 save
|
390
|
+
12 - Called function a0 save
|
391
|
+
11 - Called function f19
|
392
|
+
10 - Called function f18
|
393
|
+
9 - Called function f17
|
394
|
+
8 - Called function f16
|
395
|
+
7 - Called function f15
|
396
|
+
6 - Called function f14
|
397
|
+
5 - Called function f13
|
398
|
+
4 - Called function f12
|
399
|
+
3 - return value high (v1 or $f2)
|
400
|
+
2 - return value low (v0 or $f0)
|
401
|
+
1 - ra save
|
402
|
+
0 - gp save our sp points here
|
403
|
+
*/
|
404
|
+
|
405
|
+
#define SIZEOF_FRAME2 (20 * FFI_SIZEOF_ARG)
|
406
|
+
|
407
|
+
#define A7_OFF2 (19 * FFI_SIZEOF_ARG)
|
408
|
+
#define A6_OFF2 (18 * FFI_SIZEOF_ARG)
|
409
|
+
#define A5_OFF2 (17 * FFI_SIZEOF_ARG)
|
410
|
+
#define A4_OFF2 (16 * FFI_SIZEOF_ARG)
|
411
|
+
#define A3_OFF2 (15 * FFI_SIZEOF_ARG)
|
412
|
+
#define A2_OFF2 (14 * FFI_SIZEOF_ARG)
|
413
|
+
#define A1_OFF2 (13 * FFI_SIZEOF_ARG)
|
414
|
+
#define A0_OFF2 (12 * FFI_SIZEOF_ARG)
|
415
|
+
|
416
|
+
#define F19_OFF2 (11 * FFI_SIZEOF_ARG)
|
417
|
+
#define F18_OFF2 (10 * FFI_SIZEOF_ARG)
|
418
|
+
#define F17_OFF2 (9 * FFI_SIZEOF_ARG)
|
419
|
+
#define F16_OFF2 (8 * FFI_SIZEOF_ARG)
|
420
|
+
#define F15_OFF2 (7 * FFI_SIZEOF_ARG)
|
421
|
+
#define F14_OFF2 (6 * FFI_SIZEOF_ARG)
|
422
|
+
#define F13_OFF2 (5 * FFI_SIZEOF_ARG)
|
423
|
+
#define F12_OFF2 (4 * FFI_SIZEOF_ARG)
|
424
|
+
|
425
|
+
#define V1_OFF2 (3 * FFI_SIZEOF_ARG)
|
426
|
+
#define V0_OFF2 (2 * FFI_SIZEOF_ARG)
|
427
|
+
|
428
|
+
#define RA_OFF2 (1 * FFI_SIZEOF_ARG)
|
429
|
+
#define GP_OFF2 (0 * FFI_SIZEOF_ARG)
|
430
|
+
|
431
|
+
.align 2
|
432
|
+
.globl ffi_go_closure_N32
|
433
|
+
.ent ffi_go_closure_N32
|
434
|
+
ffi_go_closure_N32:
|
435
|
+
.LFB1:
|
436
|
+
.frame $sp, SIZEOF_FRAME2, ra
|
437
|
+
.mask 0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
|
438
|
+
.fmask 0x00000000,0
|
439
|
+
SUBU $sp, SIZEOF_FRAME2
|
440
|
+
.LCFI10:
|
441
|
+
.cpsetup t9, GP_OFF2, ffi_go_closure_N32
|
442
|
+
REG_S ra, RA_OFF2($sp) # Save return address
|
443
|
+
.LCFI11:
|
444
|
+
|
445
|
+
REG_S a0, A0_OFF2($sp)
|
446
|
+
REG_S a1, A1_OFF2($sp)
|
447
|
+
REG_S a2, A2_OFF2($sp)
|
448
|
+
REG_S a3, A3_OFF2($sp)
|
449
|
+
REG_S a4, A4_OFF2($sp)
|
450
|
+
REG_S a5, A5_OFF2($sp)
|
451
|
+
|
452
|
+
# Call ffi_closure_mips_inner_N32 to do the real work.
|
453
|
+
LA t9, ffi_closure_mips_inner_N32
|
454
|
+
REG_L a0, 8($15) # cif
|
455
|
+
REG_L a1, 16($15) # fun
|
456
|
+
move a2, t7 # userdata=closure
|
457
|
+
ADDU a3, $sp, V0_OFF2 # rvalue
|
458
|
+
ADDU a4, $sp, A0_OFF2 # ar
|
459
|
+
ADDU a5, $sp, F12_OFF2 # fpr
|
460
|
+
|
461
|
+
b $do_closure
|
462
|
+
|
463
|
+
.LFE1:
|
464
|
+
.end ffi_go_closure_N32
|
465
|
+
|
466
|
+
.align 2
|
467
|
+
.globl ffi_closure_N32
|
468
|
+
.ent ffi_closure_N32
|
469
|
+
ffi_closure_N32:
|
470
|
+
.LFB2:
|
471
|
+
.frame $sp, SIZEOF_FRAME2, ra
|
472
|
+
.mask 0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
|
473
|
+
.fmask 0x00000000,0
|
474
|
+
SUBU $sp, SIZEOF_FRAME2
|
475
|
+
.LCFI20:
|
476
|
+
.cpsetup t9, GP_OFF2, ffi_closure_N32
|
477
|
+
REG_S ra, RA_OFF2($sp) # Save return address
|
478
|
+
.LCFI21:
|
479
|
+
REG_S a0, A0_OFF2($sp)
|
480
|
+
REG_S a1, A1_OFF2($sp)
|
481
|
+
REG_S a2, A2_OFF2($sp)
|
482
|
+
REG_S a3, A3_OFF2($sp)
|
483
|
+
REG_S a4, A4_OFF2($sp)
|
484
|
+
REG_S a5, A5_OFF2($sp)
|
485
|
+
|
486
|
+
# Call ffi_closure_mips_inner_N32 to do the real work.
|
487
|
+
LA t9, ffi_closure_mips_inner_N32
|
488
|
+
REG_L a0, 56($12) # cif
|
489
|
+
REG_L a1, 64($12) # fun
|
490
|
+
REG_L a2, 72($12) # user_data
|
491
|
+
ADDU a3, $sp, V0_OFF2
|
492
|
+
ADDU a4, $sp, A0_OFF2
|
493
|
+
ADDU a5, $sp, F12_OFF2
|
494
|
+
|
495
|
+
$do_closure:
|
496
|
+
# Store all possible argument registers. If there are more than
|
497
|
+
# fit in registers, then they were stored on the stack.
|
498
|
+
REG_S a6, A6_OFF2($sp)
|
499
|
+
REG_S a7, A7_OFF2($sp)
|
500
|
+
|
501
|
+
#ifndef __mips_soft_float
|
502
|
+
# Store all possible float/double registers.
|
503
|
+
s.d $f12, F12_OFF2($sp)
|
504
|
+
s.d $f13, F13_OFF2($sp)
|
505
|
+
s.d $f14, F14_OFF2($sp)
|
506
|
+
s.d $f15, F15_OFF2($sp)
|
507
|
+
s.d $f16, F16_OFF2($sp)
|
508
|
+
s.d $f17, F17_OFF2($sp)
|
509
|
+
s.d $f18, F18_OFF2($sp)
|
510
|
+
s.d $f19, F19_OFF2($sp)
|
511
|
+
#endif
|
512
|
+
|
513
|
+
jalr t9
|
514
|
+
|
515
|
+
# Return flags are in v0
|
516
|
+
bne v0, FFI_TYPE_SINT32, cls_retint
|
517
|
+
lw v0, V0_OFF2($sp)
|
518
|
+
b cls_epilogue
|
519
|
+
|
520
|
+
cls_retint:
|
521
|
+
bne v0, FFI_TYPE_INT, cls_retfloat
|
522
|
+
REG_L v0, V0_OFF2($sp)
|
523
|
+
b cls_epilogue
|
524
|
+
|
525
|
+
cls_retfloat:
|
526
|
+
#ifndef __mips_soft_float
|
527
|
+
bne v0, FFI_TYPE_FLOAT, cls_retdouble
|
528
|
+
l.s $f0, V0_OFF2($sp)
|
529
|
+
b cls_epilogue
|
530
|
+
|
531
|
+
cls_retdouble:
|
532
|
+
bne v0, FFI_TYPE_DOUBLE, cls_retstruct_d
|
533
|
+
l.d $f0, V0_OFF2($sp)
|
534
|
+
b cls_epilogue
|
535
|
+
|
536
|
+
cls_retstruct_d:
|
537
|
+
bne v0, FFI_TYPE_STRUCT_D, cls_retstruct_f
|
538
|
+
l.d $f0, V0_OFF2($sp)
|
539
|
+
b cls_epilogue
|
540
|
+
|
541
|
+
cls_retstruct_f:
|
542
|
+
bne v0, FFI_TYPE_STRUCT_F, cls_retstruct_d_d
|
543
|
+
l.s $f0, V0_OFF2($sp)
|
544
|
+
b cls_epilogue
|
545
|
+
|
546
|
+
cls_retstruct_d_d:
|
547
|
+
bne v0, FFI_TYPE_STRUCT_DD, cls_retstruct_f_f
|
548
|
+
l.d $f0, V0_OFF2($sp)
|
549
|
+
l.d $f2, V1_OFF2($sp)
|
550
|
+
b cls_epilogue
|
551
|
+
|
552
|
+
cls_retstruct_f_f:
|
553
|
+
bne v0, FFI_TYPE_STRUCT_FF, cls_retstruct_d_f
|
554
|
+
l.s $f0, V0_OFF2($sp)
|
555
|
+
l.s $f2, V1_OFF2($sp)
|
556
|
+
b cls_epilogue
|
557
|
+
|
558
|
+
cls_retstruct_d_f:
|
559
|
+
bne v0, FFI_TYPE_STRUCT_DF, cls_retstruct_f_d
|
560
|
+
l.d $f0, V0_OFF2($sp)
|
561
|
+
l.s $f2, V1_OFF2($sp)
|
562
|
+
b cls_epilogue
|
563
|
+
|
564
|
+
cls_retstruct_f_d:
|
565
|
+
bne v0, FFI_TYPE_STRUCT_FD, cls_retstruct_small2
|
566
|
+
l.s $f0, V0_OFF2($sp)
|
567
|
+
l.d $f2, V1_OFF2($sp)
|
568
|
+
b cls_epilogue
|
569
|
+
#endif
|
570
|
+
|
571
|
+
cls_retstruct_small2:
|
572
|
+
REG_L v0, V0_OFF2($sp)
|
573
|
+
REG_L v1, V1_OFF2($sp)
|
574
|
+
|
575
|
+
# Epilogue
|
576
|
+
cls_epilogue:
|
577
|
+
REG_L ra, RA_OFF2($sp) # Restore return address
|
578
|
+
.cpreturn
|
579
|
+
ADDU $sp, SIZEOF_FRAME2
|
580
|
+
j ra
|
581
|
+
.LFE2:
|
582
|
+
.end ffi_closure_N32
|
583
|
+
|
584
|
+
#ifdef __GNUC__
|
585
|
+
.section .eh_frame,"aw",@progbits
|
586
|
+
.Lframe1:
|
587
|
+
.4byte .LECIE1-.LSCIE1 # length
|
588
|
+
.LSCIE1:
|
589
|
+
.4byte 0x0 # CIE
|
590
|
+
.byte 0x1 # Version 1
|
591
|
+
.ascii "\000" # Augmentation
|
592
|
+
.uleb128 0x1 # Code alignment 1
|
593
|
+
.sleb128 -4 # Data alignment -4
|
594
|
+
.byte 0x1f # Return Address $31
|
595
|
+
.byte 0xc # DW_CFA_def_cfa
|
596
|
+
.uleb128 0x1d # in $sp
|
597
|
+
.uleb128 0x0 # offset 0
|
598
|
+
.align EH_FRAME_ALIGN
|
599
|
+
.LECIE1:
|
600
|
+
|
601
|
+
.LSFDE0:
|
602
|
+
.4byte .LEFDE0-.LASFDE0 # length.
|
603
|
+
.LASFDE0:
|
604
|
+
.4byte .LASFDE0-.Lframe1 # CIE_pointer.
|
605
|
+
FDE_ADDR_BYTES .LFB0 # initial_location.
|
606
|
+
FDE_ADDR_BYTES .LFE0-.LFB0 # address_range.
|
607
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
608
|
+
.4byte .LCFI00-.LFB0 # to .LCFI00
|
609
|
+
.byte 0xe # DW_CFA_def_cfa_offset
|
610
|
+
.uleb128 SIZEOF_FRAME # adjust stack.by SIZEOF_FRAME
|
611
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
612
|
+
.4byte .LCFI01-.LCFI00 # to .LCFI01
|
613
|
+
.byte 0x9e # DW_CFA_offset of $fp
|
614
|
+
.uleb128 2*FFI_SIZEOF_ARG/4 #
|
615
|
+
.byte 0x9f # DW_CFA_offset of ra
|
616
|
+
.uleb128 1*FFI_SIZEOF_ARG/4 #
|
617
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
618
|
+
.4byte .LCFI02-.LCFI01 # to .LCFI02
|
619
|
+
.byte 0xd # DW_CFA_def_cfa_register
|
620
|
+
.uleb128 0x1e # in $fp
|
621
|
+
.align EH_FRAME_ALIGN
|
622
|
+
.LEFDE0:
|
623
|
+
|
624
|
+
.LSFDE1:
|
625
|
+
.4byte .LEFDE1-.LASFDE1 # length
|
626
|
+
.LASFDE1:
|
627
|
+
.4byte .LASFDE1-.Lframe1 # CIE_pointer.
|
628
|
+
FDE_ADDR_BYTES .LFB1 # initial_location.
|
629
|
+
FDE_ADDR_BYTES .LFE1-.LFB1 # address_range.
|
630
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
631
|
+
.4byte .LCFI10-.LFB1 # to .LCFI10
|
632
|
+
.byte 0xe # DW_CFA_def_cfa_offset
|
633
|
+
.uleb128 SIZEOF_FRAME2 # adjust stack.by SIZEOF_FRAME
|
634
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
635
|
+
.4byte .LCFI11-.LCFI10 # to .LCFI11
|
636
|
+
.byte 0x9c # DW_CFA_offset of $gp ($28)
|
637
|
+
.uleb128 (SIZEOF_FRAME2 - GP_OFF2)/4
|
638
|
+
.byte 0x9f # DW_CFA_offset of ra ($31)
|
639
|
+
.uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
|
640
|
+
.align EH_FRAME_ALIGN
|
641
|
+
.LEFDE1:
|
642
|
+
|
643
|
+
.LSFDE2:
|
644
|
+
.4byte .LEFDE2-.LASFDE2 # length
|
645
|
+
.LASFDE2:
|
646
|
+
.4byte .LASFDE2-.Lframe1 # CIE_pointer.
|
647
|
+
FDE_ADDR_BYTES .LFB2 # initial_location.
|
648
|
+
FDE_ADDR_BYTES .LFE2-.LFB2 # address_range.
|
649
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
650
|
+
.4byte .LCFI20-.LFB2 # to .LCFI20
|
651
|
+
.byte 0xe # DW_CFA_def_cfa_offset
|
652
|
+
.uleb128 SIZEOF_FRAME2 # adjust stack.by SIZEOF_FRAME
|
653
|
+
.byte 0x4 # DW_CFA_advance_loc4
|
654
|
+
.4byte .LCFI21-.LCFI20 # to .LCFI21
|
655
|
+
.byte 0x9c # DW_CFA_offset of $gp ($28)
|
656
|
+
.uleb128 (SIZEOF_FRAME2 - GP_OFF2)/4
|
657
|
+
.byte 0x9f # DW_CFA_offset of ra ($31)
|
658
|
+
.uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
|
659
|
+
.align EH_FRAME_ALIGN
|
660
|
+
.LEFDE2:
|
661
|
+
#endif /* __GNUC__ */
|
662
|
+
|
663
|
+
#endif
|