rbdc 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/dyncall/CMakeLists.txt +3 -3
- data/dyncall/ChangeLog +33 -0
- data/dyncall/ChangeLog.orig +274 -0
- data/dyncall/LICENSE +1 -1
- data/dyncall/README +3 -5
- data/dyncall/ToDo +27 -18
- data/dyncall/ToDo.orig +201 -0
- data/dyncall/autovar/autovar_ARCH.h +1 -1
- data/dyncall/buildsys/vs2005/vs2005.sln +0 -9
- data/dyncall/cconv.lang +36 -0
- data/dyncall/configure +17 -9
- data/dyncall/configure.bat +1 -1
- data/dyncall/dyncall/dyncall.h +2 -1
- data/dyncall/dyncall/dyncall_call.S +9 -1
- data/dyncall/dyncall/dyncall_call_mips_n32.S +192 -0
- data/dyncall/dyncall/dyncall_call_mips_n64.S +197 -0
- data/dyncall/dyncall/dyncall_call_mips_n64.h +2 -0
- data/dyncall/dyncall/{dyncall_call_mips_o32_gas.s → dyncall_call_mips_o32.S} +44 -42
- data/dyncall/dyncall/dyncall_call_mips_o32.h +8 -3
- data/dyncall/dyncall/dyncall_call_ppc32.S +3 -1
- data/dyncall/dyncall/dyncall_call_ppc32.h +4 -3
- data/dyncall/dyncall/dyncall_call_ppc64.S +1 -1
- data/dyncall/dyncall/dyncall_call_ppc64.h +3 -0
- data/dyncall/dyncall/dyncall_call_x64.S +27 -2
- data/dyncall/dyncall/dyncall_call_x64.h +2 -1
- data/dyncall/dyncall/dyncall_call_x64_generic_masm.asm +13 -2
- data/dyncall/dyncall/dyncall_call_x86.S +6 -6
- data/dyncall/dyncall/dyncall_call_x86.h +7 -7
- data/dyncall/dyncall/dyncall_call_x86_generic_masm.asm +6 -7
- data/dyncall/dyncall/dyncall_callvm_mips_n64.c +27 -9
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c +38 -31
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c.orig +247 -0
- data/dyncall/dyncall/dyncall_callvm_x64.c +57 -3
- data/dyncall/dyncall/dyncall_callvm_x86.c +32 -32
- data/dyncall/dyncall/dyncall_macros.h +11 -8
- data/dyncall/dyncall/dyncall_struct.c +12 -6
- data/dyncall/dyncall/dyncall_struct.h +1 -1
- data/dyncall/dyncall/dyncall_vector.c +13 -12
- data/dyncall/dyncall/dyncall_vector.c.orig +53 -0
- data/dyncall/dyncall/gen-masm.sh +4 -5
- data/dyncall/dyncallback/dyncall_args_mips.h +24 -6
- data/dyncall/dyncallback/dyncall_args_mips64.c +3 -3
- data/dyncall/dyncallback/dyncall_args_mips_o32.c +19 -6
- data/dyncall/dyncallback/dyncall_callback_arch.S +11 -1
- data/dyncall/dyncallback/{dyncall_callback_mips_n32_gas.s → dyncall_callback_mips_n32.S} +1 -1
- data/dyncall/dyncallback/{dyncall_callback_mips_n64_gas.s → dyncall_callback_mips_n64.S} +39 -25
- data/dyncall/dyncallback/{dyncall_callback_mips_o32_gas.s → dyncall_callback_mips_o32.S} +29 -13
- data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +0 -1
- data/dyncall/dyncallback/dyncall_thunk.h +1 -1
- data/dyncall/dyncallback/gen-masm.sh +3 -5
- data/dyncall/dynload/dynload.3 +16 -4
- data/dyncall/dynload/dynload_unix.c +101 -53
- data/dyncall/dynload/dynload_windows.c +76 -3
- data/dyncall/portasm/README.txt +1 -1
- data/dyncall/portasm/gen-masm.sh +5 -1
- metadata +14 -13
- data/dyncall/buildsys/vs2005/test_plain/test_plain.vcproj +0 -202
- data/dyncall/dyncall/dyncall_call_mips_gas.S +0 -37
- data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +0 -192
- data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +0 -192
- data/dyncall/dyncallback/dyncall_callback_mips_gas.S +0 -38
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2020 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
|
@@ -167,7 +167,7 @@ DCCallVM_vt gVT_x64 =
|
|
167
167
|
, &dc_callvm_mode_x64
|
168
168
|
, &dc_callvm_argBool_x64
|
169
169
|
, &dc_callvm_argChar_x64
|
170
|
-
, &dc_callvm_argShort_x64
|
170
|
+
, &dc_callvm_argShort_x64
|
171
171
|
, &dc_callvm_argInt_x64
|
172
172
|
, &dc_callvm_argLong_x64
|
173
173
|
, &dc_callvm_argLongLong_x64
|
@@ -188,7 +188,54 @@ DCCallVM_vt gVT_x64 =
|
|
188
188
|
, NULL /* callStruct */
|
189
189
|
};
|
190
190
|
|
191
|
-
|
191
|
+
|
192
|
+
/* --- syscall ------------------------------------------------------------- */
|
193
|
+
|
194
|
+
#include <assert.h>
|
195
|
+
void dc_callvm_call_x64_syscall_sysv(DCCallVM* in_self, DCpointer target)
|
196
|
+
{
|
197
|
+
DCCallVM_x64* self;
|
198
|
+
|
199
|
+
/* syscalls can have up to 6 args, required to be "Only values of class INTEGER or class MEMORY" (from */
|
200
|
+
/* SysV manual), so we can use self->mRegData.i directly; verify this has space for at least 6 values, though. */
|
201
|
+
assert(numIntRegs >= 6);
|
202
|
+
|
203
|
+
self = (DCCallVM_x64*)in_self;
|
204
|
+
dcCall_x64_syscall_sysv(self->mRegData.i, target);
|
205
|
+
}
|
206
|
+
|
207
|
+
DCCallVM_vt gVT_x64_syscall_sysv =
|
208
|
+
{
|
209
|
+
&dc_callvm_free_x64
|
210
|
+
, &dc_callvm_reset_x64
|
211
|
+
, &dc_callvm_mode_x64
|
212
|
+
, &dc_callvm_argBool_x64
|
213
|
+
, &dc_callvm_argChar_x64
|
214
|
+
, &dc_callvm_argShort_x64
|
215
|
+
, &dc_callvm_argInt_x64
|
216
|
+
, &dc_callvm_argLong_x64
|
217
|
+
, &dc_callvm_argLongLong_x64
|
218
|
+
, &dc_callvm_argFloat_x64
|
219
|
+
, &dc_callvm_argDouble_x64
|
220
|
+
, &dc_callvm_argPointer_x64
|
221
|
+
, NULL /* argStruct */
|
222
|
+
, (DCvoidvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
223
|
+
, (DCboolvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
224
|
+
, (DCcharvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
225
|
+
, (DCshortvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
226
|
+
, (DCintvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
227
|
+
, (DClongvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
228
|
+
, (DClonglongvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
229
|
+
, (DCfloatvmfunc*) &dc_callvm_call_x64_syscall_sysv
|
230
|
+
, (DCdoublevmfunc*) &dc_callvm_call_x64_syscall_sysv
|
231
|
+
, (DCpointervmfunc*) &dc_callvm_call_x64_syscall_sysv
|
232
|
+
, NULL /* callStruct */
|
233
|
+
};
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
/* mode */
|
238
|
+
|
192
239
|
static void dc_callvm_mode_x64(DCCallVM* in_self, DCint mode)
|
193
240
|
{
|
194
241
|
DCCallVM_x64* self = (DCCallVM_x64*)in_self;
|
@@ -205,6 +252,13 @@ static void dc_callvm_mode_x64(DCCallVM* in_self, DCint mode)
|
|
205
252
|
case DC_CALL_C_ELLIPSIS_VARARGS:
|
206
253
|
vt = &gVT_x64;
|
207
254
|
break;
|
255
|
+
case DC_CALL_SYS_DEFAULT:
|
256
|
+
# if defined DC_UNIX
|
257
|
+
case DC_CALL_SYS_X64_SYSCALL_SYSV:
|
258
|
+
vt = &gVT_x64_syscall_sysv; break;
|
259
|
+
# else
|
260
|
+
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return;
|
261
|
+
# endif
|
208
262
|
default:
|
209
263
|
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
210
264
|
return;
|
@@ -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-2020 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
|
@@ -499,19 +499,19 @@ DCCallVM_vt gVT_x86_win32_this_ms =
|
|
499
499
|
|
500
500
|
/* call syscall */
|
501
501
|
|
502
|
-
void
|
502
|
+
void dc_callvm_call_x86_syscall_int80h_linux(DCCallVM* in_self, DCpointer target)
|
503
503
|
{
|
504
504
|
DCCallVM_x86* self = (DCCallVM_x86*) in_self;
|
505
|
-
|
505
|
+
dcCall_x86_syscall_int80h_linux( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
|
506
506
|
}
|
507
507
|
|
508
|
-
void
|
508
|
+
void dc_callvm_call_x86_syscall_int80h_bsd(DCCallVM* in_self, DCpointer target)
|
509
509
|
{
|
510
510
|
DCCallVM_x86* self = (DCCallVM_x86*) in_self;
|
511
|
-
|
511
|
+
dcCall_x86_syscall_int80h_bsd( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
|
512
512
|
}
|
513
513
|
|
514
|
-
DCCallVM_vt
|
514
|
+
DCCallVM_vt gVT_x86_syscall_int80h_linux =
|
515
515
|
{
|
516
516
|
&dc_callvm_free_x86
|
517
517
|
, &dc_callvm_reset_x86
|
@@ -526,20 +526,20 @@ DCCallVM_vt gVT_x86_sys_int80h_linux =
|
|
526
526
|
, &dc_callvm_argDouble_x86
|
527
527
|
, &dc_callvm_argPointer_x86
|
528
528
|
, NULL /* argStruct */
|
529
|
-
, (DCvoidvmfunc*) &
|
530
|
-
, (DCboolvmfunc*) &
|
531
|
-
, (DCcharvmfunc*) &
|
532
|
-
, (DCshortvmfunc*) &
|
533
|
-
, (DCintvmfunc*) &
|
534
|
-
, (DClongvmfunc*) &
|
535
|
-
, (DClonglongvmfunc*) &
|
536
|
-
, (DCfloatvmfunc*) &
|
537
|
-
, (DCdoublevmfunc*) &
|
538
|
-
, (DCpointervmfunc*) &
|
529
|
+
, (DCvoidvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
530
|
+
, (DCboolvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
531
|
+
, (DCcharvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
532
|
+
, (DCshortvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
533
|
+
, (DCintvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
534
|
+
, (DClongvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
535
|
+
, (DClonglongvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
536
|
+
, (DCfloatvmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
537
|
+
, (DCdoublevmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
538
|
+
, (DCpointervmfunc*) &dc_callvm_call_x86_syscall_int80h_linux
|
539
539
|
, NULL /* callStruct */
|
540
540
|
};
|
541
541
|
|
542
|
-
DCCallVM_vt
|
542
|
+
DCCallVM_vt gVT_x86_syscall_int80h_bsd =
|
543
543
|
{
|
544
544
|
&dc_callvm_free_x86
|
545
545
|
, &dc_callvm_reset_x86
|
@@ -554,16 +554,16 @@ DCCallVM_vt gVT_x86_sys_int80h_bsd =
|
|
554
554
|
, &dc_callvm_argDouble_x86
|
555
555
|
, &dc_callvm_argPointer_x86
|
556
556
|
, NULL /* argStruct */
|
557
|
-
, (DCvoidvmfunc*) &
|
558
|
-
, (DCboolvmfunc*) &
|
559
|
-
, (DCcharvmfunc*) &
|
560
|
-
, (DCshortvmfunc*) &
|
561
|
-
, (DCintvmfunc*) &
|
562
|
-
, (DClongvmfunc*) &
|
563
|
-
, (DClonglongvmfunc*) &
|
564
|
-
, (DCfloatvmfunc*) &
|
565
|
-
, (DCdoublevmfunc*) &
|
566
|
-
, (DCpointervmfunc*) &
|
557
|
+
, (DCvoidvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
558
|
+
, (DCboolvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
559
|
+
, (DCcharvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
560
|
+
, (DCshortvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
561
|
+
, (DCintvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
562
|
+
, (DClongvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
563
|
+
, (DClonglongvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
564
|
+
, (DCfloatvmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
565
|
+
, (DCdoublevmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
566
|
+
, (DCpointervmfunc*) &dc_callvm_call_x86_syscall_int80h_bsd
|
567
567
|
, NULL /* callStruct */
|
568
568
|
};
|
569
569
|
|
@@ -592,18 +592,18 @@ void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode)
|
|
592
592
|
case DC_CALL_C_X86_WIN32_THIS_MS: vt = &gVT_x86_win32_this_ms; break;
|
593
593
|
case DC_CALL_C_X86_WIN32_FAST_GNU: vt = &gVT_x86_win32_fast_gnu; break;
|
594
594
|
case DC_CALL_C_X86_WIN32_THIS_GNU: vt = &gVT_x86_cdecl; break;
|
595
|
-
case DC_CALL_SYS_DEFAULT:
|
595
|
+
case DC_CALL_SYS_DEFAULT:
|
596
596
|
# if defined DC_UNIX
|
597
597
|
# if defined DC__OS_Linux
|
598
|
-
vt = &
|
598
|
+
vt = &gVT_x86_syscall_int80h_linux; break;
|
599
599
|
# else
|
600
|
-
vt = &
|
600
|
+
vt = &gVT_x86_syscall_int80h_bsd; break;
|
601
601
|
# endif
|
602
602
|
# else
|
603
603
|
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return;
|
604
604
|
# endif
|
605
|
-
case DC_CALL_SYS_X86_INT80H_LINUX: vt = &
|
606
|
-
case DC_CALL_SYS_X86_INT80H_BSD: vt = &
|
605
|
+
case DC_CALL_SYS_X86_INT80H_LINUX: vt = &gVT_x86_syscall_int80h_linux; break;
|
606
|
+
case DC_CALL_SYS_X86_INT80H_BSD: vt = &gVT_x86_syscall_int80h_bsd; break;
|
607
607
|
#endif
|
608
608
|
default:
|
609
609
|
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
@@ -189,7 +189,7 @@
|
|
189
189
|
# define DC__Arch_MIPS
|
190
190
|
#elif defined(__arm__)
|
191
191
|
# define DC__Arch_ARM
|
192
|
-
#elif defined(__aarch64__)
|
192
|
+
#elif defined(__aarch64__) || defined(__arm64) || defined(__arm64__)
|
193
193
|
# define DC__Arch_ARM64
|
194
194
|
#elif defined(__sh__)
|
195
195
|
# define DC__Arch_SuperH
|
@@ -238,16 +238,21 @@
|
|
238
238
|
#endif /* ARM */
|
239
239
|
|
240
240
|
#if defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
|
241
|
-
# if defined(_ABIO32) || defined(_MIPS_ARCH_MIPS1) || defined(_MIPS_ARCH_MIPS2)
|
241
|
+
# if defined(_ABIO32) || defined(__mips_o32) || defined(_MIPS_ARCH_MIPS1) || defined(_MIPS_ARCH_MIPS2)
|
242
242
|
# define DC__ABI_MIPS_O32
|
243
|
-
# elif defined(_ABI64) || defined(
|
243
|
+
# elif defined(_ABI64) || defined(__mips_n64)
|
244
244
|
# define DC__ABI_MIPS_N64
|
245
245
|
# elif defined(_ABIN32)
|
246
246
|
# define DC__ABI_MIPS_N32
|
247
247
|
# else
|
248
248
|
# define DC__ABI_MIPS_EABI
|
249
249
|
# endif
|
250
|
-
|
250
|
+
/* Set extra flag to know if FP hardware ABI, default to yes, if unsure */
|
251
|
+
# if (defined(__mips_hard_float) && (__mips_hard_float == 1)) || !defined(__mips_soft_float) || (__mips_soft_float != 1)
|
252
|
+
# define DC__ABI_HARDFLOAT /* @@@ make this general for all archs? */
|
253
|
+
# else
|
254
|
+
# define DC__ABI_SOFTFLOAT
|
255
|
+
# endif
|
251
256
|
#endif /* MIPS */
|
252
257
|
|
253
258
|
#if defined(DC__Arch_PPC64)
|
@@ -266,16 +271,14 @@
|
|
266
271
|
# define DC__Endian_BIG
|
267
272
|
#else /* all others are bi-endian */
|
268
273
|
/* @@@check flags used on following bi-endianness archs:
|
269
|
-
DC__Arch_ARM
|
270
|
-
DC__Arch_ARM64
|
271
274
|
DC__Arch_Itanium
|
272
275
|
DC__Arch_PPC32
|
273
276
|
DC__Arch_PPC64
|
274
277
|
DC__Arch_SuperH
|
275
278
|
*/
|
276
|
-
# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
|
279
|
+
# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(__ARMEB__) || defined(__AARCH64EB__)
|
277
280
|
# define DC__Endian_BIG
|
278
|
-
# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
|
281
|
+
# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(__ARMEL__) || defined(__AARCH64EL__)
|
279
282
|
# define DC__Endian_LITTLE
|
280
283
|
# elif defined(DC__Arch_Sparc64) && !defined(__BYTE_ORDER__) /* Sparc64 default is big-endian, except if explicitly defined */
|
281
284
|
# define DC__Endian_BIG
|
@@ -54,7 +54,7 @@ void dcStructField(DCstruct* s, DCint type, DCint alignment, DCsize arrayLength)
|
|
54
54
|
return;
|
55
55
|
}
|
56
56
|
assert(s && s->pCurrentStruct);
|
57
|
-
assert(s->pCurrentStruct->nextField
|
57
|
+
assert(s->pCurrentStruct->nextField < (DCint)s->pCurrentStruct->fieldCount);
|
58
58
|
f = s->pCurrentStruct->pFields + (s->pCurrentStruct->nextField++);
|
59
59
|
f->type = type;
|
60
60
|
f->alignment = alignment;
|
@@ -107,6 +107,8 @@ static void dcComputeStructSize(DCstruct* s)
|
|
107
107
|
{
|
108
108
|
DCsize i;
|
109
109
|
assert(s);
|
110
|
+
|
111
|
+
/* compute field sizes and alignments, recurse if needed */
|
110
112
|
for (i = 0; i < s->fieldCount; i++) {
|
111
113
|
DCfield *f = s->pFields + i;
|
112
114
|
DCsize fieldAlignment;
|
@@ -114,19 +116,23 @@ static void dcComputeStructSize(DCstruct* s)
|
|
114
116
|
dcComputeStructSize(f->pSubStruct);
|
115
117
|
f->size = f->pSubStruct->size;
|
116
118
|
fieldAlignment = f->pSubStruct->alignment;
|
117
|
-
} else
|
119
|
+
} else
|
118
120
|
fieldAlignment = f->size;
|
119
|
-
|
121
|
+
|
120
122
|
if (!f->alignment)
|
121
123
|
f->alignment = fieldAlignment;
|
122
|
-
|
124
|
+
|
125
|
+
/* if field alignment > struct alignment, choose former */
|
123
126
|
if (f->alignment > s->alignment)
|
124
127
|
s->alignment = f->alignment;
|
125
|
-
|
128
|
+
|
129
|
+
/* if array, it's x times the size */
|
126
130
|
f->size *= f->arrayLength;
|
127
|
-
|
131
|
+
|
128
132
|
/*printf("FIELD %d, size = %d, alignment = %d\n", (int)i, (int)f->size, (int)f->alignment);@@@*/
|
129
133
|
}
|
134
|
+
|
135
|
+
/* compute overall struct size */
|
130
136
|
for (i = 0; i < s->fieldCount; i++) {
|
131
137
|
DCfield *f = s->pFields + i;
|
132
138
|
dcAlign(&s->size, f->alignment);
|
@@ -53,7 +53,7 @@ struct DCstruct_ {
|
|
53
53
|
DCsize size, alignment, fieldCount;
|
54
54
|
|
55
55
|
/* struct building uses a state machine. */
|
56
|
-
DCint nextField;
|
56
|
+
DCint nextField; /* == -1 if struct is closed */
|
57
57
|
DCstruct *pCurrentStruct, *pLastStruct; /* == this, unless we're in a sub struct */
|
58
58
|
};
|
59
59
|
|
@@ -34,18 +34,19 @@ void dcVecAppend(DCVecHead* pHead, const void* pData, size_t size)
|
|
34
34
|
size_t newSize = pHead->mSize + size;
|
35
35
|
if(newSize <= pHead->mTotal)
|
36
36
|
{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
37
|
+
void* dst = (DCchar*)dcVecData(pHead) + pHead->mSize;
|
38
|
+
switch (size) {
|
39
|
+
case 1: *(DCchar *)dst = *(const DCchar *)pData; break;
|
40
|
+
case 2: *(DCshort *)dst = *(const DCshort *)pData; break;
|
41
|
+
case 4: *(DCint *)dst = *(const DCint *)pData; break;
|
42
|
+
case 8: *(DCint *)( ( (char*)dst )+4) = *(const DCint *)( ( (char*)pData )+4);
|
43
|
+
*(DCint *)dst = *(const DCint *)pData; break;
|
44
|
+
/* On sparc 32-bit, this one crashes if ptrs are not aligned, so use above.
|
45
|
+
case 8: *(DClonglong*)dst = *(const DClonglong*)pData; break;
|
46
|
+
*/
|
47
|
+
|
48
|
+
default: memcpy(dst, pData, size); /* for all the rest. */
|
49
|
+
}
|
49
50
|
pHead->mSize = newSize;
|
50
51
|
}
|
51
52
|
/*else @@@ warning? error?*/
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_vector.c
|
6
|
+
Description: Simple dynamic vector container type implementation
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2018 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
|
+
#include "dyncall_vector.h"
|
29
|
+
#include <string.h>
|
30
|
+
|
31
|
+
|
32
|
+
void dcVecAppend(DCVecHead* pHead, const void* pData, size_t size)
|
33
|
+
{
|
34
|
+
size_t newSize = pHead->mSize + size;
|
35
|
+
if(newSize <= pHead->mTotal)
|
36
|
+
{
|
37
|
+
void* dst = (DCchar*)dcVecData(pHead) + pHead->mSize;
|
38
|
+
switch (size) {
|
39
|
+
case 1: *(DCchar *)dst = *(const DCchar *)pData; break;
|
40
|
+
case 2: *(DCshort *)dst = *(const DCshort *)pData; break;
|
41
|
+
case 4: *(DCint *)dst = *(const DCint *)pData; break;
|
42
|
+
case 8: *(DCint *)( ( (char*)dst )+4) = *(const DCint *)( ( (char*)pData )+4);
|
43
|
+
*(DCint *)dst = *(const DCint *)pData; break;
|
44
|
+
/* On sparc 32-bit, this one crashes if ptrs are not aligned.
|
45
|
+
case 8: *(DClonglong*)dst = *(const DClonglong*)pData; break;
|
46
|
+
*/
|
47
|
+
default: memcpy(dst, pData, size); /* for all the rest. */
|
48
|
+
}
|
49
|
+
pHead->mSize = newSize;
|
50
|
+
}
|
51
|
+
/*else @@@ warning? error?*/
|
52
|
+
}
|
53
|
+
|
data/dyncall/dyncall/gen-masm.sh
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/bin/sh
|
2
|
+
cd `dirname $0`
|
3
|
+
|
4
|
+
../portasm/gen-masm.sh dyncall_call_x86 _generic_masm
|
5
|
+
../portasm/gen-masm.sh dyncall_call_x64 _generic_masm
|
2
6
|
|
3
|
-
# Uses portasm to generates MASM sources for intel platforms.
|
4
|
-
printf "; auto-generated by `basename $0`\r\n" > dyncall_call_x86_generic_masm.asm
|
5
|
-
printf "; auto-generated by `basename $0`\r\n" > dyncall_call_x64_generic_masm.asm
|
6
|
-
gcc -E -P -DGEN_MASM dyncall_call_x86.S | awk '{printf "%s\r\n", $0}' >> dyncall_call_x86_generic_masm.asm
|
7
|
-
gcc -E -P -DGEN_MASM dyncall_call_x64.S | awk '{printf "%s\r\n", $0}' >> dyncall_call_x64_generic_masm.asm
|
@@ -33,19 +33,37 @@ struct DCArgs
|
|
33
33
|
{
|
34
34
|
/* Don't change order or types, laid out for asm code to fill in! */
|
35
35
|
#if defined(DC__Arch_MIPS) && defined(DC__ABI_MIPS_O32)
|
36
|
-
|
36
|
+
|
37
|
+
DCint freg_count; /* unused on soft-float targets, but keep as 4b-padding */
|
38
|
+
|
37
39
|
#else
|
40
|
+
|
41
|
+
# if defined(DC__Arch_MIPS)
|
42
|
+
|
38
43
|
# define DCARGS_MIPS_NUM_IREGS 8
|
39
44
|
# define DCARGS_MIPS_NUM_FREGS 8
|
40
|
-
# if defined(DC__Arch_MIPS)
|
41
45
|
DCint ireg_data[DCARGS_MIPS_NUM_IREGS];
|
42
46
|
DCfloat freg_data[DCARGS_MIPS_NUM_FREGS];
|
43
47
|
struct { DCshort i; DCshort f; } reg_count;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
+
|
49
|
+
# elif defined(DC__Arch_MIPS64)
|
50
|
+
|
51
|
+
/* single counter for both, int & float: mips64 uses 8 max, total, either */
|
52
|
+
/* skipping over other/type's reg, or only using int regs on soft-float */
|
53
|
+
# define DCARGS_MIPS_NUM_REGS 8
|
54
|
+
# if defined(DC__ABI_SOFTFLOAT)
|
55
|
+
union
|
56
|
+
# else
|
57
|
+
struct
|
48
58
|
# endif
|
59
|
+
{
|
60
|
+
DClonglong ireg_data[DCARGS_MIPS_NUM_REGS];
|
61
|
+
DCdouble freg_data[DCARGS_MIPS_NUM_REGS];
|
62
|
+
};
|
63
|
+
DClonglong reg_count;
|
64
|
+
|
65
|
+
# endif
|
66
|
+
|
49
67
|
#endif
|
50
68
|
DCuchar* stackptr;
|
51
69
|
};
|