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: Thunks on PowerPC 32-bit System V ABI
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2015 Daniel Adler <dadler@uni-goettingen.de>
|
9
|
+
Copyright (c) 2015-2018 Daniel Adler <dadler@uni-goettingen.de>
|
10
10
|
|
11
11
|
Permission to use, copy, modify, and distribute this software for any
|
12
12
|
purpose with or without fee is hereby granted, provided that the above
|
@@ -25,21 +25,21 @@
|
|
25
25
|
|
26
26
|
#include "dyncall_thunk.h"
|
27
27
|
|
28
|
-
unsigned short hi16(x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
|
29
|
-
unsigned short lo16(x) { return ( (unsigned short) ((unsigned int)x) ); }
|
28
|
+
static unsigned short hi16(x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
|
29
|
+
static 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
|
-
0:
|
35
|
-
4:
|
36
|
-
8:
|
37
|
-
c:
|
38
|
-
10:
|
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
39
|
*/
|
40
40
|
p->code_load_hi = 0x3d60U; /* lis r11, HI16(p) */
|
41
41
|
p->addr_self_hi = hi16(p);
|
42
|
-
p->code_load_lo = 0x616bU;
|
42
|
+
p->code_load_lo = 0x616bU; /* ori r11, r11, LO16(p) */
|
43
43
|
p->addr_self_lo = lo16(p);
|
44
44
|
p->code_jump[0] = 0x818b0014U; /* lwz r12, 20(r11) */
|
45
45
|
p->code_jump[1] = 0x7d8903a6U; /* mtclr r12 */
|
@@ -47,7 +47,7 @@ void dcbInitThunk(DCThunk* p, void (*entry)())
|
|
47
47
|
|
48
48
|
p->code_load_hi = 0x644bU; /* oris r11, r2, HI16(p) */
|
49
49
|
p->addr_self_hi = HI16(p);
|
50
|
-
p->code_load_lo = 0x616bU;
|
50
|
+
p->code_load_lo = 0x616bU; /* ori r11,r11, LO16(p) */
|
51
51
|
p->addr_self_lo = LO16(p);
|
52
52
|
p->code_jump[0] = 0xe98b0030U; /* ld r12,48(r11) */
|
53
53
|
p->code_jump[1] = 0xe84b0038U; /* ld r2,56(r11) */
|
@@ -76,7 +76,7 @@ void dcbInitThunk(DCThunk* p, void (*entry)())
|
|
76
76
|
p->code_rot = 0x796b07c6U; /* rldicr r11,r11,32,31 */
|
77
77
|
p->code_load_hi = 0x656bU; /* oris r11,r11, HI16(p) */
|
78
78
|
p->addr_self_hi = HI16(p);
|
79
|
-
p->code_load_lo = 0x616bU;
|
79
|
+
p->code_load_lo = 0x616bU; /* ori r11,r11, LO16(p) */
|
80
80
|
p->addr_self_lo = LO16(p);
|
81
81
|
p->code_jump[0] = 0xe98b0028U; /* ld r12,40(r11) */
|
82
82
|
p->code_jump[1] = 0x7d8903a6U; /* mtclr r12 */
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Thunk - Implementation for sparc32
|
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
|
@@ -28,6 +28,23 @@
|
|
28
28
|
|
29
29
|
void dcbInitThunk(DCThunk* p, void (*entry)())
|
30
30
|
{
|
31
|
-
/*
|
31
|
+
/* example
|
32
|
+
; put thunk pointer in g1
|
33
|
+
0: 03 00 00 00 sethi %hi(0), %g1
|
34
|
+
4: 82 10 60 00 or %g1, 0, %g1
|
35
|
+
; use g2 for entry pointer and "call" it, b/c branch instructions can't handle 32bit addresses
|
36
|
+
8: 05 00 00 00 sethi %hi(0), %g2
|
37
|
+
12: 84 10 a0 00 or %g2, 0, %g2
|
38
|
+
; jump - write link to %g0, effectively discarding it; also nop for delay slot
|
39
|
+
16: 81 c0 80 00 jmpl %g2, %g0
|
40
|
+
20: 01 00 00 00 nop
|
41
|
+
*/
|
42
|
+
|
43
|
+
p->code[0] = 0x03000000 | ((unsigned int)p >> 10); /* sethi %hi(p), %g1 -- hi 22 bits */
|
44
|
+
p->code[1] = 0x82106000 | ((unsigned int)p & 0x3ff); /* or %g1, <p&0x3ff>, %g1 -- lo 10 bits */
|
45
|
+
p->code[2] = 0x05000000 | ((unsigned int)entry >> 10); /* sethi %hi(entry), %g2 */
|
46
|
+
p->code[3] = 0x8410a000 | ((unsigned int)entry & 0x3ff); /* or %g2, <entry&0x3ff>, %g2 */
|
47
|
+
p->code[4] = 0x81c08000; /* jmpl %g2, %g0 -- discards link addr */
|
48
|
+
p->code[5] = 0x01000000; /* nop */
|
32
49
|
}
|
33
50
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_thunk_sparc32.h
|
6
|
-
Description: Thunk - Header for sparc32
|
6
|
+
Description: Thunk - Header for sparc32
|
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
|
@@ -29,9 +29,10 @@
|
|
29
29
|
|
30
30
|
struct DCThunk_
|
31
31
|
{
|
32
|
-
int
|
32
|
+
unsigned int code[6];
|
33
33
|
};
|
34
34
|
|
35
|
-
#define DCTHUNK_SIZE_SPARC32
|
35
|
+
#define DCTHUNK_SIZE_SPARC32 24
|
36
36
|
|
37
37
|
#endif /* DYNCALL_THUNK_SPARC32_H */
|
38
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Thunk - Implementation for sparc64
|
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
|
@@ -28,6 +28,46 @@
|
|
28
28
|
|
29
29
|
void dcbInitThunk(DCThunk* p, void (*entry)())
|
30
30
|
{
|
31
|
-
/*
|
31
|
+
/* example
|
32
|
+
; put thunk pointer in g1
|
33
|
+
0: 03 00 00 00 sethi %hi(0), %g1
|
34
|
+
4: 82 10 60 00 or %g1, 0, %g1
|
35
|
+
8: 83 28 70 20 sllx %g1, 0x20, %g1
|
36
|
+
12: 21 00 00 00 sethi %hi(0), %l0
|
37
|
+
16: a0 14 20 00 or %l0, 0, %l0
|
38
|
+
20: 82 04 00 01 add %l0, %g1, %g1
|
39
|
+
; use g2 for entry pointer and "call" it, b/c branch instructions can't handle 64bit addresses
|
40
|
+
24: 05 00 00 00 sethi %hi(0), %g2
|
41
|
+
28: 84 10 a0 00 or %g2, 0, %g2
|
42
|
+
32: 85 28 b0 20 sllx %g2, 0x20, %g2
|
43
|
+
36: 21 00 00 00 sethi %hi(0), %l0
|
44
|
+
40: a0 14 20 00 or %l0, 0, %l0
|
45
|
+
44: 84 04 00 02 add %l0, %g2, %g2
|
46
|
+
; jump - write link to %g0, effectively discarding it; also nop for delay slot
|
47
|
+
48: 81 c0 80 00 jmpl %g2, %g0
|
48
|
+
52: 01 00 00 00 nop
|
49
|
+
*/
|
50
|
+
|
51
|
+
union {
|
52
|
+
unsigned int x[2];
|
53
|
+
void* p;
|
54
|
+
} t, e;
|
55
|
+
t.p = p;
|
56
|
+
e.p = entry;
|
57
|
+
|
58
|
+
p->code[ 0] = 0x03000000 | (t.x[0] >> 10); /* sethi %hi(p), %g1 -- hi 22 bits */
|
59
|
+
p->code[ 1] = 0x82106000 | (t.x[0] & 0x3ff); /* or %g1, <p&0x3ff>, %g1 -- lo 10 bits */
|
60
|
+
p->code[ 2] = 0x83287020; /* sllx %g1, 0x20, %g1 */
|
61
|
+
p->code[ 3] = 0x21000000 | (t.x[1] >> 10); /* sethi %hi(p), %l0 */
|
62
|
+
p->code[ 4] = 0xa0142000 | (t.x[1] & 0x3ff); /* or %l0, <p&0x3ff>, %l0 */
|
63
|
+
p->code[ 5] = 0x82040001; /* add %l0, %g1, %g1 */
|
64
|
+
p->code[ 6] = 0x05000000 | (e.x[0] >> 10); /* sethi %hi(entry), %g2 */
|
65
|
+
p->code[ 7] = 0x8410a000 | (e.x[0] & 0x3ff); /* or %g2, <entry&0x3ff>, %g2 */
|
66
|
+
p->code[ 8] = 0x8528b020; /* sllx %g2, 0x20, %g2 */
|
67
|
+
p->code[ 9] = 0x21000000 | (e.x[1] >> 10); /* sethi %hi(entry), %l0 */
|
68
|
+
p->code[10] = 0xa0142000 | (e.x[1] & 0x3ff); /* or %l0, <entry&0x3ff>, %l0 */
|
69
|
+
p->code[11] = 0x84040002; /* add %l0, %g2, %g2 */
|
70
|
+
p->code[12] = 0x81c08000; /* jmpl %g2, %g0 -- discards link addr */
|
71
|
+
p->code[13] = 0x01000000; /* nop */
|
32
72
|
}
|
33
73
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_thunk_sparc64.h
|
6
|
-
Description: Thunk - Header for sparc64
|
6
|
+
Description: Thunk - Header for sparc64
|
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
|
@@ -29,9 +29,9 @@
|
|
29
29
|
|
30
30
|
struct DCThunk_
|
31
31
|
{
|
32
|
-
int
|
32
|
+
unsigned int code[14];
|
33
33
|
};
|
34
34
|
|
35
|
-
#define DCTHUNK_SIZE_SPARC64
|
35
|
+
#define DCTHUNK_SIZE_SPARC64 56
|
36
36
|
|
37
|
-
#endif /*
|
37
|
+
#endif /* DYNCALL_THUNK_SPARC64_H */
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Thunk - Implementation for x64
|
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: Thunk - Header for x64
|
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,7 +33,7 @@ struct DCThunk_
|
|
33
33
|
void (*entry)();
|
34
34
|
};
|
35
35
|
|
36
|
-
#define DCTHUNK_X64_SIZE
|
36
|
+
#define DCTHUNK_X64_SIZE 24
|
37
37
|
|
38
38
|
|
39
39
|
#endif /* DYNCALL_THUNK_X64_H */
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Thunk - Implementation for x86
|
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: Thunk - Header for x86
|
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
|
@@ -35,6 +35,6 @@ struct DCThunk_
|
|
35
35
|
void (*addr_entry)();
|
36
36
|
};
|
37
37
|
|
38
|
-
#define DCTHUNK_X86_SIZE
|
38
|
+
#define DCTHUNK_X86_SIZE 16
|
39
39
|
|
40
40
|
#endif /* DYNCALL_THUNK_X86_H */
|
@@ -15,7 +15,6 @@
|
|
15
15
|
.\"
|
16
16
|
.Dd $Mdocdate$
|
17
17
|
.Dt dyncallback 3
|
18
|
-
.Os
|
19
18
|
.Sh NAME
|
20
19
|
.Nm dyncallback
|
21
20
|
.Nd callback interface of dyncall
|
@@ -40,14 +39,15 @@ dynamically over the arguments once called back.
|
|
40
39
|
.Fn dcbNewCallback
|
41
40
|
creates a new callback object, where
|
42
41
|
.Ar signature
|
43
|
-
is a signature string describing the function to be called back (see manual
|
44
|
-
format). This is needed for
|
42
|
+
is a signature string describing the function to be called back (see manual or
|
43
|
+
dyncall_signature.h for format). This is needed for
|
45
44
|
.Nm
|
46
45
|
dyncallback to correctly prepare the arguments passed in by the function that
|
47
46
|
calls the callback handler. Note that the handler doesn't return the value
|
48
|
-
specified in the signature, directly, but
|
49
|
-
|
50
|
-
|
47
|
+
specified in the signature, directly, but a signature character, specifying the
|
48
|
+
return value's type.
|
49
|
+
The return value itself is stored where the handler's
|
50
|
+
3rd parameter points to (see below).
|
51
51
|
.Ar funcptr
|
52
52
|
is a pointer to the
|
53
53
|
.Nm
|
@@ -107,13 +107,12 @@ char cbHandler(DCCallback* cb,
|
|
107
107
|
// .. do something ..
|
108
108
|
|
109
109
|
result->s = 1244;
|
110
|
-
return '
|
110
|
+
return 's';
|
111
111
|
}
|
112
112
|
.Ed
|
113
113
|
.Pp
|
114
114
|
Note that the return value of the handler is a signature character, not the
|
115
|
-
actual return value, itself
|
116
|
-
short.
|
115
|
+
actual return value, itself.
|
117
116
|
Now, let's call it through a DCCallback object:
|
118
117
|
.Bd -literal -offset indent
|
119
118
|
DCCallback* cb;
|
@@ -124,11 +123,17 @@ Now, let's call it through a DCCallback object:
|
|
124
123
|
(123, 23.f, 3, 1.82, 9909ll);
|
125
124
|
dcbFreeCallback(cb);
|
126
125
|
.Ed
|
126
|
+
.Sh CONFORMING TO
|
127
|
+
The dyncallback library needs at least a c99 compiler with additional support
|
128
|
+
for anonymous structs/unions (which were introduced officially in c11). Given
|
129
|
+
that those are generally supported by pretty much all major c99 conforming
|
130
|
+
compilers (as default extension), it should build fine with a c99 toolchain.
|
131
|
+
Strictly speaking, dyncall conforms to c11, though.
|
132
|
+
.Ed
|
127
133
|
.Sh SEE ALSO
|
128
134
|
.Xr dyncall 3 ,
|
129
135
|
.Xr dynload 3
|
130
|
-
and the dyncall manual (available in PDF format) for
|
131
|
-
library.
|
136
|
+
and the dyncall manual (available in HTML and PDF format) for more information.
|
132
137
|
.Sh AUTHORS
|
133
138
|
.An "Daniel Adler" Aq dadler@uni-goettingen.de
|
134
139
|
.An "Tassilo Philipp" Aq tphilipp@potion-studios.com
|
data/dyncall/dynload/dynload.3
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.\" Copyright (c) 2007-
|
1
|
+
.\" Copyright (c) 2007-2017 Daniel Adler <dadler AT uni-goettingen DOT de>,
|
2
2
|
.\" Tassilo Philipp <tphilipp AT potion-studios DOT com>
|
3
3
|
.\"
|
4
4
|
.\" Permission to use, copy, modify, and distribute this software for any
|
@@ -15,8 +15,6 @@
|
|
15
15
|
.\"
|
16
16
|
.Dd $Mdocdate$
|
17
17
|
.Dt dynload 3
|
18
|
-
.Os
|
19
|
-
|
20
18
|
.Sh NAME
|
21
19
|
.Nm dynload
|
22
20
|
.Nd encapsulates dynamic loading mechanisms and
|
@@ -28,7 +26,19 @@ gives access to functions in foreign dynamic libraries and code modules.
|
|
28
26
|
.Ft void
|
29
27
|
.Fn dlFreeLibrary "DLLib * pLib"
|
30
28
|
.Ft void *
|
31
|
-
.Fn dlFindSymbol "DLLib
|
29
|
+
.Fn dlFindSymbol "DLLib * pLib" "const char * pSymbolName"
|
30
|
+
.Ft int
|
31
|
+
.Fn dlGetLibraryPath "DLLib * pLib" "char * sOut" "int bufSize"
|
32
|
+
.Ft DLSyms*
|
33
|
+
.Fn dlSymsInit "const char * libPath"
|
34
|
+
.Ft void
|
35
|
+
.Fn dlSymsCleanup "DLSyms * pSyms"
|
36
|
+
.Ft int
|
37
|
+
.Fn dlSymsCount "DLSyms * pSyms"
|
38
|
+
.Ft const char*
|
39
|
+
.Fn dlSymsName "DLSyms * pSyms" "int index"
|
40
|
+
.Ft const char*
|
41
|
+
.Fn dlSymsNameFromValue "DLSyms * pSyms" "void * value"
|
32
42
|
.Sh DESCRIPTION
|
33
43
|
The
|
34
44
|
.Nm
|
@@ -42,7 +52,9 @@ and returns a handle to it for use in
|
|
42
52
|
.Fn dlFreeLibrary
|
43
53
|
and
|
44
54
|
.Fn dlFindSymbol
|
45
|
-
calls.
|
55
|
+
calls. Passing a null pointer for the
|
56
|
+
.Ar libpath
|
57
|
+
argument is valid, and returns a handle to the main executable of the calling code. Also, searching libraries in library paths (e.g. by just passing the library's leaf name) should work, however, they are OS specific. Returns a null pointer on error.
|
46
58
|
.Pp
|
47
59
|
.Fn dlFreeLibrary
|
48
60
|
frees the loaded library with handle
|
@@ -53,12 +65,55 @@ returns a pointer to a symbol with name
|
|
53
65
|
.Ar pSymbolName
|
54
66
|
in the library with handle
|
55
67
|
.Ar pLib ,
|
56
|
-
or returns a null pointer if the symbol cannot be found.
|
68
|
+
or returns a null pointer if the symbol cannot be found. The name is specified as it would appear in C source code (mangled if C++, etc.).
|
69
|
+
.Pp
|
70
|
+
.Fn dlGetLibraryPath
|
71
|
+
can be used to get a copy of the path to the library loaded with handle
|
72
|
+
.Ar pLib .
|
73
|
+
The parameter
|
74
|
+
.Ar sOut
|
75
|
+
is a pointer to a buffer of size
|
76
|
+
.Ar bufSize
|
77
|
+
(in bytes), to hold the output string. The return value is the size of the buffer (in bytes) needed to hold the null-terminated string, or 0 if it can't be looked up. If
|
78
|
+
.Ar bufSize
|
79
|
+
>= return value > 1, a null-terminted string with the path to the library should be in
|
80
|
+
.Ar sOut .
|
81
|
+
If it returns 0, the library name wasn't able to be found. Please note that this might happen in some rare cases, so make sure to always check.
|
82
|
+
.Pp
|
83
|
+
The dlSyms* functions can be used to iterate over symbols. Since they can be used on libraries that are not linked, they are made
|
84
|
+
for symbol name lookups, not to get symbols' addresses. For that refer to
|
85
|
+
.Fn dlFindSymbol .
|
86
|
+
.Fn dlSymsInit
|
87
|
+
will return a handle (or null pointer on error) to the shared object specified by
|
88
|
+
.Ar libPath ,
|
89
|
+
to be used with the other dlSyms* functions. Note that contrary to loading and linking libraries, no (OS-specific) rules for searching libraries in library paths, etc. apply. The handle must be freed with
|
90
|
+
.Fn dlSymsCleanup .
|
91
|
+
.Fn dlSymsCount
|
92
|
+
returns the number of symbols in the shared object,
|
93
|
+
.Fn dlSymsName
|
94
|
+
and
|
95
|
+
.Fn dlSymsNameFromValue
|
96
|
+
are used to lookup symbol names using an index or symbol's address, respectively, returning a null pointer on error. The names are returned as they would appear in C source code (mangled if C++, etc.). The address passed to
|
97
|
+
.Fn dlSymsNameFromValue
|
98
|
+
must point to a loaded symbol.
|
99
|
+
.Sh BUGS
|
100
|
+
.Fn dlGetLibraryPath
|
101
|
+
is not thread-safe on Darwin (macOS, iOS, ...) and OpenBSD.
|
102
|
+
.Fn dlSymsInit
|
103
|
+
is not thread-safe on Darwin.
|
104
|
+
.Fn dlGetLibraryPath
|
105
|
+
will not work on the following platforms when the library in question doesn't have the (default)
|
106
|
+
.Fn _init
|
107
|
+
and
|
108
|
+
.Fn _fini
|
109
|
+
symbols exported (rare, but possible): Haiku (all versions), OpenBSD < 3.7, NetBSD < 5.1, FreeBSD < 4.8
|
110
|
+
.Sh CONFORMING TO
|
111
|
+
The dynload library conforms to c99.
|
112
|
+
.Ed
|
57
113
|
.Sh SEE ALSO
|
58
114
|
.Xr dyncall 3 ,
|
59
115
|
.Xr dyncallback 3
|
60
|
-
and the dyncall manual (available in PDF format) for
|
61
|
-
library.
|
116
|
+
and the dyncall manual (available in HTML and PDF format) for more information.
|
62
117
|
.Sh AUTHORS
|
63
118
|
.An "Daniel Adler" Aq dadler@uni-goettingen.de
|
64
119
|
.An "Tassilo Philipp" Aq tphilipp@potion-studios.com
|
data/dyncall/dynload/dynload.c
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Auto-include delegate to windows/posix-based dynamic linker.
|
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
|
@@ -24,16 +24,10 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
-
|
28
27
|
#include "../autovar/autovar_OSFAMILY.h"
|
29
28
|
#if defined(OSFAMILY_Windows)
|
30
29
|
# include "dynload_windows.c"
|
31
30
|
#elif defined(OSFAMILY_Unix)
|
32
|
-
# include "
|
33
|
-
# if defined(OS_Darwin)
|
34
|
-
# include "dynload_darwin.c"
|
35
|
-
# else
|
36
|
-
# include "dynload_unix.c"
|
37
|
-
# endif
|
31
|
+
# include "dynload_unix.c"
|
38
32
|
#endif
|
39
33
|
|