rbdc 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bindings/ruby/rbdc/extconf.rb +57 -0
- data/bindings/ruby/rbdc/rbdc.c +304 -0
- data/dyncall/AUTHORS +4 -0
- data/dyncall/BUGS +3 -0
- data/dyncall/CMakeLists.txt +79 -0
- data/dyncall/ChangeLog +165 -0
- data/dyncall/LICENSE +15 -0
- data/dyncall/Makefile.M +15 -0
- data/dyncall/Makefile.embedded +71 -0
- data/dyncall/Makefile.generic +36 -0
- data/dyncall/Nmakefile +45 -0
- data/dyncall/README +92 -0
- data/dyncall/ToDo +114 -0
- data/dyncall/autovar/LICENSE.txt +15 -0
- data/dyncall/autovar/README.txt +69 -0
- data/dyncall/autovar/autovar_ABI.h +44 -0
- data/dyncall/autovar/autovar_ARCH.h +56 -0
- data/dyncall/autovar/autovar_CC.h +46 -0
- data/dyncall/autovar/autovar_OS.h +78 -0
- data/dyncall/autovar/autovar_OSFAMILY.h +39 -0
- data/dyncall/buildsys/cmake/Modules/FindDynCall.cmake +43 -0
- data/dyncall/buildsys/cmake/Modules/FindDynCallback.cmake +43 -0
- data/dyncall/buildsys/cmake/Modules/FindDynLoad.cmake +45 -0
- data/dyncall/buildsys/cmake/Modules/UseLATEX.cmake +811 -0
- data/dyncall/buildsys/dynmake/Makefile.base.M +82 -0
- data/dyncall/buildsys/dynmake/dynmake.bat +2 -0
- data/dyncall/buildsys/dynmake/dynmake.sh +4 -0
- data/dyncall/buildsys/lua/Makefile +10 -0
- data/dyncall/buildsys/lua/README.txt +4 -0
- data/dyncall/buildsys/lua/bootstrap.sh +34 -0
- data/dyncall/buildsys/lua/cleanup.sh +6 -0
- data/dyncall/buildsys/lua/mkfile +34 -0
- data/dyncall/buildsys/lua/setenv.sh +4 -0
- data/dyncall/buildsys/mk/app.mk +30 -0
- data/dyncall/buildsys/mk/dirs.mk +27 -0
- data/dyncall/buildsys/mk/epilog.mk +30 -0
- data/dyncall/buildsys/mk/lib.mk +23 -0
- data/dyncall/buildsys/mk/pcc.mk +60 -0
- data/dyncall/buildsys/mk/prolog.mk +35 -0
- data/dyncall/buildsys/nmake/common.nmake +61 -0
- data/dyncall/buildsys/nmake/epilog.nmake +28 -0
- data/dyncall/buildsys/nmake/prolog.nmake +76 -0
- data/dyncall/buildsys/nmake/tool_gcc.nmake +82 -0
- data/dyncall/buildsys/nmake/tool_msvc.nmake +67 -0
- data/dyncall/buildsys/scripts/batch-build-linux.sh +11 -0
- data/dyncall/buildsys/scripts/batch-build-minix.sh +11 -0
- data/dyncall/buildsys/scripts/batch-build-psp.sh +11 -0
- data/dyncall/buildsys/scripts/conf-nds.bat +41 -0
- data/dyncall/buildsys/scripts/setenv-cross-ios.sh +8 -0
- data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +22 -0
- data/dyncall/buildsys/vs2005/dyncall/dyncall.vcproj +245 -0
- data/dyncall/buildsys/vs2005/test_plain/test_plain.vcproj +202 -0
- data/dyncall/buildsys/vs2005/vs2005.sln +29 -0
- data/dyncall/configure +152 -0
- data/dyncall/configure.bat +157 -0
- data/dyncall/configure.rc +234 -0
- data/dyncall/dynMakefile +4 -0
- data/dyncall/dyncall/CMakeLists.txt +53 -0
- data/dyncall/dyncall/DynCallConfig.cmake +3 -0
- data/dyncall/dyncall/Makefile.M +10 -0
- data/dyncall/dyncall/Makefile.embedded +20 -0
- data/dyncall/dyncall/Makefile.generic +16 -0
- data/dyncall/dyncall/Nmakefile +62 -0
- data/dyncall/dyncall/README-Developer.txt +45 -0
- data/dyncall/dyncall/README.txt +65 -0
- data/dyncall/dyncall/TODO +9 -0
- data/dyncall/dyncall/dynMakefile +4 -0
- data/dyncall/dyncall/dyncall.3 +189 -0
- data/dyncall/dyncall/dyncall.h +135 -0
- data/dyncall/dyncall/dyncall_alloc.h +40 -0
- data/dyncall/dyncall/dyncall_api.c +167 -0
- data/dyncall/dyncall/dyncall_call.S +72 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm.S +80 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm.h +61 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +96 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +44 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb.h +65 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_apple.s +80 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +121 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +101 -0
- data/dyncall/dyncall/dyncall_call_mips.h +50 -0
- data/dyncall/dyncall/dyncall_call_mips_eabi.h +61 -0
- data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +115 -0
- data/dyncall/dyncall/dyncall_call_mips_gas.S +36 -0
- data/dyncall/dyncall/dyncall_call_mips_n32.h +67 -0
- data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +192 -0
- data/dyncall/dyncall/dyncall_call_mips_n64.h +67 -0
- data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +192 -0
- data/dyncall/dyncall/dyncall_call_mips_o32.h +70 -0
- data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +109 -0
- data/dyncall/dyncall/dyncall_call_ppc32.S +266 -0
- data/dyncall/dyncall/dyncall_call_ppc32.h +62 -0
- data/dyncall/dyncall/dyncall_call_sparc.S +192 -0
- data/dyncall/dyncall/dyncall_call_sparc.h +42 -0
- data/dyncall/dyncall/dyncall_call_sparc64.S +361 -0
- data/dyncall/dyncall/dyncall_call_sparc64.h +42 -0
- data/dyncall/dyncall/dyncall_call_sparc_v9.S +220 -0
- data/dyncall/dyncall/dyncall_call_sparc_v9.h +42 -0
- data/dyncall/dyncall/dyncall_call_x64-att.S +146 -0
- data/dyncall/dyncall/dyncall_call_x64.S +149 -0
- data/dyncall/dyncall/dyncall_call_x64.h +63 -0
- data/dyncall/dyncall/dyncall_call_x64_generic_masm.asm +70 -0
- data/dyncall/dyncall/dyncall_call_x86.S +238 -0
- data/dyncall/dyncall/dyncall_call_x86.h +70 -0
- data/dyncall/dyncall/dyncall_call_x86_8a.s +127 -0
- data/dyncall/dyncall/dyncall_call_x86_generic_masm.asm +136 -0
- data/dyncall/dyncall/dyncall_call_x86_nasm.asm +234 -0
- data/dyncall/dyncall/dyncall_callf.c +112 -0
- data/dyncall/dyncall/dyncall_callf.h +52 -0
- data/dyncall/dyncall/dyncall_callvm.c +68 -0
- data/dyncall/dyncall/dyncall_callvm.h +88 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +250 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +59 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +204 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +63 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +271 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +59 -0
- data/dyncall/dyncall/dyncall_callvm_base.c +33 -0
- data/dyncall/dyncall/dyncall_callvm_mips.c +40 -0
- data/dyncall/dyncall/dyncall_callvm_mips.h +37 -0
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +181 -0
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +61 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n32.c +268 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n64.c +268 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n64.h +53 -0
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c +235 -0
- data/dyncall/dyncall/dyncall_callvm_mips_o32.h +45 -0
- data/dyncall/dyncall/dyncall_callvm_ppc32.c +372 -0
- data/dyncall/dyncall/dyncall_callvm_ppc32.h +61 -0
- data/dyncall/dyncall/dyncall_callvm_sparc.c +155 -0
- data/dyncall/dyncall/dyncall_callvm_sparc.h +44 -0
- data/dyncall/dyncall/dyncall_callvm_sparc64.c +239 -0
- data/dyncall/dyncall/dyncall_callvm_sparc64.h +47 -0
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +182 -0
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +45 -0
- data/dyncall/dyncall/dyncall_callvm_x64.c +228 -0
- data/dyncall/dyncall/dyncall_callvm_x64.h +111 -0
- data/dyncall/dyncall/dyncall_callvm_x86.c +667 -0
- data/dyncall/dyncall/dyncall_callvm_x86.h +75 -0
- data/dyncall/dyncall/dyncall_config.h +46 -0
- data/dyncall/dyncall/dyncall_macros.h +248 -0
- data/dyncall/dyncall/dyncall_signature.h +71 -0
- data/dyncall/dyncall/dyncall_struct.c +255 -0
- data/dyncall/dyncall/dyncall_struct.h +69 -0
- data/dyncall/dyncall/dyncall_types.h +74 -0
- data/dyncall/dyncall/dyncall_utils.h +38 -0
- data/dyncall/dyncall/dyncall_value.h +73 -0
- data/dyncall/dyncall/dyncall_vector.c +52 -0
- data/dyncall/dyncall/dyncall_vector.h +56 -0
- data/dyncall/dyncall/gen-masm.sh +7 -0
- data/dyncall/dyncall/mkfile +29 -0
- data/dyncall/dyncallback/CMakeLists.txt +55 -0
- data/dyncall/dyncallback/DynCallbackConfig.cmake +2 -0
- data/dyncall/dyncallback/Makefile.M +10 -0
- data/dyncall/dyncallback/Makefile.embedded +15 -0
- data/dyncall/dyncallback/Makefile.generic +20 -0
- data/dyncall/dyncallback/Nmakefile +71 -0
- data/dyncall/dyncallback/README.txt +9 -0
- data/dyncall/dyncallback/TODO +4 -0
- data/dyncall/dyncallback/dynMakefile +4 -0
- data/dyncall/dyncallback/dyncall_alloc_wx.c +35 -0
- data/dyncall/dyncallback/dyncall_alloc_wx.h +46 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +40 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +42 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +42 -0
- data/dyncall/dyncallback/dyncall_args.c +45 -0
- data/dyncall/dyncallback/dyncall_args.h +65 -0
- data/dyncall/dyncallback/dyncall_args_arm32_arm.c +112 -0
- data/dyncall/dyncallback/dyncall_args_arm32_arm.h +40 -0
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +32 -0
- data/dyncall/dyncallback/dyncall_args_mips.c +81 -0
- data/dyncall/dyncallback/dyncall_args_mips.h +41 -0
- data/dyncall/dyncallback/dyncall_args_ppc32.c +88 -0
- data/dyncall/dyncallback/dyncall_args_ppc32.h +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc32.h +37 -0
- data/dyncall/dyncallback/dyncall_args_sparc64.c +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc64.h +37 -0
- data/dyncall/dyncallback/dyncall_args_x64.c +73 -0
- data/dyncall/dyncallback/dyncall_args_x64.h +44 -0
- data/dyncall/dyncallback/dyncall_args_x86.c +121 -0
- data/dyncall/dyncallback/dyncall_args_x86.h +58 -0
- data/dyncall/dyncallback/dyncall_callback.c +45 -0
- data/dyncall/dyncallback/dyncall_callback.h +51 -0
- data/dyncall/dyncallback/dyncall_callback_arch.S +71 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +63 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +45 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +73 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.s +73 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +33 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.s +32 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.s +32 -0
- data/dyncall/dyncallback/dyncall_callback_mips.c +61 -0
- data/dyncall/dyncallback/dyncall_callback_mips.h +42 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.S +33 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.c +60 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.h +43 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +180 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.c +57 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.h +43 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.s +30 -0
- data/dyncall/dyncallback/dyncall_callback_sparc64.c +57 -0
- data/dyncall/dyncallback/dyncall_callback_sparc64.s +30 -0
- data/dyncall/dyncallback/dyncall_callback_x64.S +187 -0
- data/dyncall/dyncallback/dyncall_callback_x64.c +69 -0
- data/dyncall/dyncallback/dyncall_callback_x64.h +44 -0
- data/dyncall/dyncallback/dyncall_callback_x64_apple.s +122 -0
- data/dyncall/dyncallback/dyncall_callback_x64_gas.s +119 -0
- data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +102 -0
- data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +89 -0
- data/dyncall/dyncallback/dyncall_callback_x86.S +115 -0
- data/dyncall/dyncallback/dyncall_callback_x86.c +281 -0
- data/dyncall/dyncallback/dyncall_callback_x86.h +49 -0
- data/dyncall/dyncallback/dyncall_callback_x86_8a.s +100 -0
- data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +74 -0
- data/dyncall/dyncallback/dyncall_thunk.c +47 -0
- data/dyncall/dyncallback/dyncall_thunk.h +84 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +45 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +40 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +35 -0
- data/dyncall/dyncallback/dyncall_thunk_mips.c +52 -0
- data/dyncall/dyncallback/dyncall_thunk_mips.h +37 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc32.c +51 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc32.h +40 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc32.c +32 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc32.h +36 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc64.c +32 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc64.h +36 -0
- data/dyncall/dyncallback/dyncall_thunk_x64.c +48 -0
- data/dyncall/dyncallback/dyncall_thunk_x64.h +39 -0
- data/dyncall/dyncallback/dyncall_thunk_x86.c +44 -0
- data/dyncall/dyncallback/dyncall_thunk_x86.h +39 -0
- data/dyncall/dyncallback/dyncallback.3 +134 -0
- data/dyncall/dyncallback/gen-masm.sh +8 -0
- data/dyncall/dyncallback/mkfile +29 -0
- data/dyncall/dynload/CMakeLists.txt +25 -0
- data/dyncall/dynload/DynLoadConfig.cmake +3 -0
- data/dyncall/dynload/Makefile.M +10 -0
- data/dyncall/dynload/Makefile.embedded +22 -0
- data/dyncall/dynload/Makefile.generic +18 -0
- data/dyncall/dynload/Nmakefile +57 -0
- data/dyncall/dynload/README.txt +113 -0
- data/dyncall/dynload/TODO +20 -0
- data/dyncall/dynload/dynMakefile +4 -0
- data/dyncall/dynload/dynload.3 +64 -0
- data/dyncall/dynload/dynload.c +38 -0
- data/dyncall/dynload/dynload.h +65 -0
- data/dyncall/dynload/dynload_alloc.h +40 -0
- data/dyncall/dynload/dynload_darwin.c +89 -0
- data/dyncall/dynload/dynload_syms.c +38 -0
- data/dyncall/dynload/dynload_syms_elf.c +214 -0
- data/dyncall/dynload/dynload_syms_mach-o.c +167 -0
- data/dyncall/dynload/dynload_syms_pe.c +109 -0
- data/dyncall/dynload/dynload_unix.c +57 -0
- data/dyncall/dynload/dynload_windows.c +59 -0
- data/dyncall/mkfile +36 -0
- data/dyncall/portasm/README.txt +42 -0
- data/dyncall/portasm/gen-masm.sh +3 -0
- data/dyncall/portasm/portasm-arm.S +36 -0
- data/dyncall/portasm/portasm-ppc.S +98 -0
- data/dyncall/portasm/portasm-x64-att.S +155 -0
- data/dyncall/portasm/portasm-x86.S +127 -0
- metadata +311 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_callvm_v9.c
|
6
|
+
Description: Call VM for sparc-v9 ABI.
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2011 Daniel Adler <dadler@uni-goettingen.de>
|
10
|
+
|
11
|
+
Permission to use, copy, modify, and distribute this software for any
|
12
|
+
purpose with or without fee is hereby granted, provided that the above
|
13
|
+
copyright notice and this permission notice appear in all copies.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
16
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
17
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
18
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
19
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
20
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
21
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
22
|
+
|
23
|
+
*/
|
24
|
+
|
25
|
+
|
26
|
+
#include "dyncall_callvm_sparc_v9.h"
|
27
|
+
#include "dyncall_call_sparc_v9.h"
|
28
|
+
#include "dyncall_utils.h"
|
29
|
+
#include "dyncall_alloc.h"
|
30
|
+
|
31
|
+
/* Reset argument buffer. */
|
32
|
+
static void dc_callvm_reset_v9(DCCallVM* in_self)
|
33
|
+
{
|
34
|
+
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
35
|
+
dcVecResize(&self->mVecHead,0);
|
36
|
+
}
|
37
|
+
|
38
|
+
/* Construtor. */
|
39
|
+
static DCCallVM* dc_callvm_new_v9(DCCallVM_vt* vt, DCsize size)
|
40
|
+
{
|
41
|
+
DCCallVM_v9* self = (DCCallVM_v9*) dcAllocMem(sizeof(DCCallVM_v9)+size);
|
42
|
+
dc_callvm_base_init(&self->mInterface, vt);
|
43
|
+
dcVecInit(&self->mVecHead,size);
|
44
|
+
dc_callvm_reset_v9(&self->mInterface);
|
45
|
+
return (DCCallVM*)self;
|
46
|
+
}
|
47
|
+
|
48
|
+
/* Destructor. */
|
49
|
+
static void dc_callvm_free_v9(DCCallVM* in_self)
|
50
|
+
{
|
51
|
+
dcFreeMem(in_self);
|
52
|
+
}
|
53
|
+
|
54
|
+
static void dc_callvm_argLongLong_v9(DCCallVM* in_self, DClonglong x)
|
55
|
+
{
|
56
|
+
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
57
|
+
dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
|
58
|
+
}
|
59
|
+
|
60
|
+
/* all integers are promoted to 64-bit. */
|
61
|
+
static void dc_callvm_argLong_v9 (DCCallVM* in_self, DClong x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
62
|
+
static void dc_callvm_argInt_v9 (DCCallVM* in_self, DCint x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
63
|
+
static void dc_callvm_argBool_v9 (DCCallVM* in_self, DCbool x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
64
|
+
static void dc_callvm_argChar_v9 (DCCallVM* in_self, DCchar x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
65
|
+
static void dc_callvm_argShort_v9 (DCCallVM* in_self, DCshort x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
66
|
+
static void dc_callvm_argPointer_v9(DCCallVM* in_self, DCpointer x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
67
|
+
|
68
|
+
static void dc_callvm_argDouble_v9(DCCallVM* in_self, DCdouble x)
|
69
|
+
{
|
70
|
+
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
71
|
+
dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
|
72
|
+
}
|
73
|
+
|
74
|
+
static void dc_callvm_argDouble_v9_ellipsis(DCCallVM* in_self, DCdouble x)
|
75
|
+
{
|
76
|
+
union {
|
77
|
+
long long l;
|
78
|
+
double d;
|
79
|
+
} u;
|
80
|
+
u.d = x;
|
81
|
+
dc_callvm_argLongLong_v9(in_self, u.l);
|
82
|
+
}
|
83
|
+
|
84
|
+
static void dc_callvm_argFloat_v9_ellipsis(DCCallVM* in_self, DCfloat x)
|
85
|
+
{
|
86
|
+
dc_callvm_argDouble_v9_ellipsis(in_self, (DCdouble) x);
|
87
|
+
}
|
88
|
+
|
89
|
+
static void dc_callvm_argFloat_v9(DCCallVM* in_self, DCfloat x)
|
90
|
+
{
|
91
|
+
union {
|
92
|
+
double d;
|
93
|
+
float f[2];
|
94
|
+
} u;
|
95
|
+
u.f[1] = x;
|
96
|
+
dc_callvm_argDouble_v9(in_self, u.d);
|
97
|
+
}
|
98
|
+
|
99
|
+
static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode);
|
100
|
+
|
101
|
+
DCCallVM_vt gVT_v9_ellipsis =
|
102
|
+
{
|
103
|
+
&dc_callvm_free_v9,
|
104
|
+
&dc_callvm_reset_v9,
|
105
|
+
&dc_callvm_mode_v9,
|
106
|
+
&dc_callvm_argBool_v9,
|
107
|
+
&dc_callvm_argChar_v9,
|
108
|
+
&dc_callvm_argShort_v9,
|
109
|
+
&dc_callvm_argInt_v9,
|
110
|
+
&dc_callvm_argLong_v9,
|
111
|
+
&dc_callvm_argLongLong_v9,
|
112
|
+
&dc_callvm_argFloat_v9_ellipsis,
|
113
|
+
&dc_callvm_argDouble_v9_ellipsis,
|
114
|
+
&dc_callvm_argPointer_v9,
|
115
|
+
NULL /* argStruct */,
|
116
|
+
(DCvoidvmfunc*) &dcCall_v9,
|
117
|
+
(DCboolvmfunc*) &dcCall_v9,
|
118
|
+
(DCcharvmfunc*) &dcCall_v9,
|
119
|
+
(DCshortvmfunc*) &dcCall_v9,
|
120
|
+
(DCintvmfunc*) &dcCall_v9,
|
121
|
+
(DClongvmfunc*) &dcCall_v9,
|
122
|
+
(DClonglongvmfunc*) &dcCall_v9,
|
123
|
+
(DCfloatvmfunc*) &dcCall_v9,
|
124
|
+
(DCdoublevmfunc*) &dcCall_v9,
|
125
|
+
(DCpointervmfunc*) &dcCall_v9,
|
126
|
+
NULL /* callStruct */
|
127
|
+
};
|
128
|
+
|
129
|
+
/* CallVM virtual table. */
|
130
|
+
DCCallVM_vt gVT_v9 =
|
131
|
+
{
|
132
|
+
&dc_callvm_free_v9,
|
133
|
+
&dc_callvm_reset_v9,
|
134
|
+
&dc_callvm_mode_v9,
|
135
|
+
&dc_callvm_argBool_v9,
|
136
|
+
&dc_callvm_argChar_v9,
|
137
|
+
&dc_callvm_argShort_v9,
|
138
|
+
&dc_callvm_argInt_v9,
|
139
|
+
&dc_callvm_argLong_v9,
|
140
|
+
&dc_callvm_argLongLong_v9,
|
141
|
+
&dc_callvm_argFloat_v9,
|
142
|
+
&dc_callvm_argDouble_v9,
|
143
|
+
&dc_callvm_argPointer_v9,
|
144
|
+
NULL /* argStruct */,
|
145
|
+
(DCvoidvmfunc*) &dcCall_v9,
|
146
|
+
(DCboolvmfunc*) &dcCall_v9,
|
147
|
+
(DCcharvmfunc*) &dcCall_v9,
|
148
|
+
(DCshortvmfunc*) &dcCall_v9,
|
149
|
+
(DCintvmfunc*) &dcCall_v9,
|
150
|
+
(DClongvmfunc*) &dcCall_v9,
|
151
|
+
(DClonglongvmfunc*) &dcCall_v9,
|
152
|
+
(DCfloatvmfunc*) &dcCall_v9,
|
153
|
+
(DCdoublevmfunc*) &dcCall_v9,
|
154
|
+
(DCpointervmfunc*) &dcCall_v9,
|
155
|
+
NULL /* callStruct */
|
156
|
+
};
|
157
|
+
|
158
|
+
/* mode: only a single mode available currently. */
|
159
|
+
static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode)
|
160
|
+
{
|
161
|
+
switch(mode) {
|
162
|
+
case DC_CALL_C_DEFAULT:
|
163
|
+
case DC_CALL_C_ELLIPSIS:
|
164
|
+
case DC_CALL_C_SPARC64:
|
165
|
+
in_self->mVTpointer = &gVT_v9;
|
166
|
+
break;
|
167
|
+
case DC_CALL_C_ELLIPSIS_VARARGS:
|
168
|
+
in_self->mVTpointer = &gVT_v9_ellipsis;
|
169
|
+
break;
|
170
|
+
default:
|
171
|
+
in_self->mError = DC_ERROR_UNSUPPORTED_MODE;
|
172
|
+
break;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
|
177
|
+
/* Public API. */
|
178
|
+
DCCallVM* dcNewCallVM(DCsize size)
|
179
|
+
{
|
180
|
+
return dc_callvm_new_v9(&gVT_v9,size);
|
181
|
+
}
|
182
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_callvm_sparc_v9.h
|
6
|
+
Description: Call VM for sparc-v9 ABI.
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2011 Daniel Adler <dadler@uni-goettingen.de>
|
10
|
+
|
11
|
+
Permission to use, copy, modify, and distribute this software for any
|
12
|
+
purpose with or without fee is hereby granted, provided that the above
|
13
|
+
copyright notice and this permission notice appear in all copies.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
16
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
17
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
18
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
19
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
20
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
21
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
22
|
+
|
23
|
+
*/
|
24
|
+
|
25
|
+
|
26
|
+
#ifndef DYNCALL_CALLVM_SPARC_V9_H
|
27
|
+
#define DYNCALL_CALLVM_SPARC_V9_H
|
28
|
+
|
29
|
+
#include "dyncall_callvm.h"
|
30
|
+
#include "dyncall_vector.h"
|
31
|
+
|
32
|
+
typedef struct
|
33
|
+
{
|
34
|
+
DCCallVM mInterface; /* 0: +12:8 = 16*/
|
35
|
+
DCVecHead mVecHead; /* 16 152: mTotalSize +8 */
|
36
|
+
/* 24 160: mSize +8 */
|
37
|
+
/* 32 168: mData */
|
38
|
+
} DCCallVM_v9;
|
39
|
+
|
40
|
+
DCCallVM* dcNewCallVM_v9(DCsize size);
|
41
|
+
|
42
|
+
#endif /* DYNCALL_CALLVM_SPARC_V9_H */
|
43
|
+
|
44
|
+
|
45
|
+
|
@@ -0,0 +1,228 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_callvm_x64.c
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
+
|
12
|
+
Permission to use, copy, modify, and distribute this software for any
|
13
|
+
purpose with or without fee is hereby granted, provided that the above
|
14
|
+
copyright notice and this permission notice appear in all copies.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
/* MS Windows x64 calling convention, AMD64 SystemV ABI. */
|
29
|
+
|
30
|
+
|
31
|
+
#include "dyncall_callvm_x64.h"
|
32
|
+
#include "dyncall_alloc.h"
|
33
|
+
#include "dyncall_struct.h"
|
34
|
+
|
35
|
+
static DCCallVM* dc_callvm_new_x64(DCCallVM_vt* vt, DCsize size)
|
36
|
+
{
|
37
|
+
DCCallVM_x64* self = (DCCallVM_x64*)dcAllocMem(sizeof(DCCallVM_x64)+size);
|
38
|
+
|
39
|
+
dc_callvm_base_init(&self->mInterface, vt);
|
40
|
+
|
41
|
+
/* Since we store register parameters in DCCallVM_x64 directly, adjust the stack size. */
|
42
|
+
size -= sizeof(DCRegData_x64);
|
43
|
+
size = (((signed long)size) < 0) ? 0 : size;
|
44
|
+
|
45
|
+
|
46
|
+
self->mRegCount.i = self->mRegCount.f = 0;
|
47
|
+
|
48
|
+
dcVecInit(&self->mVecHead, size);
|
49
|
+
return (DCCallVM*)self;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
static void dc_callvm_free_x64(DCCallVM* in_self)
|
54
|
+
{
|
55
|
+
dcFreeMem(in_self);
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
static void dc_callvm_reset_x64(DCCallVM* in_self)
|
60
|
+
{
|
61
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
62
|
+
dcVecReset(&self->mVecHead);
|
63
|
+
self->mRegCount.i = self->mRegCount.f = 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
static void dc_callvm_mode_x64(DCCallVM* self, DCint mode)
|
68
|
+
{
|
69
|
+
switch(mode) {
|
70
|
+
case DC_CALL_C_DEFAULT:
|
71
|
+
case DC_CALL_C_ELLIPSIS:
|
72
|
+
break;
|
73
|
+
default:
|
74
|
+
self->mError = DC_ERROR_UNSUPPORTED_MODE;
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
static void dc_callvm_argLongLong_x64(DCCallVM* in_self, DClonglong x)
|
81
|
+
{
|
82
|
+
/* A long long always has 64 bits on the supported x64 platforms (lp64 on unix and llp64 on windows). */
|
83
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
84
|
+
if(self->mRegCount.i < numIntRegs)
|
85
|
+
self->mRegData.i[self->mRegCount.i++] = x;
|
86
|
+
else
|
87
|
+
dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
static void dc_callvm_argBool_x64(DCCallVM* in_self, DCbool x)
|
92
|
+
{
|
93
|
+
dc_callvm_argLongLong_x64(in_self, (DClonglong)x);
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
static void dc_callvm_argChar_x64(DCCallVM* in_self, DCchar x)
|
98
|
+
{
|
99
|
+
dc_callvm_argLongLong_x64(in_self, x);
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
static void dc_callvm_argShort_x64(DCCallVM* in_self, DCshort x)
|
104
|
+
{
|
105
|
+
dc_callvm_argLongLong_x64(in_self, x);
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
static void dc_callvm_argInt_x64(DCCallVM* in_self, DCint x)
|
110
|
+
{
|
111
|
+
dc_callvm_argLongLong_x64(in_self, x);
|
112
|
+
}
|
113
|
+
|
114
|
+
|
115
|
+
static void dc_callvm_argLong_x64(DCCallVM* in_self, DClong x)
|
116
|
+
{
|
117
|
+
dc_callvm_argLongLong_x64(in_self, x);
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
static void dc_callvm_argFloat_x64(DCCallVM* in_self, DCfloat x)
|
122
|
+
{
|
123
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
124
|
+
|
125
|
+
/* Although not promoted to doubles, floats are stored with 64bits in this API.*/
|
126
|
+
union {
|
127
|
+
DCdouble d;
|
128
|
+
DCfloat f;
|
129
|
+
} f;
|
130
|
+
f.f = x;
|
131
|
+
|
132
|
+
if(self->mRegCount.f < numFloatRegs)
|
133
|
+
*(DCfloat*)&self->mRegData.f[self->mRegCount.f++] = x;
|
134
|
+
else
|
135
|
+
dcVecAppend(&self->mVecHead, &f.f, sizeof(DCdouble));
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
static void dc_callvm_argDouble_x64(DCCallVM* in_self, DCdouble x)
|
140
|
+
{
|
141
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
142
|
+
if(self->mRegCount.f < numFloatRegs)
|
143
|
+
self->mRegData.f[self->mRegCount.f++] = x;
|
144
|
+
else
|
145
|
+
dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
|
146
|
+
}
|
147
|
+
|
148
|
+
|
149
|
+
static void dc_callvm_argPointer_x64(DCCallVM* in_self, DCpointer x)
|
150
|
+
{
|
151
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
152
|
+
if(self->mRegCount.i < numIntRegs)
|
153
|
+
*(DCpointer*)&self->mRegData.i[self->mRegCount.i++] = x;
|
154
|
+
else
|
155
|
+
dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));
|
156
|
+
}
|
157
|
+
|
158
|
+
static void dc_callvm_argStruct_x64(DCCallVM* in_self, DCstruct* s, DCpointer x)
|
159
|
+
{
|
160
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
161
|
+
dcVecAppend(&self->mVecHead, x, s->size);
|
162
|
+
/*printf("dc_callvm_argStruct_x64 size = %d\n", (int)s->size);@@@*/
|
163
|
+
if (s->size <= 64)
|
164
|
+
dcArgStructUnroll(in_self, s, x);
|
165
|
+
/*else@@@*/
|
166
|
+
/* dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer));@@@*/
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
/* Call. */
|
171
|
+
void dc_callvm_call_x64(DCCallVM* in_self, DCpointer target)
|
172
|
+
{
|
173
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
174
|
+
#if defined(DC_UNIX)
|
175
|
+
dcCall_x64_sysv(
|
176
|
+
#else
|
177
|
+
dcCall_x64_win64(
|
178
|
+
#endif
|
179
|
+
dcVecSize(&self->mVecHead), /* Size of stack data. */
|
180
|
+
dcVecData(&self->mVecHead), /* Pointer to stack arguments. */
|
181
|
+
self->mRegData.i, /* Pointer to register arguments (ints on SysV). */
|
182
|
+
#if defined(DC_UNIX)
|
183
|
+
self->mRegData.f, /* Pointer to floating point register arguments. */
|
184
|
+
#endif
|
185
|
+
target
|
186
|
+
);
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
DCCallVM_vt gVT_x64 =
|
191
|
+
{
|
192
|
+
&dc_callvm_free_x64
|
193
|
+
, &dc_callvm_reset_x64
|
194
|
+
, &dc_callvm_mode_x64
|
195
|
+
, &dc_callvm_argBool_x64
|
196
|
+
, &dc_callvm_argChar_x64
|
197
|
+
, &dc_callvm_argShort_x64
|
198
|
+
, &dc_callvm_argInt_x64
|
199
|
+
, &dc_callvm_argLong_x64
|
200
|
+
, &dc_callvm_argLongLong_x64
|
201
|
+
, &dc_callvm_argFloat_x64
|
202
|
+
, &dc_callvm_argDouble_x64
|
203
|
+
, &dc_callvm_argPointer_x64
|
204
|
+
, &dc_callvm_argStruct_x64
|
205
|
+
, (DCvoidvmfunc*) &dc_callvm_call_x64
|
206
|
+
, (DCboolvmfunc*) &dc_callvm_call_x64
|
207
|
+
, (DCcharvmfunc*) &dc_callvm_call_x64
|
208
|
+
, (DCshortvmfunc*) &dc_callvm_call_x64
|
209
|
+
, (DCintvmfunc*) &dc_callvm_call_x64
|
210
|
+
, (DClongvmfunc*) &dc_callvm_call_x64
|
211
|
+
, (DClonglongvmfunc*) &dc_callvm_call_x64
|
212
|
+
, (DCfloatvmfunc*) &dc_callvm_call_x64
|
213
|
+
, (DCdoublevmfunc*) &dc_callvm_call_x64
|
214
|
+
, (DCpointervmfunc*) &dc_callvm_call_x64
|
215
|
+
, NULL /* callStruct */
|
216
|
+
};
|
217
|
+
|
218
|
+
|
219
|
+
DCCallVM* dcNewCallVM_x64(DCsize size)
|
220
|
+
{
|
221
|
+
return dc_callvm_new_x64(&gVT_x64, size);
|
222
|
+
}
|
223
|
+
|
224
|
+
DCCallVM* dcNewCallVM(DCsize size)
|
225
|
+
{
|
226
|
+
return dcNewCallVM_x64(size);
|
227
|
+
}
|
228
|
+
|