rbdc 0.8.7 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{bindings → dyncall-bindings}/ruby/rbdc/extconf.rb +1 -1
- data/{bindings → dyncall-bindings}/ruby/rbdc/rbdc.c +3 -1
- data/dyncall/AUTHORS +2 -0
- data/dyncall/BUGS +1 -0
- data/dyncall/CMakeLists.txt +10 -2
- data/dyncall/ChangeLog +46 -11
- data/dyncall/LICENSE +4 -1
- data/dyncall/Makefile.embedded +7 -3
- data/dyncall/README +23 -14
- data/dyncall/ToDo +27 -28
- data/dyncall/autovar/autovar_ABI.h +3 -2
- data/dyncall/autovar/autovar_ARCH.h +13 -10
- data/dyncall/autovar/autovar_CC.h +3 -2
- data/dyncall/autovar/autovar_OS.h +3 -2
- data/dyncall/autovar/autovar_OSFAMILY.h +3 -2
- data/dyncall/buildsys/scripts/batch-build-linux.sh +6 -2
- data/dyncall/buildsys/scripts/batch-build-minix.sh +2 -0
- data/dyncall/buildsys/scripts/batch-build-psp.sh +4 -1
- data/dyncall/buildsys/scripts/elf-to-psp-eboot.sh +19 -0
- data/dyncall/buildsys/scripts/setenv-cross-ios.sh +0 -0
- data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +0 -0
- data/dyncall/configure +83 -30
- data/dyncall/dyncall/dyncall.3 +16 -4
- data/dyncall/dyncall/dyncall.h +9 -1
- data/dyncall/dyncall/dyncall_alloc.h +2 -1
- data/dyncall/dyncall/dyncall_api.c +2 -1
- data/dyncall/dyncall/dyncall_call.S +9 -2
- data/dyncall/dyncall/dyncall_call_arm32_arm.S +2 -1
- data/dyncall/dyncall/dyncall_call_arm32_arm.h +8 -2
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +11 -19
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +15 -2
- data/dyncall/dyncall/dyncall_call_arm32_thumb.h +8 -6
- data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +10 -18
- data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +0 -16
- data/dyncall/dyncall/dyncall_call_arm64.S +226 -0
- data/dyncall/dyncall/dyncall_call_arm64.h +45 -0
- data/dyncall/dyncall/dyncall_call_mips.h +2 -1
- data/dyncall/dyncall/dyncall_call_mips_eabi.h +2 -1
- data/dyncall/dyncall/dyncall_call_mips_gas.S +2 -1
- data/dyncall/dyncall/dyncall_call_mips_n32.h +2 -1
- data/dyncall/dyncall/dyncall_call_mips_n64.h +2 -1
- data/dyncall/dyncall/dyncall_call_mips_o32.h +2 -1
- data/dyncall/dyncall/dyncall_call_ppc32.S +27 -2
- data/dyncall/dyncall/dyncall_call_ppc32.h +2 -2
- data/dyncall/dyncall/dyncall_call_ppc64.S +210 -0
- data/dyncall/dyncall/dyncall_call_ppc64.h +55 -0
- data/dyncall/dyncall/dyncall_call_sparc.S +2 -1
- data/dyncall/dyncall/dyncall_call_sparc.h +2 -1
- data/dyncall/dyncall/dyncall_call_sparc64.S +2 -1
- data/dyncall/dyncall/dyncall_call_sparc64.h +2 -1
- data/dyncall/dyncall/dyncall_call_sparc_v9.S +25 -23
- data/dyncall/dyncall/dyncall_call_sparc_v9.h +2 -1
- data/dyncall/dyncall/dyncall_call_x64-att.S +2 -1
- data/dyncall/dyncall/dyncall_call_x64.S +2 -1
- data/dyncall/dyncall/dyncall_call_x64.h +2 -1
- data/dyncall/dyncall/dyncall_call_x86.S +2 -1
- data/dyncall/dyncall/dyncall_call_x86.h +2 -1
- data/dyncall/dyncall/dyncall_callf.c +56 -66
- data/dyncall/dyncall/dyncall_callf.h +5 -1
- data/dyncall/dyncall/dyncall_callvm.c +11 -2
- data/dyncall/dyncall/dyncall_callvm.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +60 -30
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +3 -2
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +2 -24
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_arm64.c +165 -0
- data/dyncall/dyncall/dyncall_callvm_arm64.h +51 -0
- data/dyncall/dyncall/dyncall_callvm_arm64_apple.c +272 -0
- data/dyncall/dyncall/dyncall_callvm_base.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_n32.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_n64.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_n64.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_mips_o32.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_ppc32.c +45 -2
- data/dyncall/dyncall/dyncall_callvm_ppc32.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_ppc64.c +351 -0
- data/dyncall/dyncall/dyncall_callvm_ppc64.h +60 -0
- data/dyncall/dyncall/dyncall_callvm_sparc.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_sparc.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_sparc64.c +2 -2
- data/dyncall/dyncall/dyncall_callvm_sparc64.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +3 -3
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_x64.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_x64.h +2 -1
- data/dyncall/dyncall/dyncall_callvm_x86.c +2 -1
- data/dyncall/dyncall/dyncall_callvm_x86.h +2 -1
- data/dyncall/dyncall/dyncall_config.h +2 -1
- data/dyncall/dyncall/dyncall_macros.h +46 -9
- data/dyncall/dyncall/dyncall_signature.h +2 -1
- data/dyncall/dyncall/dyncall_struct.c +2 -1
- data/dyncall/dyncall/dyncall_struct.h +2 -1
- data/dyncall/dyncall/dyncall_types.h +2 -1
- data/dyncall/dyncall/dyncall_utils.h +2 -1
- data/dyncall/dyncall/dyncall_value.h +19 -1
- data/dyncall/dyncall/dyncall_vector.c +2 -1
- data/dyncall/dyncall/dyncall_vector.h +3 -1
- data/dyncall/dyncall/gen-masm.sh +0 -0
- data/dyncall/dyncallback/Makefile.generic +1 -1
- data/dyncall/dyncallback/dyncall_alloc_wx.c +2 -1
- data/dyncall/dyncallback/dyncall_alloc_wx.h +2 -1
- data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +2 -1
- data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +2 -1
- data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +2 -1
- data/dyncall/dyncallback/dyncall_args.c +22 -10
- data/dyncall/dyncallback/dyncall_args.h +2 -1
- data/dyncall/dyncallback/dyncall_args_arm32_arm.c +35 -4
- data/dyncall/dyncallback/dyncall_args_arm32_arm.h +7 -1
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +2 -1
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +2 -1
- data/dyncall/dyncallback/dyncall_args_arm64.c +77 -0
- data/dyncall/dyncallback/dyncall_args_arm64_apple.c +160 -0
- data/dyncall/dyncallback/dyncall_args_mips.c +3 -2
- data/dyncall/dyncallback/dyncall_args_mips.h +3 -2
- data/dyncall/dyncallback/dyncall_args_ppc32.c +2 -1
- data/dyncall/dyncallback/dyncall_args_ppc32.h +9 -7
- data/dyncall/dyncallback/dyncall_args_ppc32_sysv.c +95 -0
- data/dyncall/dyncallback/dyncall_args_ppc64.c +71 -0
- data/dyncall/dyncallback/dyncall_args_ppc64.h +40 -0
- data/dyncall/dyncallback/dyncall_args_sparc32.c +2 -1
- data/dyncall/dyncallback/dyncall_args_sparc32.h +2 -1
- data/dyncall/dyncallback/dyncall_args_sparc64.c +2 -1
- data/dyncall/dyncallback/dyncall_args_sparc64.h +2 -1
- data/dyncall/dyncallback/dyncall_args_x64.c +2 -1
- data/dyncall/dyncallback/dyncall_args_x64.h +2 -1
- data/dyncall/dyncallback/dyncall_args_x86.c +2 -1
- data/dyncall/dyncallback/dyncall_args_x86.h +2 -1
- data/dyncall/dyncallback/dyncall_callback.c +7 -2
- data/dyncall/dyncallback/dyncall_callback.h +3 -1
- data/dyncall/dyncallback/dyncall_callback_arch.S +14 -6
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +2 -1
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +1 -1
- data/dyncall/dyncallback/{dyncall_callback_arm32_arm_gas.s → dyncall_callback_arm32_arm_gas.S} +17 -7
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +2 -1
- data/dyncall/dyncallback/{dyncall_callback_arm32_thumb_apple.s → dyncall_callback_arm32_thumb_apple.S} +2 -2
- data/dyncall/dyncallback/{dyncall_callback_arm32_thumb_gas.s → dyncall_callback_arm32_thumb_gas.S} +2 -2
- data/dyncall/dyncallback/dyncall_callback_arm64.S +111 -0
- data/dyncall/dyncallback/dyncall_callback_arm64.c +71 -0
- data/dyncall/dyncallback/dyncall_callback_mips.c +3 -2
- data/dyncall/dyncallback/dyncall_callback_mips.h +3 -2
- data/dyncall/dyncallback/dyncall_callback_ppc32.S +115 -4
- data/dyncall/dyncallback/dyncall_callback_ppc32.c +3 -2
- data/dyncall/dyncallback/dyncall_callback_ppc32.h +6 -6
- data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +6 -5
- data/dyncall/dyncallback/dyncall_callback_ppc64.S +170 -0
- data/dyncall/dyncallback/dyncall_callback_ppc64.c +60 -0
- data/dyncall/dyncallback/dyncall_callback_ppc64.h +56 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_sparc32.h +2 -1
- data/dyncall/dyncallback/dyncall_callback_sparc32.s +1 -1
- data/dyncall/dyncallback/dyncall_callback_sparc64.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_sparc64.s +1 -1
- data/dyncall/dyncallback/dyncall_callback_x64.S +5 -12
- data/dyncall/dyncallback/dyncall_callback_x64.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_x64.h +2 -1
- data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +0 -7
- data/dyncall/dyncallback/dyncall_callback_x86.S +5 -12
- data/dyncall/dyncallback/dyncall_callback_x86.c +2 -1
- data/dyncall/dyncallback/dyncall_callback_x86.h +2 -1
- data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +2 -11
- data/dyncall/dyncallback/dyncall_thunk.c +11 -3
- data/dyncall/dyncallback/dyncall_thunk.h +8 -2
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +7 -7
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +2 -1
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +2 -1
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +2 -1
- data/dyncall/dyncallback/dyncall_thunk_arm64.c +64 -0
- data/dyncall/dyncallback/dyncall_thunk_arm64.h +42 -0
- data/dyncall/dyncallback/dyncall_thunk_mips.c +49 -17
- data/dyncall/dyncallback/dyncall_thunk_mips.h +3 -2
- data/dyncall/dyncallback/dyncall_thunk_ppc32.c +3 -2
- data/dyncall/dyncallback/dyncall_thunk_ppc32.h +7 -7
- data/dyncall/dyncallback/dyncall_thunk_ppc32_sysv.c +50 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc64.c +87 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc64.h +55 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc32.c +2 -1
- data/dyncall/dyncallback/dyncall_thunk_sparc32.h +2 -1
- data/dyncall/dyncallback/dyncall_thunk_sparc64.c +2 -1
- data/dyncall/dyncallback/dyncall_thunk_sparc64.h +2 -1
- data/dyncall/dyncallback/dyncall_thunk_x64.c +2 -1
- data/dyncall/dyncallback/dyncall_thunk_x64.h +2 -1
- data/dyncall/dyncallback/dyncall_thunk_x86.c +2 -1
- data/dyncall/dyncallback/dyncall_thunk_x86.h +2 -1
- data/dyncall/dyncallback/dyncallback.3 +3 -3
- data/dyncall/dyncallback/gen-masm.sh +0 -0
- data/dyncall/dynload/dynload.c +2 -1
- data/dyncall/dynload/dynload.h +2 -1
- data/dyncall/dynload/dynload_alloc.h +2 -1
- data/dyncall/dynload/dynload_darwin.c +2 -1
- data/dyncall/dynload/dynload_syms.c +2 -1
- data/dyncall/dynload/dynload_syms_elf.c +2 -1
- data/dyncall/dynload/dynload_syms_mach-o.c +3 -2
- data/dyncall/dynload/dynload_syms_pe.c +2 -1
- data/dyncall/dynload/dynload_unix.c +2 -1
- data/dyncall/dynload/dynload_windows.c +2 -1
- data/dyncall/portasm/gen-masm.sh +0 -0
- data/dyncall/portasm/portasm-arm.S +3 -2
- data/dyncall/portasm/portasm-ppc.S +2 -1
- data/dyncall/portasm/portasm-ppc64.S +119 -0
- data/dyncall/portasm/portasm-x64-att.S +2 -1
- data/dyncall/portasm/portasm-x86.S +2 -1
- metadata +39 -18
- data/dyncall/dyncallback/dyncall_callback_x64_apple.s +0 -122
- data/dyncall/dyncallback/dyncall_callback_x64_gas.s +0 -119
- data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +0 -102
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: mips "o32" ABI callvm implementation
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2015 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
|
@@ -24,6 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
+
|
27
28
|
/*
|
28
29
|
|
29
30
|
dyncall callvm for mips o32 abi
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: mips "o32" ABI callvm C interface.
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2015 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
|
@@ -24,6 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
+
|
27
28
|
#ifndef DYNCALL_CALLVM_MIPS_O32_H
|
28
29
|
#define DYNCALL_CALLVM_MIPS_O32_H
|
29
30
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2015 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
|
@@ -24,6 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
+
|
27
28
|
/*
|
28
29
|
|
29
30
|
dyncall callvm for ppc32 architectures
|
@@ -31,10 +32,12 @@
|
|
31
32
|
SUPPORTED CALLING CONVENTIONS
|
32
33
|
ppc32/osx
|
33
34
|
ppc32/linux (sysv abi)
|
35
|
+
ppc32/syscall
|
34
36
|
|
35
37
|
REVISION
|
36
|
-
|
38
|
+
2015/01/15 added syscall (tested on Linux)
|
37
39
|
2009/01/09 added System V ABI support
|
40
|
+
2007/12/11 initial support for Darwin ABI
|
38
41
|
|
39
42
|
*/
|
40
43
|
|
@@ -266,6 +269,12 @@ void dc_callvm_call_ppc32_sysv(DCCallVM* in_self, DCpointer target)
|
|
266
269
|
dcCall_ppc32_sysv( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
|
267
270
|
}
|
268
271
|
|
272
|
+
void dc_callvm_call_ppc32_syscall(DCCallVM* in_self, DCpointer target)
|
273
|
+
{
|
274
|
+
DCCallVM_ppc32* self = (DCCallVM_ppc32*) in_self;
|
275
|
+
dcCall_ppc32_syscall( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
|
276
|
+
}
|
277
|
+
|
269
278
|
void dc_callvm_mode_ppc32(DCCallVM* in_self, DCint mode);
|
270
279
|
|
271
280
|
DCCallVM_vt gVT_ppc32_darwin =
|
@@ -324,6 +333,35 @@ DCCallVM_vt gVT_ppc32_sysv =
|
|
324
333
|
, NULL /* callStruct */
|
325
334
|
};
|
326
335
|
|
336
|
+
DCCallVM_vt gVT_ppc32_syscall =
|
337
|
+
{
|
338
|
+
&dc_callvm_free_ppc32
|
339
|
+
, &dc_callvm_reset_ppc32
|
340
|
+
, &dc_callvm_mode_ppc32
|
341
|
+
, &dc_callvm_argBool_ppc32
|
342
|
+
, &dc_callvm_argChar_ppc32
|
343
|
+
, &dc_callvm_argShort_ppc32
|
344
|
+
, &dc_callvm_argInt_ppc32_sysv
|
345
|
+
, &dc_callvm_argLong_ppc32
|
346
|
+
, &dc_callvm_argLongLong_ppc32_sysv
|
347
|
+
, &dc_callvm_argFloat_ppc32_sysv
|
348
|
+
, &dc_callvm_argDouble_ppc32_sysv
|
349
|
+
, &dc_callvm_argPointer_ppc32
|
350
|
+
, NULL /* argStruct */
|
351
|
+
, (DCvoidvmfunc*) &dc_callvm_call_ppc32_syscall
|
352
|
+
, (DCboolvmfunc*) &dc_callvm_call_ppc32_syscall
|
353
|
+
, (DCcharvmfunc*) &dc_callvm_call_ppc32_syscall
|
354
|
+
, (DCshortvmfunc*) &dc_callvm_call_ppc32_syscall
|
355
|
+
, (DCintvmfunc*) &dc_callvm_call_ppc32_syscall
|
356
|
+
, (DClongvmfunc*) &dc_callvm_call_ppc32_syscall
|
357
|
+
, (DClonglongvmfunc*) &dc_callvm_call_ppc32_syscall
|
358
|
+
, (DCfloatvmfunc*) &dc_callvm_call_ppc32_syscall
|
359
|
+
, (DCdoublevmfunc*) &dc_callvm_call_ppc32_syscall
|
360
|
+
, (DCpointervmfunc*) &dc_callvm_call_ppc32_syscall
|
361
|
+
, NULL /* callStruct */
|
362
|
+
};
|
363
|
+
|
364
|
+
|
327
365
|
void dc_callvm_mode_ppc32(DCCallVM* in_self, DCint mode)
|
328
366
|
{
|
329
367
|
DCCallVM_ppc32* self = (DCCallVM_ppc32*) in_self;
|
@@ -352,6 +390,11 @@ void dc_callvm_mode_ppc32(DCCallVM* in_self, DCint mode)
|
|
352
390
|
vt = &gVT_ppc32_sysv;
|
353
391
|
break;
|
354
392
|
|
393
|
+
case DC_CALL_SYS_DEFAULT:
|
394
|
+
case DC_CALL_SYS_PPC32:
|
395
|
+
vt = &gVT_ppc32_syscall;
|
396
|
+
break;
|
397
|
+
|
355
398
|
default:
|
356
399
|
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
357
400
|
return;
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2015 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
|
@@ -24,6 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
+
|
27
28
|
#ifndef DYNCALL_CALLVM_PPC32_H
|
28
29
|
#define DYNCALL_CALLVM_PPC32_H
|
29
30
|
|
@@ -0,0 +1,351 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_callvm_ppc64.c
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
|
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
|
+
/*
|
27
|
+
|
28
|
+
dyncall callvm for ppc64 architectures
|
29
|
+
|
30
|
+
SUPPORTED CALLING CONVENTIONS
|
31
|
+
ppc64/linux
|
32
|
+
ppc64/syscall
|
33
|
+
|
34
|
+
REVISION
|
35
|
+
2015/07/08 added syscall
|
36
|
+
2014/08/07 initial support
|
37
|
+
|
38
|
+
*/
|
39
|
+
|
40
|
+
#include "dyncall_callvm_ppc64.h"
|
41
|
+
#include "dyncall_call_ppc64.h"
|
42
|
+
#include "dyncall_alloc.h"
|
43
|
+
#include "dyncall_macros.h"
|
44
|
+
#include "dyncall_types.h"
|
45
|
+
|
46
|
+
/* Support for Power PC 64-bit */
|
47
|
+
|
48
|
+
static void dc_callvm_free_ppc64(DCCallVM* in_self)
|
49
|
+
{
|
50
|
+
dcFreeMem(in_self);
|
51
|
+
}
|
52
|
+
|
53
|
+
static void dc_callvm_reset_ppc64(DCCallVM* in_self)
|
54
|
+
{
|
55
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
|
56
|
+
dcVecReset(&self->mVecHead);
|
57
|
+
self->mIntRegs = 0;
|
58
|
+
self->mFloatRegs = 0;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* fillup integer register file AND push on stack (for ellipsis) */
|
62
|
+
|
63
|
+
static void dc_callvm_argInt_ppc64(DCCallVM* in_self, DCint i)
|
64
|
+
{
|
65
|
+
/* promote to longlong */
|
66
|
+
dcArgLongLong(in_self, (DClonglong)i);
|
67
|
+
}
|
68
|
+
|
69
|
+
/** floating-point **/
|
70
|
+
|
71
|
+
/* double*/
|
72
|
+
|
73
|
+
static void dc_callvm_argDouble_ppc64(DCCallVM* in_self, DCdouble d)
|
74
|
+
{
|
75
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
|
76
|
+
|
77
|
+
if (self->mFloatRegs < 13) {
|
78
|
+
self->mRegData.mFloatData[self->mFloatRegs++] = d;
|
79
|
+
if (self->mIntRegs < 8) {
|
80
|
+
self->mRegData.mIntData[self->mIntRegs++] = *( (DClonglong*) &d );
|
81
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
82
|
+
return;
|
83
|
+
#endif
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
88
|
+
if (dcVecSize(&self->mVecHead) == 0) {
|
89
|
+
dcVecSkip(&self->mVecHead,sizeof(DClonglong)*8);
|
90
|
+
}
|
91
|
+
#endif
|
92
|
+
|
93
|
+
/* push on stack */
|
94
|
+
dcVecAppend(&self->mVecHead,(DCpointer) &d,sizeof(DCdouble));
|
95
|
+
}
|
96
|
+
|
97
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
98
|
+
static void dc_callvm_argDouble_ppc64_ellipsis(DCCallVM* in_self, DCdouble d)
|
99
|
+
{
|
100
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
|
101
|
+
|
102
|
+
if (dcVecSize(&self->mVecHead) == 0)
|
103
|
+
dcVecSkip(&self->mVecHead,(sizeof(DClonglong))*(self->mIntRegs));
|
104
|
+
|
105
|
+
if (self->mFloatRegs < 13) {
|
106
|
+
self->mRegData.mFloatData[self->mFloatRegs++] = d;
|
107
|
+
if (self->mIntRegs < 8) {
|
108
|
+
self->mRegData.mIntData[self->mIntRegs++] = *( (DClonglong*) &d );
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
/* push on stack */
|
113
|
+
dcVecAppend(&self->mVecHead,(DCpointer) &d,sizeof(DCdouble));
|
114
|
+
}
|
115
|
+
#endif
|
116
|
+
|
117
|
+
|
118
|
+
/* Floating-point */
|
119
|
+
|
120
|
+
static void dc_callvm_argFloat_ppc64(DCCallVM* in_self, DCfloat f)
|
121
|
+
{
|
122
|
+
/* promote to double */
|
123
|
+
dcArgDouble(in_self, (DCdouble) f );
|
124
|
+
}
|
125
|
+
|
126
|
+
/* long long integer */
|
127
|
+
|
128
|
+
static void dc_callvm_argLongLong_ppc64(DCCallVM* in_self, DClonglong L)
|
129
|
+
{
|
130
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
|
131
|
+
|
132
|
+
/* fillup integer register file */
|
133
|
+
if (self->mIntRegs < 8) {
|
134
|
+
self->mRegData.mIntData[self->mIntRegs++] = L;
|
135
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
136
|
+
return;
|
137
|
+
#endif
|
138
|
+
}
|
139
|
+
|
140
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
141
|
+
if (dcVecSize(&self->mVecHead) == 0) {
|
142
|
+
dcVecSkip(&self->mVecHead,sizeof(DClonglong)*8);
|
143
|
+
}
|
144
|
+
#endif
|
145
|
+
|
146
|
+
/* push on stack */
|
147
|
+
dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
|
148
|
+
}
|
149
|
+
|
150
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
151
|
+
static void dc_callvm_argLongLong_ppc64_ellipsis(DCCallVM* in_self, DClonglong L)
|
152
|
+
{
|
153
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
|
154
|
+
|
155
|
+
if (dcVecSize(&self->mVecHead) == 0)
|
156
|
+
dcVecSkip(&self->mVecHead,(sizeof(DClonglong))*(self->mIntRegs));
|
157
|
+
|
158
|
+
if (self->mIntRegs < 8)
|
159
|
+
self->mRegData.mIntData[self->mIntRegs++] = L;
|
160
|
+
|
161
|
+
/* push on stack */
|
162
|
+
dcVecAppend(&self->mVecHead,&L,sizeof(DClonglong));
|
163
|
+
}
|
164
|
+
#endif
|
165
|
+
|
166
|
+
|
167
|
+
static void dc_callvm_argBool_ppc64(DCCallVM* in_self, DCbool x)
|
168
|
+
{
|
169
|
+
/* promote to longlong */
|
170
|
+
dcArgLongLong(in_self, (DClonglong) x );
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
static void dc_callvm_argChar_ppc64(DCCallVM* in_self, DCchar ch)
|
175
|
+
{
|
176
|
+
/* promote to longlong */
|
177
|
+
dcArgLongLong(in_self, (DClonglong) ch );
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
static void dc_callvm_argShort_ppc64(DCCallVM* in_self, DCshort s)
|
182
|
+
{
|
183
|
+
/* promote to longlong */
|
184
|
+
dcArgLongLong(in_self, (DClonglong) s );
|
185
|
+
}
|
186
|
+
|
187
|
+
|
188
|
+
static void dc_callvm_argLong_ppc64(DCCallVM* in_self, DClong l)
|
189
|
+
{
|
190
|
+
/* promote to longlong */
|
191
|
+
dcArgLongLong(in_self, (DClonglong) l );
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
static void dc_callvm_argPointer_ppc64(DCCallVM* in_self, DCpointer p)
|
196
|
+
{
|
197
|
+
/* promote to longlong */
|
198
|
+
dcArgLongLong(in_self, *(DClonglong *) &p );
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
void dc_callvm_call_ppc64(DCCallVM* in_self, DCpointer target)
|
203
|
+
{
|
204
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
|
205
|
+
int size = dcVecSize(&self->mVecHead);
|
206
|
+
|
207
|
+
if (size < 64) {
|
208
|
+
dcVecSkip(&self->mVecHead, 64-size);
|
209
|
+
}
|
210
|
+
|
211
|
+
dcCall_ppc64( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
|
212
|
+
}
|
213
|
+
|
214
|
+
void dc_callvm_call_ppc64_syscall(DCCallVM* in_self, DCpointer target)
|
215
|
+
{
|
216
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
|
217
|
+
dcCall_ppc64_syscall( target, &self->mRegData, dcVecSize(&self->mVecHead) , dcVecData(&self->mVecHead));
|
218
|
+
}
|
219
|
+
|
220
|
+
void dc_callvm_mode_ppc64(DCCallVM* in_self, DCint mode);
|
221
|
+
|
222
|
+
DCCallVM_vt gVT_ppc64 =
|
223
|
+
{
|
224
|
+
&dc_callvm_free_ppc64
|
225
|
+
, &dc_callvm_reset_ppc64
|
226
|
+
, &dc_callvm_mode_ppc64
|
227
|
+
, &dc_callvm_argBool_ppc64
|
228
|
+
, &dc_callvm_argChar_ppc64
|
229
|
+
, &dc_callvm_argShort_ppc64
|
230
|
+
, &dc_callvm_argInt_ppc64
|
231
|
+
, &dc_callvm_argLong_ppc64
|
232
|
+
, &dc_callvm_argLongLong_ppc64
|
233
|
+
, &dc_callvm_argFloat_ppc64
|
234
|
+
, &dc_callvm_argDouble_ppc64
|
235
|
+
, &dc_callvm_argPointer_ppc64
|
236
|
+
, NULL /* argStruct */
|
237
|
+
, (DCvoidvmfunc*) &dc_callvm_call_ppc64
|
238
|
+
, (DCboolvmfunc*) &dc_callvm_call_ppc64
|
239
|
+
, (DCcharvmfunc*) &dc_callvm_call_ppc64
|
240
|
+
, (DCshortvmfunc*) &dc_callvm_call_ppc64
|
241
|
+
, (DCintvmfunc*) &dc_callvm_call_ppc64
|
242
|
+
, (DClongvmfunc*) &dc_callvm_call_ppc64
|
243
|
+
, (DClonglongvmfunc*) &dc_callvm_call_ppc64
|
244
|
+
, (DCfloatvmfunc*) &dc_callvm_call_ppc64
|
245
|
+
, (DCdoublevmfunc*) &dc_callvm_call_ppc64
|
246
|
+
, (DCpointervmfunc*) &dc_callvm_call_ppc64
|
247
|
+
, NULL /* callStruct */
|
248
|
+
};
|
249
|
+
|
250
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
251
|
+
DCCallVM_vt gVT_ppc64_ellipsis =
|
252
|
+
{
|
253
|
+
&dc_callvm_free_ppc64
|
254
|
+
, &dc_callvm_reset_ppc64
|
255
|
+
, &dc_callvm_mode_ppc64
|
256
|
+
, &dc_callvm_argBool_ppc64
|
257
|
+
, &dc_callvm_argChar_ppc64
|
258
|
+
, &dc_callvm_argShort_ppc64
|
259
|
+
, &dc_callvm_argInt_ppc64
|
260
|
+
, &dc_callvm_argLong_ppc64
|
261
|
+
, &dc_callvm_argLongLong_ppc64_ellipsis
|
262
|
+
, &dc_callvm_argFloat_ppc64
|
263
|
+
, &dc_callvm_argDouble_ppc64_ellipsis
|
264
|
+
, &dc_callvm_argPointer_ppc64
|
265
|
+
, NULL /* argStruct */
|
266
|
+
, (DCvoidvmfunc*) &dc_callvm_call_ppc64
|
267
|
+
, (DCboolvmfunc*) &dc_callvm_call_ppc64
|
268
|
+
, (DCcharvmfunc*) &dc_callvm_call_ppc64
|
269
|
+
, (DCshortvmfunc*) &dc_callvm_call_ppc64
|
270
|
+
, (DCintvmfunc*) &dc_callvm_call_ppc64
|
271
|
+
, (DClongvmfunc*) &dc_callvm_call_ppc64
|
272
|
+
, (DClonglongvmfunc*) &dc_callvm_call_ppc64
|
273
|
+
, (DCfloatvmfunc*) &dc_callvm_call_ppc64
|
274
|
+
, (DCdoublevmfunc*) &dc_callvm_call_ppc64
|
275
|
+
, (DCpointervmfunc*) &dc_callvm_call_ppc64
|
276
|
+
, NULL /* callStruct */
|
277
|
+
};
|
278
|
+
#endif
|
279
|
+
|
280
|
+
DCCallVM_vt gVT_ppc64_syscall =
|
281
|
+
{
|
282
|
+
&dc_callvm_free_ppc64
|
283
|
+
, &dc_callvm_reset_ppc64
|
284
|
+
, &dc_callvm_mode_ppc64
|
285
|
+
, &dc_callvm_argBool_ppc64
|
286
|
+
, &dc_callvm_argChar_ppc64
|
287
|
+
, &dc_callvm_argShort_ppc64
|
288
|
+
, &dc_callvm_argInt_ppc64
|
289
|
+
, &dc_callvm_argLong_ppc64
|
290
|
+
, &dc_callvm_argLongLong_ppc64
|
291
|
+
, &dc_callvm_argFloat_ppc64
|
292
|
+
, &dc_callvm_argDouble_ppc64
|
293
|
+
, &dc_callvm_argPointer_ppc64
|
294
|
+
, NULL /* argStruct */
|
295
|
+
, (DCvoidvmfunc*) &dc_callvm_call_ppc64_syscall
|
296
|
+
, (DCboolvmfunc*) &dc_callvm_call_ppc64_syscall
|
297
|
+
, (DCcharvmfunc*) &dc_callvm_call_ppc64_syscall
|
298
|
+
, (DCshortvmfunc*) &dc_callvm_call_ppc64_syscall
|
299
|
+
, (DCintvmfunc*) &dc_callvm_call_ppc64_syscall
|
300
|
+
, (DClongvmfunc*) &dc_callvm_call_ppc64_syscall
|
301
|
+
, (DClonglongvmfunc*) &dc_callvm_call_ppc64_syscall
|
302
|
+
, (DCfloatvmfunc*) &dc_callvm_call_ppc64_syscall
|
303
|
+
, (DCdoublevmfunc*) &dc_callvm_call_ppc64_syscall
|
304
|
+
, (DCpointervmfunc*) &dc_callvm_call_ppc64_syscall
|
305
|
+
, NULL /* callStruct */
|
306
|
+
};
|
307
|
+
|
308
|
+
void dc_callvm_mode_ppc64(DCCallVM* in_self, DCint mode)
|
309
|
+
{
|
310
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
|
311
|
+
DCCallVM_vt* vt;
|
312
|
+
switch(mode) {
|
313
|
+
|
314
|
+
case DC_CALL_C_PPC64:
|
315
|
+
case DC_CALL_C_DEFAULT:
|
316
|
+
case DC_CALL_C_ELLIPSIS:
|
317
|
+
#if DC__ABI_PPC64_ELF_V == 2
|
318
|
+
vt = &gVT_ppc64;
|
319
|
+
break;
|
320
|
+
case DC_CALL_C_ELLIPSIS_VARARGS:
|
321
|
+
vt = &gVT_ppc64_ellipsis;
|
322
|
+
break;
|
323
|
+
#else
|
324
|
+
case DC_CALL_C_ELLIPSIS_VARARGS:
|
325
|
+
vt = &gVT_ppc64;
|
326
|
+
break;
|
327
|
+
#endif
|
328
|
+
|
329
|
+
case DC_CALL_SYS_DEFAULT:
|
330
|
+
case DC_CALL_SYS_PPC64:
|
331
|
+
vt = &gVT_ppc64_syscall;
|
332
|
+
break;
|
333
|
+
|
334
|
+
default:
|
335
|
+
self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
|
336
|
+
return;
|
337
|
+
}
|
338
|
+
|
339
|
+
dc_callvm_base_init(&self->mInterface, vt);
|
340
|
+
}
|
341
|
+
|
342
|
+
DCCallVM* dcNewCallVM(DCsize size)
|
343
|
+
{
|
344
|
+
DCCallVM_ppc64* self = (DCCallVM_ppc64*)dcAllocMem(sizeof(DCCallVM_ppc64)+size);
|
345
|
+
dcVecInit(&self->mVecHead, size);
|
346
|
+
self->mIntRegs = 0;
|
347
|
+
self->mFloatRegs = 0;
|
348
|
+
dc_callvm_mode_ppc64( (DCCallVM*) self, DC_CALL_C_DEFAULT );
|
349
|
+
return (DCCallVM*)self;
|
350
|
+
}
|
351
|
+
|