ffi 1.9.3-x64-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.
- data/COPYING +49 -0
- data/LICENSE +24 -0
- data/README.md +109 -0
- data/Rakefile +220 -0
- data/ext/ffi_c/AbstractMemory.c +1032 -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 +465 -0
- data/ext/ffi_c/Call.h +93 -0
- data/ext/ffi_c/ClosurePool.c +283 -0
- data/ext/ffi_c/ClosurePool.h +57 -0
- data/ext/ffi_c/DataConverter.c +91 -0
- data/ext/ffi_c/DynamicLibrary.c +333 -0
- data/ext/ffi_c/DynamicLibrary.h +49 -0
- data/ext/ffi_c/Function.c +999 -0
- data/ext/ffi_c/Function.h +87 -0
- data/ext/ffi_c/FunctionInfo.c +271 -0
- data/ext/ffi_c/LastError.c +184 -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 +360 -0
- data/ext/ffi_c/MethodHandle.h +55 -0
- data/ext/ffi_c/Platform.c +121 -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 +828 -0
- data/ext/ffi_c/Struct.h +106 -0
- data/ext/ffi_c/StructByReference.c +190 -0
- data/ext/ffi_c/StructByReference.h +50 -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 +352 -0
- data/ext/ffi_c/Thread.h +95 -0
- data/ext/ffi_c/Type.c +397 -0
- data/ext/ffi_c/Type.h +62 -0
- data/ext/ffi_c/Types.c +139 -0
- data/ext/ffi_c/Types.h +89 -0
- data/ext/ffi_c/Variadic.c +276 -0
- data/ext/ffi_c/compat.h +83 -0
- data/ext/ffi_c/extconf.rb +64 -0
- data/ext/ffi_c/ffi.c +98 -0
- data/ext/ffi_c/libffi.bsd.mk +34 -0
- data/ext/ffi_c/libffi.darwin.mk +95 -0
- data/ext/ffi_c/libffi.gnu.mk +31 -0
- data/ext/ffi_c/libffi.mk +13 -0
- data/ext/ffi_c/libffi.vc.mk +26 -0
- data/ext/ffi_c/libffi.vc64.mk +26 -0
- data/ext/ffi_c/libffi/ChangeLog +4600 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi +584 -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/Makefile.am +196 -0
- data/ext/ffi_c/libffi/Makefile.in +1820 -0
- data/ext/ffi_c/libffi/Makefile.vc +141 -0
- data/ext/ffi_c/libffi/Makefile.vc64 +141 -0
- data/ext/ffi_c/libffi/README +342 -0
- data/ext/ffi_c/libffi/acinclude.m4 +92 -0
- data/ext/ffi_c/libffi/aclocal.m4 +1873 -0
- data/ext/ffi_c/libffi/build-ios.sh +67 -0
- data/ext/ffi_c/libffi/compile +143 -0
- data/ext/ffi_c/libffi/config.guess +1501 -0
- data/ext/ffi_c/libffi/config.sub +1705 -0
- data/ext/ffi_c/libffi/configure +17191 -0
- data/ext/ffi_c/libffi/configure.ac +496 -0
- data/ext/ffi_c/libffi/configure.host +11 -0
- data/ext/ffi_c/libffi/depcomp +630 -0
- data/ext/ffi_c/libffi/doc/libffi.info +593 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +600 -0
- data/ext/ffi_c/libffi/doc/stamp-vti +4 -0
- data/ext/ffi_c/libffi/doc/version.texi +4 -0
- data/ext/ffi_c/libffi/fficonfig.h.in +199 -0
- data/ext/ffi_c/libffi/fficonfig.hw +57 -0
- data/ext/ffi_c/libffi/include/Makefile.am +9 -0
- data/ext/ffi_c/libffi/include/Makefile.in +487 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +427 -0
- data/ext/ffi_c/libffi/include/ffi.h.vc +427 -0
- data/ext/ffi_c/libffi/include/ffi.h.vc64 +427 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +126 -0
- data/ext/ffi_c/libffi/install-sh +520 -0
- data/ext/ffi_c/libffi/libffi.pc.in +10 -0
- data/ext/ffi_c/libffi/libtool-version +29 -0
- data/ext/ffi_c/libffi/ltmain.sh +9636 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +176 -0
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +195 -0
- data/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 +76 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +63 -0
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +70 -0
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +300 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +215 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +79 -0
- data/ext/ffi_c/libffi/m4/libtool.m4 +7831 -0
- data/ext/ffi_c/libffi/m4/ltoptions.m4 +369 -0
- data/ext/ffi_c/libffi/m4/ltsugar.m4 +123 -0
- data/ext/ffi_c/libffi/m4/ltversion.m4 +23 -0
- data/ext/ffi_c/libffi/m4/lt~obsolete.m4 +98 -0
- data/ext/ffi_c/libffi/man/Makefile.am +8 -0
- data/ext/ffi_c/libffi/man/Makefile.in +466 -0
- data/ext/ffi_c/libffi/man/ffi.3 +31 -0
- data/ext/ffi_c/libffi/man/ffi_call.3 +103 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +66 -0
- data/ext/ffi_c/libffi/mdate-sh +201 -0
- data/ext/ffi_c/libffi/missing +376 -0
- data/ext/ffi_c/libffi/msvcc.sh +197 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +284 -0
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +48 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +387 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +728 -0
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/arm/gentramp.sh +118 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +497 -0
- data/ext/ffi_c/libffi/src/arm/trampoline.S +4450 -0
- data/ext/ffi_c/libffi/src/avr32/ffi.c +423 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +50 -0
- data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
- data/ext/ffi_c/libffi/src/closures.c +615 -0
- data/ext/ffi_c/libffi/src/cris/ffi.c +383 -0
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +51 -0
- data/ext/ffi_c/libffi/src/cris/sysv.S +215 -0
- data/ext/ffi_c/libffi/src/debug.c +59 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +5161 -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 +57 -0
- data/ext/ffi_c/libffi/src/ia64/ffi.c +582 -0
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +50 -0
- data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +40 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +560 -0
- data/ext/ffi_c/libffi/src/java_raw_api.c +356 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +232 -0
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +48 -0
- data/ext/ffi_c/libffi/src/m32r/sysv.S +121 -0
- data/ext/ffi_c/libffi/src/m68k/ffi.c +288 -0
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m68k/sysv.S +270 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +1036 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +242 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +591 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +381 -0
- data/ext/ffi_c/libffi/src/moxie/eabi.S +128 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +719 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +78 -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 +328 -0
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +445 -0
- data/ext/ffi_c/libffi/src/powerpc/asm.h +125 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +383 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +575 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +1448 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +1359 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +139 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +187 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +236 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +327 -0
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +219 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +177 -0
- data/ext/ffi_c/libffi/src/raw_api.c +254 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +780 -0
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +434 -0
- data/ext/ffi_c/libffi/src/sh/ffi.c +716 -0
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/sh/sysv.S +850 -0
- data/ext/ffi_c/libffi/src/sh64/ffi.c +468 -0
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/sh64/sysv.S +539 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +669 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +68 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +313 -0
- data/ext/ffi_c/libffi/src/sparc/v9.S +307 -0
- data/ext/ffi_c/libffi/src/types.c +77 -0
- data/ext/ffi_c/libffi/src/x86/darwin.S +444 -0
- data/ext/ffi_c/libffi/src/x86/darwin64.S +416 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +644 -0
- data/ext/ffi_c/libffi/src/x86/ffi64.c +635 -0
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +121 -0
- data/ext/ffi_c/libffi/src/x86/freebsd.S +458 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +468 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +426 -0
- data/ext/ffi_c/libffi/src/x86/win32.S +1065 -0
- data/ext/ffi_c/libffi/src/x86/win64.S +468 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +80 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.in +500 -0
- data/ext/ffi_c/libffi/testsuite/config/default.exp +1 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp +300 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +350 -0
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +263 -0
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +32 -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_stdcall.c +64 -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_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 +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +117 -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 +60 -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 +60 -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 +140 -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_uchar.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +43 -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/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 +153 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +72 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +62 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +342 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +69 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +53 -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 +133 -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/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 +35 -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/strlen_win32.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +65 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +63 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +65 -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 +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h +96 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/special.exp +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +53 -0
- data/ext/ffi_c/libffi/texinfo.tex +7210 -0
- data/ext/ffi_c/rbffi.h +57 -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 +22 -0
- data/gen/Rakefile +30 -0
- data/lib/ffi.rb +28 -0
- data/lib/ffi/autopointer.rb +194 -0
- data/lib/ffi/buffer.rb +4 -0
- data/lib/ffi/callback.rb +4 -0
- data/lib/ffi/enum.rb +173 -0
- data/lib/ffi/errno.rb +43 -0
- data/lib/ffi/ffi.rb +44 -0
- data/lib/ffi/io.rb +62 -0
- data/lib/ffi/library.rb +499 -0
- data/lib/ffi/managedstruct.rb +84 -0
- data/lib/ffi/memorypointer.rb +1 -0
- data/lib/ffi/platform.rb +148 -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-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/mipsel-linux/types.conf +102 -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/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/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 +100 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +126 -0
- data/lib/ffi/platform/x86_64-openbsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +27 -0
- data/lib/ffi/pointer.rb +134 -0
- data/lib/ffi/struct.rb +367 -0
- data/lib/ffi/struct_layout_builder.rb +222 -0
- data/lib/ffi/tools/const_generator.rb +229 -0
- data/lib/ffi/tools/generator.rb +60 -0
- data/lib/ffi/tools/generator_task.rb +36 -0
- data/lib/ffi/tools/struct_generator.rb +194 -0
- data/lib/ffi/tools/types_generator.rb +135 -0
- data/lib/ffi/types.rb +190 -0
- data/lib/ffi/union.rb +43 -0
- data/lib/ffi/variadic.rb +78 -0
- data/lib/ffi/version.rb +4 -0
- data/lib/ffi_c.so +0 -0
- data/libtest/Benchmark.c +52 -0
- data/libtest/BoolTest.c +34 -0
- data/libtest/BufferTest.c +31 -0
- data/libtest/ClosureTest.c +190 -0
- data/libtest/EnumTest.c +34 -0
- data/libtest/FunctionTest.c +58 -0
- data/libtest/GNUmakefile +149 -0
- data/libtest/GlobalVariable.c +62 -0
- data/libtest/LastErrorTest.c +21 -0
- data/libtest/NumberTest.c +132 -0
- data/libtest/PointerTest.c +63 -0
- data/libtest/ReferenceTest.c +23 -0
- data/libtest/StringTest.c +34 -0
- data/libtest/StructTest.c +243 -0
- data/libtest/UnionTest.c +43 -0
- data/libtest/VariadicTest.c +62 -0
- data/spec/ffi/async_callback_spec.rb +35 -0
- data/spec/ffi/bool_spec.rb +29 -0
- data/spec/ffi/buffer_spec.rb +251 -0
- data/spec/ffi/callback_spec.rb +667 -0
- data/spec/ffi/custom_param_type.rb +36 -0
- data/spec/ffi/custom_type_spec.rb +74 -0
- data/spec/ffi/dup_spec.rb +54 -0
- data/spec/ffi/enum_spec.rb +220 -0
- data/spec/ffi/errno_spec.rb +18 -0
- data/spec/ffi/ffi_spec.rb +29 -0
- data/spec/ffi/function_spec.rb +76 -0
- data/spec/ffi/library_spec.rb +216 -0
- data/spec/ffi/long_double.rb +30 -0
- data/spec/ffi/managed_struct_spec.rb +57 -0
- data/spec/ffi/number_spec.rb +236 -0
- data/spec/ffi/pointer_spec.rb +265 -0
- data/spec/ffi/rbx/attach_function_spec.rb +28 -0
- data/spec/ffi/rbx/memory_pointer_spec.rb +123 -0
- data/spec/ffi/rbx/spec_helper.rb +1 -0
- data/spec/ffi/rbx/struct_spec.rb +13 -0
- data/spec/ffi/spec_helper.rb +33 -0
- data/spec/ffi/string_spec.rb +108 -0
- data/spec/ffi/strptr_spec.rb +50 -0
- data/spec/ffi/struct_by_ref_spec.rb +43 -0
- data/spec/ffi/struct_callback_spec.rb +69 -0
- data/spec/ffi/struct_initialize_spec.rb +35 -0
- data/spec/ffi/struct_packed_spec.rb +51 -0
- data/spec/ffi/struct_spec.rb +748 -0
- data/spec/ffi/typedef_spec.rb +78 -0
- data/spec/ffi/union_spec.rb +65 -0
- data/spec/ffi/variadic_spec.rb +92 -0
- data/spec/spec.opts +4 -0
- metadata +562 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
eabi.S - Copyright (c) 2004 Anthony Green
|
3
|
+
|
4
|
+
FR-V Assembly glue.
|
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, EXPRESS
|
18
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
21
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
----------------------------------------------------------------------- */
|
25
|
+
|
26
|
+
#define LIBFFI_ASM
|
27
|
+
#include <fficonfig.h>
|
28
|
+
#include <ffi.h>
|
29
|
+
|
30
|
+
.globl ffi_prep_args_EABI
|
31
|
+
|
32
|
+
.text
|
33
|
+
.p2align 4
|
34
|
+
.globl ffi_call_EABI
|
35
|
+
.type ffi_call_EABI, @function
|
36
|
+
|
37
|
+
# gr8 : ffi_prep_args
|
38
|
+
# gr9 : &ecif
|
39
|
+
# gr10: cif->bytes
|
40
|
+
# gr11: fig->flags
|
41
|
+
# gr12: ecif.rvalue
|
42
|
+
# gr13: fn
|
43
|
+
|
44
|
+
ffi_call_EABI:
|
45
|
+
addi sp, #-80, sp
|
46
|
+
sti fp, @(sp, #24)
|
47
|
+
addi sp, #24, fp
|
48
|
+
movsg lr, gr5
|
49
|
+
|
50
|
+
/* Make room for the new arguments. */
|
51
|
+
/* subi sp, fp, gr10 */
|
52
|
+
|
53
|
+
/* Store return address and incoming args on stack. */
|
54
|
+
sti gr5, @(fp, #8)
|
55
|
+
sti gr8, @(fp, #-4)
|
56
|
+
sti gr9, @(fp, #-8)
|
57
|
+
sti gr10, @(fp, #-12)
|
58
|
+
sti gr11, @(fp, #-16)
|
59
|
+
sti gr12, @(fp, #-20)
|
60
|
+
sti gr13, @(fp, #-24)
|
61
|
+
|
62
|
+
sub sp, gr10, sp
|
63
|
+
|
64
|
+
/* Call ffi_prep_args. */
|
65
|
+
ldi @(fp, #-4), gr4
|
66
|
+
addi sp, #0, gr8
|
67
|
+
ldi @(fp, #-8), gr9
|
68
|
+
#ifdef __FRV_FDPIC__
|
69
|
+
ldd @(gr4, gr0), gr14
|
70
|
+
calll @(gr14, gr0)
|
71
|
+
#else
|
72
|
+
calll @(gr4, gr0)
|
73
|
+
#endif
|
74
|
+
|
75
|
+
/* ffi_prep_args returns the new stack pointer. */
|
76
|
+
mov gr8, gr4
|
77
|
+
|
78
|
+
ldi @(sp, #0), gr8
|
79
|
+
ldi @(sp, #4), gr9
|
80
|
+
ldi @(sp, #8), gr10
|
81
|
+
ldi @(sp, #12), gr11
|
82
|
+
ldi @(sp, #16), gr12
|
83
|
+
ldi @(sp, #20), gr13
|
84
|
+
|
85
|
+
/* Always copy the return value pointer into the hidden
|
86
|
+
parameter register. This is only strictly necessary
|
87
|
+
when we're returning an aggregate type, but it doesn't
|
88
|
+
hurt to do this all the time, and it saves a branch. */
|
89
|
+
ldi @(fp, #-20), gr3
|
90
|
+
|
91
|
+
/* Use the ffi_prep_args return value for the new sp. */
|
92
|
+
mov gr4, sp
|
93
|
+
|
94
|
+
/* Call the target function. */
|
95
|
+
ldi @(fp, -24), gr4
|
96
|
+
#ifdef __FRV_FDPIC__
|
97
|
+
ldd @(gr4, gr0), gr14
|
98
|
+
calll @(gr14, gr0)
|
99
|
+
#else
|
100
|
+
calll @(gr4, gr0)
|
101
|
+
#endif
|
102
|
+
|
103
|
+
/* Store the result. */
|
104
|
+
ldi @(fp, #-16), gr10 /* fig->flags */
|
105
|
+
ldi @(fp, #-20), gr4 /* ecif.rvalue */
|
106
|
+
|
107
|
+
/* Is the return value stored in two registers? */
|
108
|
+
cmpi gr10, #8, icc0
|
109
|
+
bne icc0, 0, .L2
|
110
|
+
/* Yes, save them. */
|
111
|
+
sti gr8, @(gr4, #0)
|
112
|
+
sti gr9, @(gr4, #4)
|
113
|
+
bra .L3
|
114
|
+
.L2:
|
115
|
+
/* Is the return value a structure? */
|
116
|
+
cmpi gr10, #-1, icc0
|
117
|
+
beq icc0, 0, .L3
|
118
|
+
/* No, save a 4 byte return value. */
|
119
|
+
sti gr8, @(gr4, #0)
|
120
|
+
.L3:
|
121
|
+
|
122
|
+
/* Restore the stack, and return. */
|
123
|
+
ldi @(fp, 8), gr5
|
124
|
+
ld @(fp, gr0), fp
|
125
|
+
addi sp,#80,sp
|
126
|
+
jmpl @(gr5,gr0)
|
127
|
+
.size ffi_call_EABI, .-ffi_call_EABI
|
128
|
+
|
@@ -0,0 +1,292 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
ffi.c - Copyright (C) 2004 Anthony Green
|
3
|
+
Copyright (C) 2007 Free Software Foundation, Inc.
|
4
|
+
Copyright (C) 2008 Red Hat, Inc.
|
5
|
+
|
6
|
+
FR-V Foreign Function Interface
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
a copy of this software and associated documentation files (the
|
10
|
+
``Software''), to deal in the Software without restriction, including
|
11
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
the following conditions:
|
15
|
+
|
16
|
+
The above copyright notice and this permission notice shall be included
|
17
|
+
in all copies or substantial portions of the Software.
|
18
|
+
|
19
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
23
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
24
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
26
|
+
DEALINGS IN THE SOFTWARE.
|
27
|
+
----------------------------------------------------------------------- */
|
28
|
+
|
29
|
+
#include <ffi.h>
|
30
|
+
#include <ffi_common.h>
|
31
|
+
|
32
|
+
#include <stdlib.h>
|
33
|
+
|
34
|
+
/* ffi_prep_args is called by the assembly routine once stack space
|
35
|
+
has been allocated for the function's arguments */
|
36
|
+
|
37
|
+
void *ffi_prep_args(char *stack, extended_cif *ecif)
|
38
|
+
{
|
39
|
+
register unsigned int i;
|
40
|
+
register void **p_argv;
|
41
|
+
register char *argp;
|
42
|
+
register ffi_type **p_arg;
|
43
|
+
register int count = 0;
|
44
|
+
|
45
|
+
p_argv = ecif->avalue;
|
46
|
+
argp = stack;
|
47
|
+
|
48
|
+
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
|
49
|
+
(i != 0);
|
50
|
+
i--, p_arg++)
|
51
|
+
{
|
52
|
+
size_t z;
|
53
|
+
|
54
|
+
z = (*p_arg)->size;
|
55
|
+
|
56
|
+
if ((*p_arg)->type == FFI_TYPE_STRUCT)
|
57
|
+
{
|
58
|
+
z = sizeof(void*);
|
59
|
+
*(void **) argp = *p_argv;
|
60
|
+
}
|
61
|
+
/* if ((*p_arg)->type == FFI_TYPE_FLOAT)
|
62
|
+
{
|
63
|
+
if (count > 24)
|
64
|
+
{
|
65
|
+
// This is going on the stack. Turn it into a double.
|
66
|
+
*(double *) argp = (double) *(float*)(* p_argv);
|
67
|
+
z = sizeof(double);
|
68
|
+
}
|
69
|
+
else
|
70
|
+
*(void **) argp = *(void **)(* p_argv);
|
71
|
+
} */
|
72
|
+
else if (z < sizeof(int))
|
73
|
+
{
|
74
|
+
z = sizeof(int);
|
75
|
+
switch ((*p_arg)->type)
|
76
|
+
{
|
77
|
+
case FFI_TYPE_SINT8:
|
78
|
+
*(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
|
79
|
+
break;
|
80
|
+
|
81
|
+
case FFI_TYPE_UINT8:
|
82
|
+
*(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
|
83
|
+
break;
|
84
|
+
|
85
|
+
case FFI_TYPE_SINT16:
|
86
|
+
*(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
|
87
|
+
break;
|
88
|
+
|
89
|
+
case FFI_TYPE_UINT16:
|
90
|
+
*(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
|
91
|
+
break;
|
92
|
+
|
93
|
+
default:
|
94
|
+
FFI_ASSERT(0);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
else if (z == sizeof(int))
|
98
|
+
{
|
99
|
+
*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
|
100
|
+
}
|
101
|
+
else
|
102
|
+
{
|
103
|
+
memcpy(argp, *p_argv, z);
|
104
|
+
}
|
105
|
+
p_argv++;
|
106
|
+
argp += z;
|
107
|
+
count += z;
|
108
|
+
}
|
109
|
+
|
110
|
+
return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8)));
|
111
|
+
}
|
112
|
+
|
113
|
+
/* Perform machine dependent cif processing */
|
114
|
+
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
115
|
+
{
|
116
|
+
if (cif->rtype->type == FFI_TYPE_STRUCT)
|
117
|
+
cif->flags = -1;
|
118
|
+
else
|
119
|
+
cif->flags = cif->rtype->size;
|
120
|
+
|
121
|
+
cif->bytes = ALIGN (cif->bytes, 8);
|
122
|
+
|
123
|
+
return FFI_OK;
|
124
|
+
}
|
125
|
+
|
126
|
+
extern void ffi_call_EABI(void *(*)(char *, extended_cif *),
|
127
|
+
extended_cif *,
|
128
|
+
unsigned, unsigned,
|
129
|
+
unsigned *,
|
130
|
+
void (*fn)(void));
|
131
|
+
|
132
|
+
void ffi_call(ffi_cif *cif,
|
133
|
+
void (*fn)(void),
|
134
|
+
void *rvalue,
|
135
|
+
void **avalue)
|
136
|
+
{
|
137
|
+
extended_cif ecif;
|
138
|
+
|
139
|
+
ecif.cif = cif;
|
140
|
+
ecif.avalue = avalue;
|
141
|
+
|
142
|
+
/* If the return value is a struct and we don't have a return */
|
143
|
+
/* value address then we need to make one */
|
144
|
+
|
145
|
+
if ((rvalue == NULL) &&
|
146
|
+
(cif->rtype->type == FFI_TYPE_STRUCT))
|
147
|
+
{
|
148
|
+
ecif.rvalue = alloca(cif->rtype->size);
|
149
|
+
}
|
150
|
+
else
|
151
|
+
ecif.rvalue = rvalue;
|
152
|
+
|
153
|
+
|
154
|
+
switch (cif->abi)
|
155
|
+
{
|
156
|
+
case FFI_EABI:
|
157
|
+
ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes,
|
158
|
+
cif->flags, ecif.rvalue, fn);
|
159
|
+
break;
|
160
|
+
default:
|
161
|
+
FFI_ASSERT(0);
|
162
|
+
break;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
|
167
|
+
unsigned arg4, unsigned arg5, unsigned arg6)
|
168
|
+
{
|
169
|
+
/* This function is called by a trampoline. The trampoline stows a
|
170
|
+
pointer to the ffi_closure object in gr7. We must save this
|
171
|
+
pointer in a place that will persist while we do our work. */
|
172
|
+
register ffi_closure *creg __asm__ ("gr7");
|
173
|
+
ffi_closure *closure = creg;
|
174
|
+
|
175
|
+
/* Arguments that don't fit in registers are found on the stack
|
176
|
+
at a fixed offset above the current frame pointer. */
|
177
|
+
register char *frame_pointer __asm__ ("fp");
|
178
|
+
char *stack_args = frame_pointer + 16;
|
179
|
+
|
180
|
+
/* Lay the register arguments down in a continuous chunk of memory. */
|
181
|
+
unsigned register_args[6] =
|
182
|
+
{ arg1, arg2, arg3, arg4, arg5, arg6 };
|
183
|
+
|
184
|
+
ffi_cif *cif = closure->cif;
|
185
|
+
ffi_type **arg_types = cif->arg_types;
|
186
|
+
void **avalue = alloca (cif->nargs * sizeof(void *));
|
187
|
+
char *ptr = (char *) register_args;
|
188
|
+
int i;
|
189
|
+
|
190
|
+
/* Find the address of each argument. */
|
191
|
+
for (i = 0; i < cif->nargs; i++)
|
192
|
+
{
|
193
|
+
switch (arg_types[i]->type)
|
194
|
+
{
|
195
|
+
case FFI_TYPE_SINT8:
|
196
|
+
case FFI_TYPE_UINT8:
|
197
|
+
avalue[i] = ptr + 3;
|
198
|
+
break;
|
199
|
+
case FFI_TYPE_SINT16:
|
200
|
+
case FFI_TYPE_UINT16:
|
201
|
+
avalue[i] = ptr + 2;
|
202
|
+
break;
|
203
|
+
case FFI_TYPE_SINT32:
|
204
|
+
case FFI_TYPE_UINT32:
|
205
|
+
case FFI_TYPE_FLOAT:
|
206
|
+
avalue[i] = ptr;
|
207
|
+
break;
|
208
|
+
case FFI_TYPE_STRUCT:
|
209
|
+
avalue[i] = *(void**)ptr;
|
210
|
+
break;
|
211
|
+
default:
|
212
|
+
/* This is an 8-byte value. */
|
213
|
+
avalue[i] = ptr;
|
214
|
+
ptr += 4;
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
ptr += 4;
|
218
|
+
|
219
|
+
/* If we've handled more arguments than fit in registers,
|
220
|
+
start looking at the those passed on the stack. */
|
221
|
+
if (ptr == ((char *)register_args + (6*4)))
|
222
|
+
ptr = stack_args;
|
223
|
+
}
|
224
|
+
|
225
|
+
/* Invoke the closure. */
|
226
|
+
if (cif->rtype->type == FFI_TYPE_STRUCT)
|
227
|
+
{
|
228
|
+
/* The caller allocates space for the return structure, and
|
229
|
+
passes a pointer to this space in gr3. Use this value directly
|
230
|
+
as the return value. */
|
231
|
+
register void *return_struct_ptr __asm__("gr3");
|
232
|
+
(closure->fun) (cif, return_struct_ptr, avalue, closure->user_data);
|
233
|
+
}
|
234
|
+
else
|
235
|
+
{
|
236
|
+
/* Allocate space for the return value and call the function. */
|
237
|
+
long long rvalue;
|
238
|
+
(closure->fun) (cif, &rvalue, avalue, closure->user_data);
|
239
|
+
|
240
|
+
/* Functions return 4-byte or smaller results in gr8. 8-byte
|
241
|
+
values also use gr9. We fill the both, even for small return
|
242
|
+
values, just to avoid a branch. */
|
243
|
+
asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue));
|
244
|
+
asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1]));
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
ffi_status
|
249
|
+
ffi_prep_closure_loc (ffi_closure* closure,
|
250
|
+
ffi_cif* cif,
|
251
|
+
void (*fun)(ffi_cif*, void*, void**, void*),
|
252
|
+
void *user_data,
|
253
|
+
void *codeloc)
|
254
|
+
{
|
255
|
+
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
|
256
|
+
unsigned long fn = (long) ffi_closure_eabi;
|
257
|
+
unsigned long cls = (long) codeloc;
|
258
|
+
#ifdef __FRV_FDPIC__
|
259
|
+
register void *got __asm__("gr15");
|
260
|
+
#endif
|
261
|
+
int i;
|
262
|
+
|
263
|
+
fn = (unsigned long) ffi_closure_eabi;
|
264
|
+
|
265
|
+
#ifdef __FRV_FDPIC__
|
266
|
+
tramp[0] = &((unsigned int *)codeloc)[2];
|
267
|
+
tramp[1] = got;
|
268
|
+
tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */
|
269
|
+
tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */
|
270
|
+
tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */
|
271
|
+
tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */
|
272
|
+
tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */
|
273
|
+
tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */
|
274
|
+
#else
|
275
|
+
tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */
|
276
|
+
tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */
|
277
|
+
tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */
|
278
|
+
tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */
|
279
|
+
tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */
|
280
|
+
#endif
|
281
|
+
|
282
|
+
closure->cif = cif;
|
283
|
+
closure->fun = fun;
|
284
|
+
closure->user_data = user_data;
|
285
|
+
|
286
|
+
/* Cache flushing. */
|
287
|
+
for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++)
|
288
|
+
__asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i),
|
289
|
+
"r" (codeloc));
|
290
|
+
|
291
|
+
return FFI_OK;
|
292
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/* -----------------------------------------------------------------*-C-*-
|
2
|
+
ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc.
|
3
|
+
Target configuration macros for FR-V
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
``Software''), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included
|
14
|
+
in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
----------------------------------------------------------------------- */
|
26
|
+
|
27
|
+
#ifndef LIBFFI_TARGET_H
|
28
|
+
#define LIBFFI_TARGET_H
|
29
|
+
|
30
|
+
/* ---- System specific configurations ----------------------------------- */
|
31
|
+
|
32
|
+
#ifndef LIBFFI_ASM
|
33
|
+
typedef unsigned long ffi_arg;
|
34
|
+
typedef signed long ffi_sarg;
|
35
|
+
|
36
|
+
typedef enum ffi_abi {
|
37
|
+
FFI_FIRST_ABI = 0,
|
38
|
+
FFI_EABI,
|
39
|
+
FFI_LAST_ABI,
|
40
|
+
FFI_DEFAULT_ABI = FFI_EABI
|
41
|
+
} ffi_abi;
|
42
|
+
#endif
|
43
|
+
|
44
|
+
/* ---- Definitions for closures ----------------------------------------- */
|
45
|
+
|
46
|
+
#define FFI_CLOSURES 1
|
47
|
+
#define FFI_NATIVE_RAW_API 0
|
48
|
+
|
49
|
+
#ifdef __FRV_FDPIC__
|
50
|
+
/* Trampolines are 8 4-byte instructions long. */
|
51
|
+
#define FFI_TRAMPOLINE_SIZE (8*4)
|
52
|
+
#else
|
53
|
+
/* Trampolines are 5 4-byte instructions long. */
|
54
|
+
#define FFI_TRAMPOLINE_SIZE (5*4)
|
55
|
+
#endif
|
56
|
+
|
57
|
+
#endif
|