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: Thunk - Implementation for ARM32 (THUMB mode)
|
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
|
#include "dyncall_thunk_arm32_arm.c" /* Since we can mix ARM and THUMB */
|
28
29
|
/* assembly, reuse the ARM mode code */
|
29
30
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Thunk - Header for ARM32 (THUMB mode)
|
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
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
*/
|
25
25
|
|
26
|
+
|
26
27
|
#ifndef DYNCALL_THUNK_ARM32_THUMB_H
|
27
28
|
#define DYNCALL_THUNK_ARM32_THUMB_H
|
28
29
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_thunk_arm64.c
|
6
|
+
Description: Thunk - Implementation for ARM64 / ARMv8 / AAPCS64
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2015 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_thunk.h"
|
29
|
+
|
30
|
+
/*
|
31
|
+
|
32
|
+
Thunk Register: x9
|
33
|
+
|
34
|
+
Thunk:
|
35
|
+
adr x9, Thunk
|
36
|
+
ldr x10, .target
|
37
|
+
br x10
|
38
|
+
nop
|
39
|
+
.target:
|
40
|
+
.xword 0
|
41
|
+
|
42
|
+
-- Encoded in:
|
43
|
+
|
44
|
+
0000000000000000 <Thunk>:
|
45
|
+
0: 10000009 adr x9, 0 <Thunk>
|
46
|
+
4: 5800006a ldr x10, 10 <.target>
|
47
|
+
8: d61f0140 br x10
|
48
|
+
c: d503201f nop
|
49
|
+
|
50
|
+
0000000000000010 <.target>:
|
51
|
+
10: 76543210 .word 0x76543210
|
52
|
+
14: fedcba98 .word 0xfedcba98
|
53
|
+
*/
|
54
|
+
|
55
|
+
void dcbInitThunk(DCThunk* p, void (*entry)())
|
56
|
+
{
|
57
|
+
p->code[0] = 0x10000009; // adr x9, 0
|
58
|
+
p->code[1] = 0x5800006a; // ldr x9, entry
|
59
|
+
p->code[2] = 0xd61f0140; // br x9
|
60
|
+
p->code[3] = 0xd503201f; // nop
|
61
|
+
p->entry = entry; // entry:
|
62
|
+
// .xword 0
|
63
|
+
}
|
64
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_thunk_arm64.h
|
6
|
+
Description: Thunk - Header for ARM64 / ARMv8 / AAPCS64
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2015 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
|
+
#ifndef DYNCALL_THUNK_ARM64_H
|
27
|
+
#define DYNCALL_THUNK_ARM64_H
|
28
|
+
|
29
|
+
struct DCThunk_
|
30
|
+
{
|
31
|
+
// off size
|
32
|
+
//-----|----------
|
33
|
+
unsigned int code[4]; // 0 16
|
34
|
+
void (*entry)(); // 16 8
|
35
|
+
void* reserved; // 24 8
|
36
|
+
|
37
|
+
// 32 total size
|
38
|
+
|
39
|
+
};
|
40
|
+
|
41
|
+
#endif /* DYNCALL_THUNK_ARM64_H */
|
42
|
+
|
@@ -6,8 +6,8 @@
|
|
6
6
|
Description: Thunk - Implementation for MIPS
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2013 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
-
|
9
|
+
Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
13
13
|
purpose with or without fee is hereby granted, provided that the above
|
@@ -30,23 +30,55 @@ unsigned short lo16(x) { return ( (unsigned short) ((unsigned int)x) );
|
|
30
30
|
|
31
31
|
void dcbInitThunk(DCThunk* p, void (*entry)())
|
32
32
|
{
|
33
|
-
|
33
|
+
/*
|
34
|
+
|
35
|
+
Thunk Register: $t4 ($12)
|
36
|
+
According to o32abi: $t9
|
37
|
+
|
38
|
+
'The Linux/MIPS convention is that all PIC calls use t9 to hold the address of the called function.'
|
39
|
+
[See MIPS Run, p.413]
|
40
|
+
|
34
41
|
mips thunk code:
|
35
|
-
lui $t4, hi(p)
|
36
|
-
lui $
|
37
|
-
ori $
|
38
|
-
jr $
|
39
|
-
ori $t4, $t4, lo(p)
|
42
|
+
lui $t4, %hi(p)
|
43
|
+
lui $t9, %hi(entry)
|
44
|
+
ori $t9, $t9, %lo(entry)
|
45
|
+
jr $t9
|
46
|
+
ori $t4, $t4, %lo(p)
|
47
|
+
|
48
|
+
thunk.o: file format elf32-tradbigmips
|
49
|
+
|
50
|
+
|
51
|
+
Disassembly of section .text:
|
52
|
+
|
53
|
+
00000000 <thunk>:
|
54
|
+
0: 3c0c0000 lui t4,0x0
|
55
|
+
4: 3c190000 lui t9,0x0
|
56
|
+
8: 37390000 ori t9,t9,0x0
|
57
|
+
c: 03200008 jr t9
|
58
|
+
10: 00200825 move at,at
|
59
|
+
14: 358c0000 ori t4,t4,0x0
|
60
|
+
18: 00200825 move at,at
|
61
|
+
1c: 00200825 move at,at
|
62
|
+
|
40
63
|
*/
|
41
64
|
|
42
|
-
|
43
|
-
|
44
|
-
p->data[
|
45
|
-
p->data[3] =
|
46
|
-
p->data[4] = lo16(entry); /* ori $
|
47
|
-
p->
|
48
|
-
p->
|
49
|
-
|
50
|
-
|
65
|
+
#if defined(DC__Endian_BIG)
|
66
|
+
|
67
|
+
p->data[0] = 0x3c0c; p->data[1] = hi16(p); /* lui $t4, hi(p) */
|
68
|
+
p->data[2] = 0x3c19; p->data[3] = hi16(entry); /* lui $t9, hi(entry) */
|
69
|
+
p->data[4] = 0x3739; p->data[5] = lo16(entry); /* ori $t9, $t9, lo(entry) */
|
70
|
+
p->jump = 0x03200008; /* jr $t9 */
|
71
|
+
p->bddt[0] = 0x358c; p->bddt[1] = lo16(p); /* ori $t4, $t4, lo(p) - branch delay slot */
|
72
|
+
|
73
|
+
#else /* defined(DC__Endian_LITTLE) */
|
74
|
+
|
75
|
+
p->data[1] = 0x3c0c; p->data[0] = hi16(p); /* lui $t4, hi(p) */
|
76
|
+
p->data[3] = 0x3c19; p->data[2] = hi16(entry); /* lui $t9, hi(entry) */
|
77
|
+
p->data[5] = 0x3739; p->data[4] = lo16(entry); /* ori $t9, $t9, lo(entry) */
|
78
|
+
p->jump = 0x03200008; /* jr $t9 */
|
79
|
+
p->bddt[1] = 0x358c; p->bddt[0] = lo16(p); /* ori $t4, $t4, lo(p) - branch delay slot */
|
80
|
+
|
81
|
+
#endif
|
82
|
+
|
51
83
|
}
|
52
84
|
|
@@ -6,8 +6,8 @@
|
|
6
6
|
Description: Thunk - Header for MIPS
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2013 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
-
|
9
|
+
Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
11
|
|
12
12
|
Permission to use, copy, modify, and distribute this software for any
|
13
13
|
purpose with or without fee is hereby granted, provided that the above
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
*/
|
25
25
|
|
26
|
+
|
26
27
|
#ifndef DYNCALL_THUNK_MIPS_H
|
27
28
|
#define DYNCALL_THUNK_MIPS_H
|
28
29
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_thunk_ppc32.c
|
6
|
-
Description: Thunk - Implementation for ppc32
|
6
|
+
Description: Thunk - Implementation for ppc32 darwin/apple
|
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
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
*/
|
25
25
|
|
26
|
+
|
26
27
|
#include "dyncall_thunk.h"
|
27
28
|
|
28
29
|
unsigned short hi16(x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_thunk_ppc32.h
|
6
|
-
Description: Thunk - Header for ppc32
|
6
|
+
Description: Thunk - Header for ppc32 (darwin/sysv)
|
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
|
@@ -28,11 +28,11 @@
|
|
28
28
|
|
29
29
|
struct DCThunk_
|
30
30
|
{
|
31
|
-
unsigned short code_load_hi, addr_self_hi; /* offset: 0 */
|
32
|
-
unsigned short code_load_lo, addr_self_lo; /* offset: 4 */
|
33
|
-
unsigned int code_jump[3]; /* offset: 8 */
|
34
|
-
void (*addr_entry)(); /* offset: 20 */
|
35
|
-
};
|
31
|
+
unsigned short code_load_hi, addr_self_hi; /* offset: 0 size: 4 */
|
32
|
+
unsigned short code_load_lo, addr_self_lo; /* offset: 4 size: 4 */
|
33
|
+
unsigned int code_jump[3]; /* offset: 8 size: 12 */
|
34
|
+
void (*addr_entry)(); /* offset: 20 size: 4 */
|
35
|
+
}; /* total size: 24 */
|
36
36
|
|
37
37
|
#define DCTHUNK_SIZE_PPC32 24
|
38
38
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_thunk_ppc32_sysv.c
|
6
|
+
Description: Thunks on PowerPC 32-bit System V ABI
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2015 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_thunk.h"
|
27
|
+
|
28
|
+
unsigned short hi16(x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
|
29
|
+
unsigned short lo16(x) { return ( (unsigned short) ((unsigned int)x) ); }
|
30
|
+
|
31
|
+
void dcbInitThunk(DCThunk* p, void (*entry)())
|
32
|
+
{
|
33
|
+
/*
|
34
|
+
0: 3d 60 00 00 lis r11,0
|
35
|
+
4: 61 6b 00 01 ori r11,r11,1
|
36
|
+
8: 81 82 00 14 lwz r12,20(r2)
|
37
|
+
c: 7d 89 03 a6 mtctr r12
|
38
|
+
10: 4e 80 04 20 bctr
|
39
|
+
*/
|
40
|
+
p->code_load_hi = 0x3d60U; /* lis r11, HI16(p) */
|
41
|
+
p->addr_self_hi = hi16(p);
|
42
|
+
p->code_load_lo = 0x616bU; /* ori r11, r11, LO16(p) */
|
43
|
+
p->addr_self_lo = lo16(p);
|
44
|
+
p->code_jump[0] = 0x818b0014U; /* lwz r12, 20(r11) */
|
45
|
+
p->code_jump[1] = 0x7d8903a6U; /* mtclr r12 */
|
46
|
+
p->code_jump[2] = 0x4e800420U; /* bctr */
|
47
|
+
p->addr_entry = entry;
|
48
|
+
|
49
|
+
}
|
50
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_thunk_ppc64.c
|
6
|
+
Description: Thunk - Implementation for ppc64
|
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
|
+
#include "dyncall_thunk.h"
|
26
|
+
|
27
|
+
#define HIST16(x) (unsigned short)((((unsigned long)(x))>>48UL) & 0xffff)
|
28
|
+
#define HIER16(x) (unsigned short)((((unsigned long)(x))>>32UL) & 0xffff)
|
29
|
+
#define HI16(x) (unsigned short)((((unsigned long)(x))>>16UL) & 0xffff)
|
30
|
+
#define LO16(x) (unsigned short)( ((unsigned long)(x)) & 0xffff)
|
31
|
+
|
32
|
+
void dcbInitThunk(DCThunk* p, void (*entry)())
|
33
|
+
{
|
34
|
+
#if DC__ABI_PPC64_ELF_V != 2
|
35
|
+
/*
|
36
|
+
ppc64 thunk code: (v1)
|
37
|
+
oris r11, r2, HI16(p)
|
38
|
+
ori r11,r11, LO16(p)
|
39
|
+
ld r12,48(r11)
|
40
|
+
ld r2,56(r11)
|
41
|
+
mtctr r12
|
42
|
+
bctr
|
43
|
+
*/
|
44
|
+
|
45
|
+
p->thunk_entry = (void *)&(p->code_load_hi);
|
46
|
+
p->toc_thunk = ((long)(p->thunk_entry) & 0xffffffff00000000UL);
|
47
|
+
|
48
|
+
p->code_load_hi = 0x644bU; /* oris r11, r2, HI16(p) */
|
49
|
+
p->addr_self_hi = HI16(p);
|
50
|
+
p->code_load_lo = 0x616bU; /* ori r11,r11, LO16(p) */
|
51
|
+
p->addr_self_lo = LO16(p);
|
52
|
+
p->code_jump[0] = 0xe98b0030U; /* ld r12,48(r11) */
|
53
|
+
p->code_jump[1] = 0xe84b0038U; /* ld r2,56(r11) */
|
54
|
+
p->code_jump[2] = 0x7d8903a6U; /* mtclr r12 */
|
55
|
+
p->code_jump[3] = 0x4e800420U; /* bctr */
|
56
|
+
p->addr_entry = (void *)*((long *)entry);
|
57
|
+
p->toc_entry = *((long *)(entry + 8));
|
58
|
+
|
59
|
+
#else
|
60
|
+
/*
|
61
|
+
ppc64 thunk code: (v2)
|
62
|
+
lis r11, HIST16(p)
|
63
|
+
ori r11,r11, HIER16(p)
|
64
|
+
rldicr r11,r11,32,31
|
65
|
+
oris r11,r11, HI16(p)
|
66
|
+
ori r11,r11, LO16(p)
|
67
|
+
ld r12,40(r11)
|
68
|
+
mtctr r12
|
69
|
+
bctr
|
70
|
+
*/
|
71
|
+
|
72
|
+
p->code_load_hist = 0x3d60U; /* lis r11,HIST16(p) */
|
73
|
+
p->addr_self_hist = HIST16(p);
|
74
|
+
p->code_load_hier = 0x616bU; /* ori r11,r11, HIER16(p) */
|
75
|
+
p->addr_self_hier = HIER16(p);
|
76
|
+
p->code_rot = 0x796b07c6U; /* rldicr r11,r11,32,31 */
|
77
|
+
p->code_load_hi = 0x656bU; /* oris r11,r11, HI16(p) */
|
78
|
+
p->addr_self_hi = HI16(p);
|
79
|
+
p->code_load_lo = 0x616bU; /* ori r11,r11, LO16(p) */
|
80
|
+
p->addr_self_lo = LO16(p);
|
81
|
+
p->code_jump[0] = 0xe98b0028U; /* ld r12,40(r11) */
|
82
|
+
p->code_jump[1] = 0x7d8903a6U; /* mtclr r12 */
|
83
|
+
p->code_jump[2] = 0x4e800420U; /* bctr */
|
84
|
+
p->addr_entry = (void *)(entry);
|
85
|
+
#endif
|
86
|
+
}
|
87
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_thunk_ppc64.h
|
6
|
+
Description: Thunk - Header for ppc64
|
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
|
+
#ifndef DYNCALL_THUNK_PPC64_H
|
26
|
+
#define DYNCALL_THUNK_PPC64_H
|
27
|
+
|
28
|
+
#if DC__ABI_PPC64_ELF_V != 2
|
29
|
+
struct DCThunk_ /* v1 */
|
30
|
+
{
|
31
|
+
void (*thunk_entry)(); /* offset: 0 */
|
32
|
+
long toc_thunk; /* offset: 8 */
|
33
|
+
unsigned short code_load_hi, addr_self_hi; /* offset: 16 */
|
34
|
+
unsigned short code_load_lo, addr_self_lo; /* offset: 20 */
|
35
|
+
unsigned int code_jump[6]; /* offset: 24 */
|
36
|
+
void (*addr_entry)(); /* offset: 48 */
|
37
|
+
long toc_entry; /* offset: 56 */
|
38
|
+
};
|
39
|
+
#define DCTHUNK_SIZE_PPC64 64
|
40
|
+
#else
|
41
|
+
struct DCThunk_ /* v2 */
|
42
|
+
{
|
43
|
+
unsigned short addr_self_hist, code_load_hist; /* offset: 0 */
|
44
|
+
unsigned short addr_self_hier, code_load_hier; /* offset: 4 */
|
45
|
+
unsigned int code_rot; /* offset: 8 */
|
46
|
+
unsigned short addr_self_hi, code_load_hi; /* offset: 12 */
|
47
|
+
unsigned short addr_self_lo, code_load_lo; /* offset: 16 */
|
48
|
+
unsigned int code_jump[5]; /* offset: 20 */
|
49
|
+
void (*addr_entry)(); /* offset: 40 */
|
50
|
+
};
|
51
|
+
#define DCTHUNK_SIZE_PPC64 48
|
52
|
+
#endif
|
53
|
+
|
54
|
+
#endif /* DYNCALL_THUNK_PPC64_H */
|
55
|
+
|