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: Callback - Implementation Header for ppc32
|
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
|
@@ -25,7 +25,20 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
#include "dyncall_callback.h"
|
28
|
-
#include "
|
28
|
+
#include "dyncall_alloc_wx.h"
|
29
|
+
#include "dyncall_thunk.h"
|
30
|
+
|
31
|
+
/* Callback symbol. */
|
32
|
+
extern void dcCallbackThunkEntry();
|
33
|
+
|
34
|
+
struct DCCallback
|
35
|
+
{
|
36
|
+
DCThunk thunk; /* offset 0 size 24 */
|
37
|
+
DCCallbackHandler* handler; /* offset 24 size 4 */
|
38
|
+
size_t stack_cleanup; /* offset 28 size 4 */
|
39
|
+
void* userdata; /* offset 32 size 4 */
|
40
|
+
}; /* total size 36 */
|
41
|
+
|
29
42
|
|
30
43
|
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
31
44
|
{
|
@@ -36,17 +49,22 @@ void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler*
|
|
36
49
|
pcb->userdata = userdata;
|
37
50
|
}
|
38
51
|
|
39
|
-
extern void dcCallbackThunkEntry();
|
40
|
-
|
41
52
|
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
42
53
|
{
|
43
54
|
DCCallback* pcb;
|
44
55
|
int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
45
|
-
if
|
56
|
+
if(err)
|
57
|
+
return NULL;
|
46
58
|
|
47
59
|
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
48
60
|
dcbInitCallback(pcb, signature, handler, userdata);
|
49
61
|
|
62
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
63
|
+
if(err) {
|
64
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
65
|
+
return NULL;
|
66
|
+
}
|
67
|
+
|
50
68
|
return pcb;
|
51
69
|
}
|
52
70
|
|
@@ -23,99 +23,90 @@
|
|
23
23
|
|
24
24
|
*/
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
.machine ppc
|
27
|
+
.text
|
28
|
+
.align 2
|
29
29
|
|
30
30
|
/* Callback Thunk Entry code for PowerPC 32-bit Darwin/Apple Mac OS X. */
|
31
31
|
|
32
32
|
|
33
33
|
/* Stack Frame Layout:
|
34
|
-
|
35
|
-
204 DCValue ( )
|
36
|
-
56 DCArgs (32+104+4+8 = 148)
|
37
|
-
24 Parameter area ( 4*8 = 32 )
|
38
|
-
0 Linkage area ( 24 )
|
39
34
|
|
35
|
+
204 DCValue ()
|
36
|
+
56 DCArgs (32+104+4+8 = 148)
|
37
|
+
24 Parameter area (4*8 = 32)
|
38
|
+
0 Linkage area (24)
|
40
39
|
|
41
40
|
*/
|
42
41
|
|
43
42
|
/* Constants. */
|
44
|
-
INT_REGS
|
45
|
-
FLOAT_REGS
|
46
|
-
SIZEOF_INT
|
47
|
-
SIZEOF_DOUBLE
|
43
|
+
INT_REGS = 8
|
44
|
+
FLOAT_REGS = 13
|
45
|
+
SIZEOF_INT = 4
|
46
|
+
SIZEOF_DOUBLE = 8
|
47
|
+
|
48
48
|
|
49
|
-
|
50
49
|
/* Linkage area. */
|
51
|
-
LINK_SP
|
52
|
-
LINK_CR
|
53
|
-
LINK_LR
|
54
|
-
LINK_OFFSET
|
55
|
-
LINK_SIZE
|
50
|
+
LINK_SP = 0
|
51
|
+
LINK_CR = 4
|
52
|
+
LINK_LR = 8
|
53
|
+
LINK_OFFSET = 0
|
54
|
+
LINK_SIZE = 24
|
56
55
|
/* Parameter area. */
|
57
|
-
PAR_OFFSET
|
58
|
-
PAR_SIZE
|
56
|
+
PAR_OFFSET = LINK_SIZE
|
57
|
+
PAR_SIZE = 32
|
59
58
|
/* local struct DCArgs */
|
60
|
-
ARGS_OFFSET
|
61
|
-
ARGS_SIZE
|
59
|
+
ARGS_OFFSET = (PAR_OFFSET+PAR_SIZE)
|
60
|
+
ARGS_SIZE = (SIZEOF_INT*INT_REGS)+(SIZEOF_DOUBLE*FLOAT_REGS) /* = 136 */
|
62
61
|
/* local struct DCValue */
|
63
|
-
RESULT_OFFSET
|
64
|
-
RESULT_SIZE
|
62
|
+
RESULT_OFFSET = (ARGS_OFFSET+ARGS_SIZE)
|
63
|
+
RESULT_SIZE = 16
|
65
64
|
/* additional locals (reg 30/31) */
|
66
|
-
LOCALS_OFFSET
|
67
|
-
LOCALS_SIZE
|
65
|
+
LOCALS_OFFSET = (RESULT_OFFSET+RESULT_SIZE)
|
66
|
+
LOCALS_SIZE = 2*SIZEOF_INT
|
68
67
|
/* total */
|
69
|
-
FRAME_SIZE
|
68
|
+
FRAME_SIZE = ((LOCALS_OFFSET+LOCALS_SIZE)+15 & (-16))
|
70
69
|
|
71
70
|
/* struct DCCallback */
|
72
|
-
DCB_THUNK
|
73
|
-
DCB_HANDLER
|
74
|
-
DCB_STACKCLEAN
|
75
|
-
DCB_USERDATA
|
71
|
+
DCB_THUNK = 0
|
72
|
+
DCB_HANDLER = 24
|
73
|
+
DCB_STACKCLEAN = 28
|
74
|
+
DCB_USERDATA = 32
|
76
75
|
|
77
76
|
/* struct DCArgs */
|
78
|
-
DCA_IARRAY
|
79
|
-
DCA_FARRAY
|
80
|
-
DCA_SP
|
81
|
-
DCA_ICOUNT
|
82
|
-
DCA_FCOUNT
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
fcount = ARGS_OFFSET+DCA_FCOUNT
|
97
|
-
.globl _dcCallbackThunkEntry
|
98
|
-
|
99
|
-
/*
|
100
|
-
Thunk entry:
|
101
|
-
R2 = DCCallback*
|
102
|
-
*/
|
77
|
+
DCA_IARRAY = 0
|
78
|
+
DCA_FARRAY = SIZEOF_INT*INT_REGS
|
79
|
+
DCA_SP = DCA_FARRAY + SIZEOF_DOUBLE*FLOAT_REGS
|
80
|
+
DCA_ICOUNT = DCA_SP + 4
|
81
|
+
DCA_FCOUNT = DCA_ICOUNT + 4
|
82
|
+
|
83
|
+
iregfile = ARGS_OFFSET+DCA_IARRAY
|
84
|
+
fregfile = ARGS_OFFSET+DCA_FARRAY
|
85
|
+
save_sp = ARGS_OFFSET+DCA_SP
|
86
|
+
icount = ARGS_OFFSET+DCA_ICOUNT
|
87
|
+
fcount = ARGS_OFFSET+DCA_FCOUNT
|
88
|
+
|
89
|
+
.globl _dcCallbackThunkEntry
|
90
|
+
|
91
|
+
/*
|
92
|
+
Thunk entry:
|
93
|
+
r2 = DCCallback*
|
94
|
+
*/
|
103
95
|
_dcCallbackThunkEntry:
|
104
96
|
|
105
|
-
mflr
|
106
|
-
stw
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
stw
|
111
|
-
stw
|
112
|
-
stw
|
113
|
-
stw
|
114
|
-
stw
|
115
|
-
stw
|
116
|
-
stw
|
117
|
-
|
118
|
-
stfd f1, fregfile+ 0*8(r1) /* spill 13 float parameter registers */
|
97
|
+
mflr r0
|
98
|
+
stw r0, 8(r1) /* store return address */
|
99
|
+
addi r12,r1, PAR_OFFSET /* temporary r12 = parameter area on callers stack frame */
|
100
|
+
stwu r1, -FRAME_SIZE(r1) /* save callers stack pointer and make new stack frame. */
|
101
|
+
stw r3, iregfile+ 0*4(r1) /* spill 8 integer parameter registers */
|
102
|
+
stw r4, iregfile+ 1*4(r1)
|
103
|
+
stw r5, iregfile+ 2*4(r1)
|
104
|
+
stw r6, iregfile+ 3*4(r1)
|
105
|
+
stw r7, iregfile+ 4*4(r1)
|
106
|
+
stw r8, iregfile+ 5*4(r1)
|
107
|
+
stw r9, iregfile+ 6*4(r1)
|
108
|
+
stw r10,iregfile+ 7*4(r1)
|
109
|
+
stfd f1, fregfile+ 0*8(r1) /* spill 13 float parameter registers */
|
119
110
|
stfd f2, fregfile+ 1*8(r1)
|
120
111
|
stfd f3, fregfile+ 2*8(r1)
|
121
112
|
stfd f4, fregfile+ 3*8(r1)
|
@@ -128,54 +119,38 @@ _dcCallbackThunkEntry:
|
|
128
119
|
stfd f11,fregfile+10*8(r1)
|
129
120
|
stfd f12,fregfile+11*8(r1)
|
130
121
|
stfd f13,fregfile+12*8(r1)
|
131
|
-
|
132
|
-
stw
|
133
|
-
xor
|
134
|
-
stw
|
135
|
-
stw
|
136
|
-
|
137
|
-
mr
|
138
|
-
addi
|
139
|
-
addi
|
140
|
-
lwz
|
141
|
-
|
142
|
-
|
143
|
-
lwz
|
144
|
-
mtctr
|
122
|
+
/* initialize struct DCCallback */
|
123
|
+
stw r12,save_sp(r1) /* init stack pointer */
|
124
|
+
xor r0, r0, r0 /* init register counters */
|
125
|
+
stw r0, icount(r1)
|
126
|
+
stw r0, fcount(r1)
|
127
|
+
/* invoke callback handler */
|
128
|
+
mr r3, r2 /* arg 1: DCCallback* pcb */
|
129
|
+
addi r4, r1, ARGS_OFFSET /* arg 2: DCArgs* args */
|
130
|
+
addi r5, r1, RESULT_OFFSET /* arg 3: DCValue* result */
|
131
|
+
lwz r6, DCB_USERDATA(r2) /* arg 4: void* userdata */
|
132
|
+
|
133
|
+
/* branch-and-link to DCCallback.handler */
|
134
|
+
lwz r12,DCB_HANDLER(r2)
|
135
|
+
mtctr r12
|
145
136
|
bctrl
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
b
|
162
|
-
.i32: /* result is integer <= 32-bit result */
|
163
|
-
lwz r3, RESULT_OFFSET + DCV_INT(r1)
|
164
|
-
b .end
|
165
|
-
.f32: /* result is C float result */
|
166
|
-
lfs f1, RESULT_OFFSET + DCV_FLOAT(r1)
|
167
|
-
b .end
|
137
|
+
/* switch on base result type */
|
138
|
+
cmpi cr0, r3, 0x66 /* 'f */
|
139
|
+
beq .f32
|
140
|
+
cmpi cr0, r3, 0x64 /* 'd */
|
141
|
+
beq .f64
|
142
|
+
.i64:
|
143
|
+
lwz r3, RESULT_OFFSET (r1)
|
144
|
+
lwz r4, RESULT_OFFSET + 4 (r1)
|
145
|
+
.end:
|
146
|
+
lwz r1, 0(r1) /* restore stack pointer */
|
147
|
+
lwz r0, 8(r1) /* load link register with return address */
|
148
|
+
mtlr r0
|
149
|
+
blr /* branch back to link register */
|
150
|
+
.f32:
|
151
|
+
lfs f1, RESULT_OFFSET(r1)
|
152
|
+
b .end
|
168
153
|
.f64:
|
169
|
-
lfd
|
170
|
-
b .end
|
171
|
-
.i64: /* result is C double result */
|
172
|
-
lwz r3, RESULT_OFFSET + DCV_LONG_HI32(r1)
|
173
|
-
lwz r4, RESULT_OFFSET + DCV_LONG_LO32(r1)
|
154
|
+
lfd f1, RESULT_OFFSET(r1)
|
174
155
|
b .end
|
175
|
-
.end:
|
176
|
-
lwz r1, 0(r1) /* restore stack pointer */
|
177
|
-
/* lmw r30, -8(r1) */ /* restore preserved registers */
|
178
|
-
lwz r0, 8(r1) /* load link register with return address */
|
179
|
-
mtlr r0
|
180
|
-
blr /* branch back to link register */
|
181
156
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback - Implementation Header for ppc64
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2014-
|
9
|
+
Copyright (c) 2014-2016 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
|
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
|
@@ -24,7 +24,20 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
#include "dyncall_callback.h"
|
27
|
-
#include "
|
27
|
+
#include "dyncall_alloc_wx.h"
|
28
|
+
#include "dyncall_thunk.h"
|
29
|
+
|
30
|
+
/* Callback symbol. */
|
31
|
+
extern void dcCallbackThunkEntry();
|
32
|
+
|
33
|
+
struct DCCallback /* ELF v1 | ELF v2 */
|
34
|
+
{ /* ------------------+------------------ */
|
35
|
+
DCThunk thunk; /* offset 0 size 64 | offset 0 size 48 */
|
36
|
+
DCCallbackHandler* handler; /* offset 64 size 8 | offset 48 size 8 */
|
37
|
+
size_t stack_cleanup; /* offset 72 size 8 | offset 56 size 8 */
|
38
|
+
void* userdata; /* offset 80 size 8 | offset 64 size 8 */
|
39
|
+
};
|
40
|
+
|
28
41
|
|
29
42
|
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
30
43
|
{
|
@@ -35,17 +48,22 @@ void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler*
|
|
35
48
|
pcb->userdata = userdata;
|
36
49
|
}
|
37
50
|
|
38
|
-
extern void dcCallbackThunkEntry();
|
39
|
-
|
40
51
|
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
41
52
|
{
|
42
53
|
DCCallback* pcb;
|
43
54
|
int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
44
|
-
if
|
55
|
+
if(err)
|
56
|
+
return NULL;
|
45
57
|
|
46
58
|
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
47
59
|
dcbInitCallback(pcb, signature, handler, userdata);
|
48
60
|
|
61
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
62
|
+
if(err) {
|
63
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
64
|
+
return NULL;
|
65
|
+
}
|
66
|
+
|
49
67
|
return pcb;
|
50
68
|
}
|
51
69
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_callback_sparc32.c
|
6
|
-
Description: Callback - Implementation for sparc32
|
6
|
+
Description: Callback - 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
|
@@ -25,25 +25,42 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
#include "dyncall_callback.h"
|
28
|
-
#include "dyncall_callback_sparc32.h"
|
29
|
-
|
30
28
|
#include "dyncall_alloc_wx.h"
|
29
|
+
#include "dyncall_thunk.h"
|
30
|
+
|
31
|
+
/* Callback symbol. */
|
32
|
+
extern void dcCallbackThunkEntry();
|
33
|
+
|
34
|
+
struct DCCallback
|
35
|
+
{
|
36
|
+
DCThunk thunk; /* offset 0 size 24 */
|
37
|
+
DCCallbackHandler* handler; /* offset 24 size 4 */
|
38
|
+
void* userdata; /* offset 28 size 4 */
|
39
|
+
};
|
40
|
+
|
31
41
|
|
32
42
|
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
33
43
|
{
|
44
|
+
pcb->handler = handler;
|
45
|
+
pcb->userdata = userdata;
|
34
46
|
}
|
35
47
|
|
36
|
-
extern void dcCallbackThunkEntry();
|
37
|
-
|
38
48
|
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
39
49
|
{
|
40
50
|
DCCallback* pcb;
|
41
51
|
int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
42
|
-
if
|
52
|
+
if(err)
|
53
|
+
return NULL;
|
43
54
|
|
44
55
|
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
45
56
|
dcbInitCallback(pcb, signature, handler, userdata);
|
46
57
|
|
58
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
59
|
+
if(err) {
|
60
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
61
|
+
return NULL;
|
62
|
+
}
|
63
|
+
|
47
64
|
return pcb;
|
48
65
|
}
|
49
66
|
|
@@ -56,3 +73,4 @@ void* dcbGetUserData(DCCallback* pcb)
|
|
56
73
|
{
|
57
74
|
return pcb->userdata;
|
58
75
|
}
|
76
|
+
|
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_callback_sparc32.s
|
6
|
-
Description: Callback
|
6
|
+
Description: Callback - Implementation for Sparc 32-bit
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2007-
|
9
|
+
Copyright (c) 2007-2017 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,8 +23,59 @@
|
|
23
23
|
|
24
24
|
*/
|
25
25
|
|
26
|
+
/* input:
|
27
|
+
$i0 -> thunk
|
28
|
+
$i0+24 -> cb handler
|
29
|
+
$i0+28 -> userdata
|
30
|
+
*/
|
31
|
+
|
32
|
+
.text
|
26
33
|
.globl dcCallbackThunkEntry
|
34
|
+
|
35
|
+
/* Called by thunk - thunk stores pointer to DCCallback */
|
36
|
+
/* in %g1, and pointer to called function in %g2 */
|
27
37
|
dcCallbackThunkEntry:
|
28
|
-
|
29
|
-
|
38
|
+
|
39
|
+
/* Prolog. */
|
40
|
+
/* Frame size of 104b comes from needing storage space for the following: */
|
41
|
+
/* req_reg_save_area:64 + spill:24 + dcargs:4 + retval:8 + pad:4 */
|
42
|
+
/* Spill area could theoretically be only 16b, b/c cbHandler function has */
|
43
|
+
/* 4 arguments, but let's be conservative. */ /* cbHandler function might decide to spill (6x4b) @@@ testcode, or rely on 8byte return space in parent stack */
|
44
|
+
save %sp, -104, %sp
|
45
|
+
|
46
|
+
/* Spill register args as dcargs is based on that (in prev frame, after */
|
47
|
+
/* req_reg_save_area and struct_ret_ptr). */
|
48
|
+
add %fp, 68, %l0
|
49
|
+
st %i0, [ %l0 + 0 ] /* reg arg 0 */
|
50
|
+
st %i1, [ %l0 + 4 ] /* reg arg 1 */
|
51
|
+
st %i2, [ %l0 + 8 ] /* reg arg 2 */
|
52
|
+
st %i3, [ %l0 + 12 ] /* reg arg 3 */
|
53
|
+
st %i4, [ %l0 + 16 ] /* reg arg 4 */
|
54
|
+
st %i5, [ %l0 + 20 ] /* reg arg 5 */
|
55
|
+
st %l0, [ %sp + 88 ] /* init arg_ptr */
|
56
|
+
|
57
|
+
/* Zero retval store. */
|
58
|
+
st %g0, [ %sp + 96 ]
|
59
|
+
st %g0, [ %sp + 100 ]
|
60
|
+
|
61
|
+
/* Prepare callback handler call. */
|
62
|
+
mov %g1, %o0 /* Param 0 = DCCallback*, %g1 holds ptr to thunk */
|
63
|
+
add %sp, 88, %o1 /* Param 1 = DCArgs* (ptr to struct with args ptr) */
|
64
|
+
add %sp, 96, %o2 /* Param 2 = results ptr to 8b of local stack data */
|
65
|
+
ld [ %g1 + 28 ], %o3 /* Param 3 = userdata ptr */
|
66
|
+
|
67
|
+
ld [ %g1 + 24 ], %l0
|
68
|
+
call %l0
|
69
|
+
nop
|
70
|
+
|
71
|
+
/* Put retval in %i0/%i1 (to be in caller's %o0/%o1), and %f0/%f1. */
|
72
|
+
ld [ %sp + 96 ], %i0
|
73
|
+
ld [ %sp + 100 ], %i1
|
74
|
+
ld [ %sp + 96 ], %f0
|
75
|
+
ld [ %sp + 100 ], %f1
|
76
|
+
|
77
|
+
/* Epilog. */
|
78
|
+
restore /* unshift reg window */
|
79
|
+
retl /* Return from proc. -- jmpl %i7 + 8, %g0 */
|
80
|
+
nop
|
30
81
|
|