rbdc 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dyncall/BUGS +1 -1
- data/dyncall/CMakeLists.txt +19 -7
- data/dyncall/ChangeLog +61 -20
- data/dyncall/LICENSE +1 -1
- data/dyncall/Makefile.generic +2 -0
- data/dyncall/ToDo +97 -29
- data/dyncall/autovar/README.txt +1 -0
- data/dyncall/autovar/autovar_ABI.h +4 -2
- data/dyncall/autovar/autovar_ARCH.h +9 -5
- data/dyncall/autovar/autovar_CC.h +3 -1
- data/dyncall/autovar/autovar_OS.h +2 -2
- data/dyncall/autovar/autovar_OSFAMILY.h +1 -1
- data/dyncall/configure +94 -38
- data/dyncall/dyncall/dyncall.3 +8 -4
- data/dyncall/dyncall/dyncall.h +1 -1
- data/dyncall/dyncall/dyncall_alloc.h +1 -1
- data/dyncall/dyncall/dyncall_api.c +3 -1
- data/dyncall/dyncall/dyncall_call.S +13 -5
- data/dyncall/dyncall/dyncall_call_arm32_arm.S +1 -2
- data/dyncall/dyncall/dyncall_call_arm32_arm.h +1 -1
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +24 -26
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +1 -1
- data/dyncall/dyncall/dyncall_call_arm32_thumb.h +1 -1
- data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +1 -1
- data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +3 -7
- data/dyncall/dyncall/dyncall_call_arm64.S +2 -2
- data/dyncall/dyncall/dyncall_call_arm64.h +2 -2
- data/dyncall/dyncall/dyncall_call_mips.h +1 -1
- data/dyncall/dyncall/dyncall_call_mips_eabi.h +1 -1
- data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +16 -16
- data/dyncall/dyncall/dyncall_call_mips_gas.S +2 -2
- data/dyncall/dyncall/dyncall_call_mips_n32.h +5 -4
- data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +4 -4
- data/dyncall/dyncall/dyncall_call_mips_n64.h +3 -3
- data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +2 -2
- data/dyncall/dyncall/dyncall_call_mips_o32.h +4 -3
- data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +1 -3
- data/dyncall/dyncall/dyncall_call_ppc32.S +1 -1
- data/dyncall/dyncall/dyncall_call_ppc32.h +1 -1
- data/dyncall/dyncall/dyncall_call_sparc.h +1 -1
- data/dyncall/dyncall/{dyncall_call_sparc.S → dyncall_call_sparc.s} +39 -44
- data/dyncall/dyncall/dyncall_call_sparc64.h +5 -5
- data/dyncall/dyncall/dyncall_call_sparc64.s +177 -0
- data/dyncall/dyncall/dyncall_call_x64.S +83 -86
- data/dyncall/dyncall/dyncall_call_x64.h +1 -1
- data/dyncall/dyncall/dyncall_call_x86.S +9 -9
- data/dyncall/dyncall/dyncall_call_x86.h +1 -1
- data/dyncall/dyncall/dyncall_call_x86_nasm.asm +5 -5
- data/dyncall/dyncall/dyncall_callf.c +18 -18
- data/dyncall/dyncall/dyncall_callf.h +1 -1
- data/dyncall/dyncall/dyncall_callvm.c +3 -3
- data/dyncall/dyncall/dyncall_callvm.h +1 -1
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +25 -40
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +1 -5
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +25 -33
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +1 -5
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +24 -36
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +1 -5
- data/dyncall/dyncall/dyncall_callvm_arm64.c +23 -27
- data/dyncall/dyncall/dyncall_callvm_arm64.h +2 -6
- data/dyncall/dyncall/dyncall_callvm_arm64_apple.c +23 -30
- data/dyncall/dyncall/dyncall_callvm_base.c +1 -1
- data/dyncall/dyncall/dyncall_callvm_mips.c +1 -1
- data/dyncall/dyncall/dyncall_callvm_mips.h +1 -1
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +30 -27
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +1 -5
- data/dyncall/dyncall/dyncall_callvm_mips_n32.c +24 -30
- data/dyncall/dyncall/{dyncall_call_sparc_v9.h → dyncall_callvm_mips_n32.h} +18 -8
- data/dyncall/dyncall/dyncall_callvm_mips_n64.c +23 -30
- data/dyncall/dyncall/dyncall_callvm_mips_n64.h +4 -6
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c +31 -29
- data/dyncall/dyncall/dyncall_callvm_mips_o32.h +1 -3
- data/dyncall/dyncall/dyncall_callvm_ppc32.c +22 -20
- data/dyncall/dyncall/dyncall_callvm_ppc32.h +1 -3
- data/dyncall/dyncall/dyncall_callvm_ppc64.c +54 -15
- data/dyncall/dyncall/dyncall_callvm_ppc64.h +0 -2
- data/dyncall/dyncall/dyncall_callvm_sparc.c +34 -26
- data/dyncall/dyncall/dyncall_callvm_sparc.h +1 -3
- data/dyncall/dyncall/dyncall_callvm_sparc64.c +94 -150
- data/dyncall/dyncall/dyncall_callvm_sparc64.h +11 -17
- data/dyncall/dyncall/dyncall_callvm_x64.c +37 -36
- data/dyncall/dyncall/dyncall_callvm_x64.h +1 -4
- data/dyncall/dyncall/dyncall_callvm_x86.c +22 -63
- data/dyncall/dyncall/dyncall_callvm_x86.h +1 -17
- data/dyncall/dyncall/dyncall_config.h +1 -1
- data/dyncall/dyncall/dyncall_macros.h +28 -19
- data/dyncall/dyncall/dyncall_signature.h +1 -1
- data/dyncall/dyncall/dyncall_types.h +17 -18
- data/dyncall/dyncall/dyncall_utils.h +1 -1
- data/dyncall/dyncall/dyncall_value.h +28 -21
- data/dyncall/dyncall/dyncall_vector.c +1 -1
- data/dyncall/dyncall/dyncall_vector.h +1 -1
- data/dyncall/dyncall/gen-masm.sh +2 -2
- data/dyncall/dyncallback/CMakeLists.txt +1 -2
- data/dyncall/dyncallback/Makefile.generic +1 -1
- data/dyncall/dyncallback/dyncall_alloc_wx.c +1 -1
- data/dyncall/dyncallback/dyncall_alloc_wx.h +4 -3
- data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +8 -2
- data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +67 -4
- data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +7 -2
- data/dyncall/dyncallback/dyncall_args.c +19 -15
- data/dyncall/dyncallback/dyncall_args.h +1 -1
- data/dyncall/dyncallback/{dyncall_args_arm32_arm.c → dyncall_args_arm32.c} +4 -4
- data/dyncall/dyncallback/{dyncall_args_arm32_arm.h → dyncall_args_arm32.h} +6 -6
- data/dyncall/dyncallback/dyncall_args_arm64.c +2 -2
- data/dyncall/dyncallback/dyncall_args_arm64_apple.c +2 -2
- data/dyncall/dyncallback/dyncall_args_mips.c +26 -21
- data/dyncall/dyncallback/dyncall_args_mips.h +18 -6
- data/dyncall/dyncallback/dyncall_args_mips64.c +81 -0
- data/dyncall/dyncallback/dyncall_args_mips_o32.c +104 -0
- data/dyncall/dyncallback/dyncall_args_ppc32.c +2 -2
- data/dyncall/dyncallback/dyncall_args_ppc32.h +1 -1
- data/dyncall/dyncallback/dyncall_args_ppc32_sysv.c +1 -1
- data/dyncall/dyncallback/dyncall_args_ppc64.c +24 -3
- data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -15
- data/dyncall/dyncallback/dyncall_args_sparc32.h +2 -2
- data/dyncall/dyncallback/dyncall_args_sparc64.c +28 -15
- data/dyncall/dyncallback/dyncall_args_sparc64.h +7 -3
- data/dyncall/dyncallback/dyncall_args_x64.c +1 -1
- data/dyncall/dyncallback/dyncall_args_x64.h +1 -1
- data/dyncall/dyncallback/dyncall_args_x86.c +1 -1
- data/dyncall/dyncallback/dyncall_args_x86.h +1 -1
- data/dyncall/dyncallback/dyncall_callback.c +10 -12
- data/dyncall/dyncallback/dyncall_callback.h +2 -4
- data/dyncall/dyncallback/dyncall_callback_arch.S +12 -2
- data/dyncall/dyncallback/{dyncall_callback_arm32_arm.c → dyncall_callback_arm32.c} +25 -10
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +7 -7
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.S +9 -9
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.S +1 -1
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.S +1 -1
- data/dyncall/dyncallback/dyncall_callback_arm64.S +2 -2
- data/dyncall/dyncallback/dyncall_callback_arm64.c +20 -14
- data/dyncall/dyncallback/dyncall_callback_mips.c +26 -9
- data/dyncall/dyncallback/dyncall_callback_mips_eabi_gas.s +99 -0
- data/dyncall/dyncallback/{dyncall_args_arm32_thumb.h → dyncall_callback_mips_gas.S} +14 -9
- data/dyncall/dyncallback/{dyncall_callback_arm32_thumb.c → dyncall_callback_mips_n32_gas.s} +12 -7
- data/dyncall/dyncallback/dyncall_callback_mips_n64_gas.s +98 -0
- data/dyncall/dyncallback/dyncall_callback_mips_o32_gas.s +100 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.S +54 -54
- data/dyncall/dyncallback/dyncall_callback_ppc32.c +23 -5
- data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +92 -117
- data/dyncall/dyncallback/dyncall_callback_ppc64.S +2 -2
- data/dyncall/dyncallback/dyncall_callback_ppc64.c +23 -5
- data/dyncall/dyncallback/dyncall_callback_sparc32.c +25 -7
- data/dyncall/dyncallback/dyncall_callback_sparc32.s +55 -4
- data/dyncall/dyncallback/dyncall_callback_sparc64.c +25 -7
- data/dyncall/dyncallback/dyncall_callback_sparc64.s +89 -5
- data/dyncall/dyncallback/dyncall_callback_x64.S +8 -8
- data/dyncall/dyncallback/dyncall_callback_x64.c +19 -6
- data/dyncall/dyncallback/dyncall_callback_x86.S +29 -25
- data/dyncall/dyncallback/dyncall_callback_x86.c +24 -11
- data/dyncall/dyncallback/dyncall_thunk.c +6 -6
- data/dyncall/dyncallback/dyncall_thunk.h +9 -7
- data/dyncall/dyncallback/{dyncall_thunk_arm32_arm.c → dyncall_thunk_arm32.c} +5 -3
- data/dyncall/dyncallback/{dyncall_thunk_arm32_arm.h → dyncall_thunk_arm32.h} +7 -7
- data/dyncall/dyncallback/dyncall_thunk_arm64.c +2 -2
- data/dyncall/dyncallback/dyncall_thunk_arm64.h +8 -13
- data/dyncall/dyncallback/dyncall_thunk_mips.c +16 -20
- data/dyncall/dyncallback/dyncall_thunk_mips.h +4 -2
- data/dyncall/dyncallback/dyncall_thunk_mips64.c +103 -0
- data/dyncall/dyncallback/{dyncall_callback_arm32_thumb.h → dyncall_thunk_mips64.h} +15 -8
- data/dyncall/dyncallback/dyncall_thunk_ppc32.c +4 -4
- data/dyncall/dyncallback/dyncall_thunk_ppc32.h +1 -1
- data/dyncall/dyncallback/dyncall_thunk_ppc32_sysv.c +9 -9
- data/dyncall/dyncallback/dyncall_thunk_ppc64.c +2 -2
- data/dyncall/dyncallback/dyncall_thunk_sparc32.c +19 -2
- data/dyncall/dyncallback/dyncall_thunk_sparc32.h +5 -4
- data/dyncall/dyncallback/dyncall_thunk_sparc64.c +42 -2
- data/dyncall/dyncallback/dyncall_thunk_sparc64.h +5 -5
- data/dyncall/dyncallback/dyncall_thunk_x64.c +1 -1
- data/dyncall/dyncallback/dyncall_thunk_x64.h +2 -2
- data/dyncall/dyncallback/dyncall_thunk_x86.c +1 -1
- data/dyncall/dyncallback/dyncall_thunk_x86.h +2 -2
- data/dyncall/dyncallback/dyncallback.3 +16 -11
- data/dyncall/dynload/dynload.3 +63 -8
- data/dyncall/dynload/dynload.c +2 -8
- data/dyncall/dynload/dynload.h +9 -5
- data/dyncall/dynload/dynload_alloc.h +1 -1
- data/dyncall/dynload/dynload_syms.c +1 -3
- data/dyncall/dynload/dynload_syms_elf.c +19 -11
- data/dyncall/dynload/dynload_syms_mach-o.c +151 -75
- data/dyncall/dynload/dynload_syms_pe.c +24 -24
- data/dyncall/dynload/dynload_unix.c +156 -13
- data/dyncall/dynload/dynload_windows.c +15 -11
- data/dyncall/portasm/portasm-arm.S +1 -1
- data/dyncall/portasm/portasm-ppc.S +1 -1
- data/dyncall/portasm/{portasm-x64-att.S → portasm-x64.S} +7 -4
- data/dyncall/portasm/portasm-x86.S +4 -2
- data/{dyncall-bindings/ruby/rbdc/extconf.rb → extconf.rb} +4 -4
- data/{dyncall-bindings/ruby/rbdc/rbdc.c → rbdc.c} +5 -5
- metadata +24 -48
- data/dyncall/Makefile.M +0 -15
- data/dyncall/buildsys/dynmake/Makefile.base.M +0 -82
- data/dyncall/buildsys/dynmake/dynmake.bat +0 -2
- data/dyncall/buildsys/dynmake/dynmake.sh +0 -4
- data/dyncall/dynMakefile +0 -4
- data/dyncall/dyncall/Makefile.M +0 -10
- data/dyncall/dyncall/TODO +0 -9
- data/dyncall/dyncall/dynMakefile +0 -4
- data/dyncall/dyncall/dyncall_call_sparc64.S +0 -362
- data/dyncall/dyncall/dyncall_call_sparc_v9.S +0 -222
- data/dyncall/dyncall/dyncall_call_x64-att.S +0 -147
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +0 -182
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +0 -46
- data/dyncall/dyncallback/Makefile.M +0 -10
- data/dyncall/dyncallback/README.txt +0 -9
- data/dyncall/dyncallback/TODO +0 -4
- data/dyncall/dyncallback/dynMakefile +0 -4
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +0 -30
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +0 -46
- data/dyncall/dyncallback/dyncall_callback_mips.h +0 -43
- data/dyncall/dyncallback/dyncall_callback_ppc32.h +0 -43
- data/dyncall/dyncallback/dyncall_callback_ppc64.h +0 -56
- data/dyncall/dyncallback/dyncall_callback_sparc32.h +0 -44
- data/dyncall/dyncallback/dyncall_callback_x64.h +0 -45
- data/dyncall/dyncallback/dyncall_callback_x86.h +0 -50
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +0 -30
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +0 -36
- data/dyncall/dynload/Makefile.M +0 -10
- data/dyncall/dynload/TODO +0 -20
- data/dyncall/dynload/dynMakefile +0 -4
- data/dyncall/dynload/dynload_darwin.c +0 -90
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -33,23 +33,6 @@
|
|
33
33
|
#include "dyncall_alloc.h"
|
34
34
|
#include "dyncall_struct.h"
|
35
35
|
|
36
|
-
static DCCallVM* dc_callvm_new_x64(DCCallVM_vt* vt, DCsize size)
|
37
|
-
{
|
38
|
-
DCCallVM_x64* self = (DCCallVM_x64*)dcAllocMem(sizeof(DCCallVM_x64)+size);
|
39
|
-
|
40
|
-
dc_callvm_base_init(&self->mInterface, vt);
|
41
|
-
|
42
|
-
/* Since we store register parameters in DCCallVM_x64 directly, adjust the stack size. */
|
43
|
-
size -= sizeof(DCRegData_x64);
|
44
|
-
size = (((signed long)size) < 0) ? 0 : size;
|
45
|
-
|
46
|
-
|
47
|
-
self->mRegCount.i = self->mRegCount.f = 0;
|
48
|
-
|
49
|
-
dcVecInit(&self->mVecHead, size);
|
50
|
-
return (DCCallVM*)self;
|
51
|
-
}
|
52
|
-
|
53
36
|
|
54
37
|
static void dc_callvm_free_x64(DCCallVM* in_self)
|
55
38
|
{
|
@@ -61,20 +44,7 @@ static void dc_callvm_reset_x64(DCCallVM* in_self)
|
|
61
44
|
{
|
62
45
|
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
63
46
|
dcVecReset(&self->mVecHead);
|
64
|
-
self->mRegCount.i = self->mRegCount.f =
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
|
-
static void dc_callvm_mode_x64(DCCallVM* self, DCint mode)
|
69
|
-
{
|
70
|
-
switch(mode) {
|
71
|
-
case DC_CALL_C_DEFAULT:
|
72
|
-
case DC_CALL_C_ELLIPSIS:
|
73
|
-
break;
|
74
|
-
default:
|
75
|
-
self->mError = DC_ERROR_UNSUPPORTED_MODE;
|
76
|
-
break;
|
77
|
-
}
|
47
|
+
self->mRegCount.i = self->mRegCount.f = 0;
|
78
48
|
}
|
79
49
|
|
80
50
|
|
@@ -188,6 +158,8 @@ void dc_callvm_call_x64(DCCallVM* in_self, DCpointer target)
|
|
188
158
|
}
|
189
159
|
|
190
160
|
|
161
|
+
static void dc_callvm_mode_x64(DCCallVM* in_self, DCint mode);
|
162
|
+
|
191
163
|
DCCallVM_vt gVT_x64 =
|
192
164
|
{
|
193
165
|
&dc_callvm_free_x64
|
@@ -216,14 +188,43 @@ DCCallVM_vt gVT_x64 =
|
|
216
188
|
, NULL /* callStruct */
|
217
189
|
};
|
218
190
|
|
219
|
-
|
220
|
-
DCCallVM*
|
191
|
+
/* mode: only a single mode available currently. */
|
192
|
+
static void dc_callvm_mode_x64(DCCallVM* in_self, DCint mode)
|
221
193
|
{
|
222
|
-
|
194
|
+
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
195
|
+
DCCallVM_vt* vt;
|
196
|
+
|
197
|
+
switch(mode) {
|
198
|
+
case DC_CALL_C_DEFAULT:
|
199
|
+
#if defined(DC_UNIX)
|
200
|
+
case DC_CALL_C_X64_SYSV:
|
201
|
+
#else
|
202
|
+
case DC_CALL_C_X64_WIN64:
|
203
|
+
#endif
|
204
|
+
case DC_CALL_C_ELLIPSIS:
|
205
|
+
case DC_CALL_C_ELLIPSIS_VARARGS:
|
206
|
+
vt = &gVT_x64;
|
207
|
+
break;
|
208
|
+
default:
|
209
|
+
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
210
|
+
return;
|
211
|
+
}
|
212
|
+
dc_callvm_base_init(&self->mInterface, vt);
|
223
213
|
}
|
224
214
|
|
215
|
+
/* Public API. */
|
225
216
|
DCCallVM* dcNewCallVM(DCsize size)
|
226
217
|
{
|
227
|
-
|
218
|
+
DCCallVM_x64* p = (DCCallVM_x64*)dcAllocMem(sizeof(DCCallVM_x64)+size);
|
219
|
+
|
220
|
+
dc_callvm_mode_x64((DCCallVM*)p, DC_CALL_C_DEFAULT);
|
221
|
+
|
222
|
+
/* Since we store register parameters in DCCallVM_x64 directly, adjust the stack size. */
|
223
|
+
size -= sizeof(DCRegData_x64);
|
224
|
+
size = (((signed long)size) < 0) ? 0 : size;
|
225
|
+
dcVecInit(&p->mVecHead, size);
|
226
|
+
dc_callvm_reset_x64((DCCallVM*)p);
|
227
|
+
|
228
|
+
return (DCCallVM*)p;
|
228
229
|
}
|
229
230
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -105,8 +105,5 @@ typedef struct
|
|
105
105
|
DCVecHead mVecHead; /* Parameters to be pushed onto stack. */
|
106
106
|
} DCCallVM_x64;
|
107
107
|
|
108
|
-
DCCallVM* dcNewCallVM_x64(DCsize size);
|
109
|
-
|
110
|
-
|
111
108
|
#endif /* DYNCALL_CALLVM_X64_H */
|
112
109
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Call VM for x86 architecture implementation
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -31,19 +31,6 @@
|
|
31
31
|
|
32
32
|
void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode);
|
33
33
|
|
34
|
-
/* call vm allocator */
|
35
|
-
|
36
|
-
static DCCallVM* dc_callvm_new_x86(DCCallVM_vt* vt, DCsize size)
|
37
|
-
{
|
38
|
-
DCCallVM_x86* self = (DCCallVM_x86*) dcAllocMem( sizeof(DCCallVM_x86)+size );
|
39
|
-
|
40
|
-
dc_callvm_base_init(&self->mInterface, vt);
|
41
|
-
|
42
|
-
self->mIntRegs = 0;
|
43
|
-
dcVecInit(&self->mVecHead, size);
|
44
|
-
return (DCCallVM*) self;
|
45
|
-
}
|
46
|
-
|
47
34
|
/* call vm destructor */
|
48
35
|
|
49
36
|
static void dc_callvm_free_x86(DCCallVM* in_self)
|
@@ -186,11 +173,6 @@ DCCallVM_vt gVT_x86_plan9 =
|
|
186
173
|
, NULL /* callStruct */
|
187
174
|
};
|
188
175
|
|
189
|
-
DCCallVM* dcNewCallVM_x86_plan9(DCsize size)
|
190
|
-
{
|
191
|
-
return dc_callvm_new_x86( &gVT_x86_plan9, size );
|
192
|
-
}
|
193
|
-
|
194
176
|
|
195
177
|
#else
|
196
178
|
|
@@ -231,11 +213,6 @@ DCCallVM_vt gVT_x86_cdecl =
|
|
231
213
|
, NULL /* callStruct */
|
232
214
|
};
|
233
215
|
|
234
|
-
DCCallVM* dcNewCallVM_x86_cdecl(DCsize size)
|
235
|
-
{
|
236
|
-
return dc_callvm_new_x86( &gVT_x86_cdecl, size );
|
237
|
-
}
|
238
|
-
|
239
216
|
|
240
217
|
|
241
218
|
/* --- stdcall -------------------------------------------------------------- */
|
@@ -278,12 +255,6 @@ DCCallVM_vt gVT_x86_win32_std =
|
|
278
255
|
, NULL /* callStruct */
|
279
256
|
};
|
280
257
|
|
281
|
-
/* win32/std callvm allocator */
|
282
|
-
|
283
|
-
DCCallVM* dcNewCallVM_x86_win32_std(DCsize size)
|
284
|
-
{
|
285
|
-
return dc_callvm_new_x86( &gVT_x86_win32_std, size );
|
286
|
-
}
|
287
258
|
|
288
259
|
/* --- fastcall common (ms/gnu) -------------------------------------------- */
|
289
260
|
|
@@ -389,10 +360,6 @@ DCCallVM_vt gVT_x86_win32_fast_ms =
|
|
389
360
|
, NULL /* callStruct */
|
390
361
|
};
|
391
362
|
|
392
|
-
DCCallVM* dcNewCallVM_x86_win32_fast_ms(DCsize size)
|
393
|
-
{
|
394
|
-
return dc_callvm_new_x86( &gVT_x86_win32_fast_ms, size );
|
395
|
-
}
|
396
363
|
|
397
364
|
/* --- gnu fastcall -------------------------------------------------------- */
|
398
365
|
|
@@ -487,10 +454,6 @@ DCCallVM_vt gVT_x86_win32_fast_gnu =
|
|
487
454
|
, NULL /* callStruct */
|
488
455
|
};
|
489
456
|
|
490
|
-
DCCallVM* dcNewCallVM_x86_win32_fast_gnu(DCsize size)
|
491
|
-
{
|
492
|
-
return dc_callvm_new_x86( &gVT_x86_win32_fast_gnu, size );
|
493
|
-
}
|
494
457
|
|
495
458
|
/* --- this ms ------------------------------------------------------------- */
|
496
459
|
|
@@ -605,13 +568,6 @@ DCCallVM_vt gVT_x86_sys_int80h_bsd =
|
|
605
568
|
};
|
606
569
|
|
607
570
|
|
608
|
-
/* win32/this/ms callvm allocator */
|
609
|
-
|
610
|
-
DCCallVM* dcNewCallVM_x86_win32_this_ms(DCsize size)
|
611
|
-
{
|
612
|
-
return dc_callvm_new_x86( &gVT_x86_win32_this_ms, size );
|
613
|
-
}
|
614
|
-
|
615
571
|
#endif
|
616
572
|
|
617
573
|
|
@@ -619,13 +575,15 @@ DCCallVM* dcNewCallVM_x86_win32_this_ms(DCsize size)
|
|
619
575
|
|
620
576
|
void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode)
|
621
577
|
{
|
622
|
-
DCCallVM_x86* self = (DCCallVM_x86*)
|
623
|
-
DCCallVM_vt*
|
578
|
+
DCCallVM_x86* self = (DCCallVM_x86*)in_self;
|
579
|
+
DCCallVM_vt* vt;
|
580
|
+
|
624
581
|
switch(mode) {
|
582
|
+
case DC_CALL_C_DEFAULT:
|
625
583
|
case DC_CALL_C_ELLIPSIS:
|
626
584
|
case DC_CALL_C_ELLIPSIS_VARARGS:
|
627
|
-
|
628
|
-
#if defined(DC_PLAN9)
|
585
|
+
/* Plan9 (and forks) have their own calling convention (and no support for foreign ones). */
|
586
|
+
#if defined(DC_PLAN9)
|
629
587
|
case DC_CALL_C_X86_PLAN9: vt = &gVT_x86_plan9; break;
|
630
588
|
#else
|
631
589
|
case DC_CALL_C_X86_CDECL: vt = &gVT_x86_cdecl; break;
|
@@ -639,30 +597,31 @@ void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode)
|
|
639
597
|
# if defined DC__OS_Linux
|
640
598
|
vt = &gVT_x86_sys_int80h_linux; break;
|
641
599
|
# else
|
642
|
-
vt = &gVT_x86_sys_int80h_bsd;
|
600
|
+
vt = &gVT_x86_sys_int80h_bsd; break;
|
643
601
|
# endif
|
644
602
|
# else
|
645
603
|
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return;
|
646
604
|
# endif
|
647
|
-
case DC_CALL_SYS_X86_INT80H_LINUX:
|
648
|
-
|
649
|
-
case DC_CALL_SYS_X86_INT80H_BSD:
|
650
|
-
vt = &gVT_x86_sys_int80h_bsd; break;
|
605
|
+
case DC_CALL_SYS_X86_INT80H_LINUX: vt = &gVT_x86_sys_int80h_linux; break;
|
606
|
+
case DC_CALL_SYS_X86_INT80H_BSD: vt = &gVT_x86_sys_int80h_bsd; break;
|
651
607
|
#endif
|
652
608
|
default:
|
653
|
-
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
609
|
+
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
610
|
+
return;
|
654
611
|
}
|
655
|
-
self->mInterface
|
612
|
+
dc_callvm_base_init(&self->mInterface, vt);
|
656
613
|
}
|
657
614
|
|
658
|
-
/*
|
659
|
-
|
615
|
+
/* Public API. */
|
660
616
|
DCCallVM* dcNewCallVM(DCsize size)
|
661
617
|
{
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
618
|
+
DCCallVM_x86* p = (DCCallVM_x86*)dcAllocMem(sizeof(DCCallVM_x86)+size);
|
619
|
+
|
620
|
+
dc_callvm_mode_x86((DCCallVM*)p, DC_CALL_C_DEFAULT);
|
621
|
+
|
622
|
+
dcVecInit(&p->mVecHead, size);
|
623
|
+
dc_callvm_reset_x86((DCCallVM*)p);
|
624
|
+
|
625
|
+
return (DCCallVM*)p;
|
667
626
|
}
|
668
627
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Call virtual machine for x86 architecture header
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -56,21 +56,5 @@ struct DCCallVM_x86_
|
|
56
56
|
DCVecHead mVecHead;
|
57
57
|
};
|
58
58
|
|
59
|
-
/* Plan9 has no support for OS foreign calling conventions at
|
60
|
-
the time, and vice-versa. */
|
61
|
-
#if defined(DC__OS_Plan9)
|
62
|
-
|
63
|
-
DCCallVM* dcNewCallVM_x86_plan9(DCsize size);
|
64
|
-
|
65
|
-
#else
|
66
|
-
|
67
|
-
DCCallVM* dcNewCallVM_x86_cdecl(DCsize size);
|
68
|
-
DCCallVM* dcNewCallVM_x86_win32_std(DCsize size);
|
69
|
-
DCCallVM* dcNewCallVM_x86_win32_fast_ms(DCsize size);
|
70
|
-
DCCallVM* dcNewCallVM_x86_win32_fast_gnu(DCsize size);
|
71
|
-
DCCallVM* dcNewCallVM_x86_win32_this_ms(DCsize size);
|
72
|
-
|
73
|
-
#endif
|
74
|
-
|
75
59
|
#endif /* DYNCALL_CALLVM_X86_H */
|
76
60
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Macro configuration file for non-standard C types
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Platform detection macros
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
|
10
10
|
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
@@ -72,7 +72,7 @@
|
|
72
72
|
#define DC__OS_Linux
|
73
73
|
|
74
74
|
/* The most powerful open source Unix-like OS - FreeBSD. */
|
75
|
-
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
75
|
+
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* latter is (also) used by systems using FreeBSD kernel, e.g. Debian/kFreeBSD, which could be detected specifically by also checking for __GLIBC__ */
|
76
76
|
#define DC__OS_FreeBSD
|
77
77
|
|
78
78
|
/* The most secure open source Unix-like OS - OpenBSD. */
|
@@ -123,7 +123,9 @@
|
|
123
123
|
#define DC__OS_Minix
|
124
124
|
|
125
125
|
#else
|
126
|
-
|
126
|
+
|
127
|
+
/* Unable to determine OS, which is probably ok (e.g. baremetal stuff, etc.). */
|
128
|
+
#define DC__OS_UNKNOWN
|
127
129
|
#endif
|
128
130
|
|
129
131
|
|
@@ -140,7 +142,7 @@
|
|
140
142
|
#define DC__C_MSVC
|
141
143
|
|
142
144
|
/* LLVM clang. */
|
143
|
-
#elif defined(__clang__)
|
145
|
+
#elif defined(__clang__) || defined(__llvm__)
|
144
146
|
#define DC__C_CLANG
|
145
147
|
|
146
148
|
/* The GNU Compiler Collection - GCC. */
|
@@ -191,11 +193,12 @@
|
|
191
193
|
# define DC__Arch_ARM64
|
192
194
|
#elif defined(__sh__)
|
193
195
|
# define DC__Arch_SuperH
|
194
|
-
#elif defined(
|
195
|
-
|
196
|
-
#
|
197
|
-
#
|
198
|
-
#
|
196
|
+
#elif defined(__sparc) || defined(__sparc__)
|
197
|
+
# if defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || defined(__arch64__)
|
198
|
+
# define DC__Arch_Sparc64
|
199
|
+
# else
|
200
|
+
# define DC__Arch_Sparc
|
201
|
+
# endif
|
199
202
|
#endif
|
200
203
|
|
201
204
|
|
@@ -237,13 +240,14 @@
|
|
237
240
|
#if defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
|
238
241
|
# if defined(_ABIO32) || defined(_MIPS_ARCH_MIPS1) || defined(_MIPS_ARCH_MIPS2)
|
239
242
|
# define DC__ABI_MIPS_O32
|
243
|
+
# elif defined(_ABI64) || defined(_mips_n64)
|
244
|
+
# define DC__ABI_MIPS_N64
|
240
245
|
# elif defined(_ABIN32)
|
241
246
|
# define DC__ABI_MIPS_N32
|
242
|
-
# elif defined(_ABI64)
|
243
|
-
# define DC__ABI_MIPS_N64
|
244
247
|
# else
|
245
248
|
# define DC__ABI_MIPS_EABI
|
246
249
|
# endif
|
250
|
+
/*@@@implement/support: __mips_hard_float*/
|
247
251
|
#endif /* MIPS */
|
248
252
|
|
249
253
|
#if defined(DC__Arch_PPC64)
|
@@ -252,37 +256,42 @@
|
|
252
256
|
# else
|
253
257
|
# define DC__ABI_PPC64_ELF_V 0 /* 0 means not explicitly set, otherwise this is 1 (big endian) and 2 (little endian) */
|
254
258
|
# endif
|
255
|
-
#endif /*
|
259
|
+
#endif /* PPC64 */
|
256
260
|
|
257
261
|
|
258
262
|
/* Endian detection. */
|
259
263
|
#if defined(DC__Arch_Intel_x86) || defined(DC__Arch_AMD64) /* always little */
|
260
264
|
# define DC__Endian_LITTLE
|
261
|
-
#elif defined(DC__Arch_Sparc) /*always big until v9*/
|
265
|
+
#elif defined(DC__Arch_Sparc) /* always purely big until v9 */
|
262
266
|
# define DC__Endian_BIG
|
263
267
|
#else /* all others are bi-endian */
|
264
268
|
/* @@@check flags used on following bi-endianness archs:
|
265
269
|
DC__Arch_ARM
|
266
270
|
DC__Arch_ARM64
|
267
271
|
DC__Arch_Itanium
|
268
|
-
DC__Arch_MIPS
|
269
|
-
DC__Arch_MIPS64
|
270
272
|
DC__Arch_PPC32
|
271
273
|
DC__Arch_PPC64
|
272
|
-
DC__Arch_Sparcv9
|
273
274
|
DC__Arch_SuperH
|
274
275
|
*/
|
275
|
-
# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(MIPSEB)
|
276
|
+
# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
|
276
277
|
# define DC__Endian_BIG
|
277
|
-
# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(MIPSEL)
|
278
|
+
# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
|
278
279
|
# define DC__Endian_LITTLE
|
280
|
+
# elif defined(DC__Arch_Sparc64) && !defined(__BYTE_ORDER__) /* Sparc64 default is big-endian, except if explicitly defined */
|
281
|
+
# define DC__Endian_BIG
|
282
|
+
# elif defined(__BYTE_ORDER__) /* explicitly set */
|
283
|
+
# if defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
284
|
+
# define DC__Endian_BIG
|
285
|
+
# elif defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
286
|
+
# define DC__Endian_LITTLE
|
287
|
+
# endif
|
279
288
|
# endif /* no else, leave unset if not sure */
|
280
289
|
#endif
|
281
290
|
|
282
291
|
|
283
292
|
/* Internal macro/tag. */
|
284
293
|
#if !defined(DC_API)
|
285
|
-
#define DC_API
|
294
|
+
# define DC_API
|
286
295
|
#endif
|
287
296
|
|
288
297
|
#endif /* DYNCALL_MACROS_H */
|