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
@@ -3,10 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_callback_sparc64.c
|
6
|
-
Description: Callback - Implementation for sparc64
|
6
|
+
Description: Callback - 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
|
@@ -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 56 */
|
37
|
+
DCCallbackHandler* handler; /* offset 56, size 8 */
|
38
|
+
void* userdata; /* offset 64, size 8 */
|
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,11 +3,10 @@
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
5
|
File: dyncallback/dyncall_callback_sparc64.s
|
6
|
-
Description: Callback
|
6
|
+
Description: Callback - Implementation for Sparc 64-bit
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c)
|
10
|
-
Tassilo Philipp <tphilipp@potion-studios.com>
|
9
|
+
Copyright (c) 2017 Tassilo Philipp <tphilipp@potion-studios.com>
|
11
10
|
|
12
11
|
Permission to use, copy, modify, and distribute this software for any
|
13
12
|
purpose with or without fee is hereby granted, provided that the above
|
@@ -23,8 +22,93 @@
|
|
23
22
|
|
24
23
|
*/
|
25
24
|
|
25
|
+
/* input:
|
26
|
+
$i0 -> thunk
|
27
|
+
$i0+56 -> cb handler
|
28
|
+
$i0+64 -> userdata
|
29
|
+
*/
|
30
|
+
|
31
|
+
/* NOTE: %sp/%fp for v9 are offset, using them needs a "BIAS" of 2047 */
|
32
|
+
BIAS = 2047
|
33
|
+
|
34
|
+
.text
|
26
35
|
.globl dcCallbackThunkEntry
|
36
|
+
|
37
|
+
/* Called by thunk - thunk stores pointer to DCCallback */
|
38
|
+
/* in %g1, and pointer to called function in %g2 */
|
27
39
|
dcCallbackThunkEntry:
|
28
|
-
|
29
|
-
|
40
|
+
|
41
|
+
/* Prolog. */
|
42
|
+
/* Frame size of 336b comes from needing storage space for the following: */
|
43
|
+
/* req_reg_save_area:128 + spill:48 + dcargs:144 + retval:8 + pad:8 */
|
44
|
+
/* Spill area could theoretically be only 32b, b/c cbHandler function has */
|
45
|
+
/* 4 arguments, but let's be conservative. */
|
46
|
+
save %sp, -336, %sp
|
47
|
+
|
48
|
+
/* Spill register args as dcargs is based on that (in prev frame, after */
|
49
|
+
/* req_reg_save_area). */
|
50
|
+
add %fp, BIAS + 128, %l0
|
51
|
+
stx %i0, [ %l0 + 0 ] /* reg arg 0 */
|
52
|
+
stx %i1, [ %l0 + 8 ] /* reg arg 1 */
|
53
|
+
stx %i2, [ %l0 + 16 ] /* reg arg 2 */
|
54
|
+
stx %i3, [ %l0 + 24 ] /* reg arg 3 */
|
55
|
+
stx %i4, [ %l0 + 32 ] /* reg arg 4 */
|
56
|
+
stx %i5, [ %l0 + 40 ] /* reg arg 5 */
|
57
|
+
stx %l0, [ %sp + BIAS + 176 ] /* set DCArg's arg_ptr */
|
58
|
+
st %f0, [ %sp + BIAS + 184 ] /* store fp args in DCArgs's dreg_data */
|
59
|
+
st %f1, [ %sp + BIAS + 188 ] /* @@@ I think stx should work to store */
|
60
|
+
st %f2, [ %sp + BIAS + 192 ] /* all 64bits, but I get "Illegal */
|
61
|
+
st %f3, [ %sp + BIAS + 196 ] /* Operands", so using single prec. */
|
62
|
+
st %f4, [ %sp + BIAS + 200 ] /* store (st) */
|
63
|
+
st %f5, [ %sp + BIAS + 204 ]
|
64
|
+
st %f6, [ %sp + BIAS + 208 ]
|
65
|
+
st %f7, [ %sp + BIAS + 212 ]
|
66
|
+
st %f8, [ %sp + BIAS + 216 ]
|
67
|
+
st %f9, [ %sp + BIAS + 220 ]
|
68
|
+
st %f10, [ %sp + BIAS + 224 ]
|
69
|
+
st %f11, [ %sp + BIAS + 228 ]
|
70
|
+
st %f12, [ %sp + BIAS + 232 ]
|
71
|
+
st %f13, [ %sp + BIAS + 236 ]
|
72
|
+
st %f14, [ %sp + BIAS + 240 ]
|
73
|
+
st %f15, [ %sp + BIAS + 244 ]
|
74
|
+
st %f16, [ %sp + BIAS + 248 ]
|
75
|
+
st %f17, [ %sp + BIAS + 252 ]
|
76
|
+
st %f18, [ %sp + BIAS + 256 ]
|
77
|
+
st %f19, [ %sp + BIAS + 260 ]
|
78
|
+
st %f20, [ %sp + BIAS + 264 ]
|
79
|
+
st %f21, [ %sp + BIAS + 268 ]
|
80
|
+
st %f22, [ %sp + BIAS + 272 ]
|
81
|
+
st %f23, [ %sp + BIAS + 276 ]
|
82
|
+
st %f24, [ %sp + BIAS + 280 ]
|
83
|
+
st %f25, [ %sp + BIAS + 284 ]
|
84
|
+
st %f26, [ %sp + BIAS + 288 ]
|
85
|
+
st %f27, [ %sp + BIAS + 292 ]
|
86
|
+
st %f28, [ %sp + BIAS + 296 ]
|
87
|
+
st %f29, [ %sp + BIAS + 300 ]
|
88
|
+
st %f30, [ %sp + BIAS + 304 ]
|
89
|
+
st %f31, [ %sp + BIAS + 308 ]
|
90
|
+
stx %g0, [ %sp + BIAS + 312 ] /* init DCArg's i */
|
91
|
+
|
92
|
+
/* Zero retval store. */
|
93
|
+
stx %g0, [ %sp + BIAS + 320 ]
|
94
|
+
|
95
|
+
/* Prepare callback handler call. */
|
96
|
+
mov %g1, %o0 /* Param 0 = DCCallback*, %g1 holds ptr to thunk */
|
97
|
+
add %sp, BIAS + 176, %o1 /* Param 1 = DCArgs* (ptr to struct with args ptr) */
|
98
|
+
add %sp, BIAS + 320, %o2 /* Param 2 = results ptr to 8b of local stack data */
|
99
|
+
ldx [ %g1 + 64 ], %o3 /* Param 3 = userdata ptr */
|
100
|
+
|
101
|
+
/* Fetch callback handler address (after thunk blob) and call. */
|
102
|
+
ldx [ %g1 + 56 ], %l0
|
103
|
+
call %l0
|
104
|
+
nop
|
105
|
+
|
106
|
+
/* Put retval in %i0 (to be in caller's %o0), and %f0. */
|
107
|
+
ldx [ %sp + BIAS + 320 ], %i0
|
108
|
+
ldd [ %sp + BIAS + 320 ], %f0
|
109
|
+
|
110
|
+
/* Epilog. */
|
111
|
+
restore /* unshift reg window */
|
112
|
+
retl /* Return from proc. -- jmpl %i7 + 8, %g0 */
|
113
|
+
nop
|
30
114
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback Thunk entry for x64 (portasm version)
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2011-
|
9
|
+
Copyright (c) 2011-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
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
#include "../portasm/portasm-x64
|
27
|
+
#include "../portasm/portasm-x64.S"
|
28
28
|
|
29
29
|
/* structure sizes */
|
30
30
|
|
@@ -58,7 +58,7 @@ SET(DCCallback_size,40)
|
|
58
58
|
|
59
59
|
GLOBAL(dcCallback_x64_sysv)
|
60
60
|
BEGIN_PROC(dcCallback_x64_sysv)
|
61
|
-
|
61
|
+
|
62
62
|
PUSH(RBP)
|
63
63
|
MOV(RSP,RBP)
|
64
64
|
|
@@ -66,7 +66,7 @@ BEGIN_PROC(dcCallback_x64_sysv)
|
|
66
66
|
|
67
67
|
/* float parameters (8 registers spill to DCArgs) */
|
68
68
|
|
69
|
-
SUB(LIT(8*8),RSP)
|
69
|
+
SUB(LIT(8*8),RSP)
|
70
70
|
|
71
71
|
MOVSD(XMM7, QWORD(RSP,8*7)) /* struct offset 120: float parameter 7 */
|
72
72
|
MOVSD(XMM6, QWORD(RSP,8*6)) /* struct offset 112: float parameter 6 */
|
@@ -95,7 +95,7 @@ BEGIN_PROC(dcCallback_x64_sysv)
|
|
95
95
|
PUSH(RDX)
|
96
96
|
|
97
97
|
MOV(RSP,RSI) /* arg 1 RSI : DCArgs* */
|
98
|
-
|
98
|
+
|
99
99
|
/* initialize DCValue */
|
100
100
|
|
101
101
|
PUSH(LIT(0)) /* struct offset 0: return value (max long long) */
|
@@ -121,7 +121,7 @@ END_PROC(dcCallback_x64_sysv)
|
|
121
121
|
|
122
122
|
GLOBAL(dcCallback_x64_win64)
|
123
123
|
BEGIN_PROC(dcCallback_x64_win64)
|
124
|
-
|
124
|
+
|
125
125
|
PUSH(RBP)
|
126
126
|
MOV(RSP,RBP)
|
127
127
|
|
@@ -129,7 +129,7 @@ BEGIN_PROC(dcCallback_x64_win64)
|
|
129
129
|
|
130
130
|
/* float parameters (4 registers spill to DCArgs) */
|
131
131
|
|
132
|
-
SUB(LIT(4*8),RSP)
|
132
|
+
SUB(LIT(4*8),RSP)
|
133
133
|
|
134
134
|
MOVSD(XMM3, QWORD(RSP,8*3)) /* struct offset 72: float parameter 3 */
|
135
135
|
MOVSD(XMM2, QWORD(RSP,8*2)) /* struct offset 64: float parameter 2 */
|
@@ -174,7 +174,7 @@ BEGIN_PROC(dcCallback_x64_win64)
|
|
174
174
|
POP(RBP)
|
175
175
|
RET()
|
176
176
|
|
177
|
-
END_PROC(dcCallback_x64_win64)
|
177
|
+
END_PROC(dcCallback_x64_win64)
|
178
178
|
|
179
179
|
END_ASM
|
180
180
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback - 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
|
@@ -24,16 +24,21 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
-
|
28
|
-
#include "dyncall_callback_x64.h"
|
29
|
-
#include "dyncall_args_x64.h"
|
27
|
+
#include "dyncall_callback.h"
|
30
28
|
#include "dyncall_alloc_wx.h"
|
31
|
-
|
29
|
+
#include "dyncall_thunk.h"
|
32
30
|
|
33
31
|
/* Callback symbol. */
|
34
32
|
extern void dcCallback_x64_sysv();
|
35
33
|
extern void dcCallback_x64_win64();
|
36
34
|
|
35
|
+
struct DCCallback
|
36
|
+
{
|
37
|
+
DCThunk thunk; // offset 0, size 24
|
38
|
+
DCCallbackHandler* handler; // offset 24
|
39
|
+
void* userdata; // offset 32
|
40
|
+
};
|
41
|
+
|
37
42
|
|
38
43
|
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
39
44
|
{
|
@@ -47,7 +52,8 @@ DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, vo
|
|
47
52
|
int err;
|
48
53
|
DCCallback* pcb;
|
49
54
|
err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
50
|
-
if
|
55
|
+
if(err)
|
56
|
+
return NULL;
|
51
57
|
|
52
58
|
#if defined (DC__OS_Win64)
|
53
59
|
dcbInitThunk(&pcb->thunk, dcCallback_x64_win64);
|
@@ -55,6 +61,13 @@ DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, vo
|
|
55
61
|
dcbInitThunk(&pcb->thunk, dcCallback_x64_sysv);
|
56
62
|
#endif
|
57
63
|
dcbInitCallback(pcb, signature, handler, userdata);
|
64
|
+
|
65
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
66
|
+
if(err) {
|
67
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
68
|
+
return NULL;
|
69
|
+
}
|
70
|
+
|
58
71
|
return pcb;
|
59
72
|
}
|
60
73
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback Thunk entry for x86
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2011-
|
9
|
+
Copyright (c) 2011-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
|
@@ -24,30 +24,32 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
#include "../portasm/portasm-x86.S"
|
27
|
+
#include "../dyncall/dyncall_macros.h"
|
28
|
+
|
27
29
|
BEGIN_ASM
|
28
|
-
DCThunk_size
|
29
|
-
DCArgs_size
|
30
|
-
DCValue_size
|
30
|
+
DCThunk_size = 16
|
31
|
+
DCArgs_size = 20
|
32
|
+
DCValue_size = 8
|
31
33
|
|
32
|
-
CTX_thunk
|
33
|
-
CTX_phandler
|
34
|
-
CTX_pargsvt
|
35
|
-
CTX_stack_cleanup
|
36
|
-
CTX_userdata
|
34
|
+
CTX_thunk = 0
|
35
|
+
CTX_phandler = 16
|
36
|
+
CTX_pargsvt = 20
|
37
|
+
CTX_stack_cleanup = 24
|
38
|
+
CTX_userdata = 28
|
37
39
|
|
38
|
-
frame_arg0
|
39
|
-
frame_ret
|
40
|
-
frame_parent
|
41
|
-
frame_CTX
|
42
|
-
frame_DCArgs
|
43
|
-
frame_DCValue
|
40
|
+
frame_arg0 = 8
|
41
|
+
frame_ret = 4
|
42
|
+
frame_parent = 0
|
43
|
+
frame_CTX = -4
|
44
|
+
frame_DCArgs = -24
|
45
|
+
frame_DCValue = -32
|
44
46
|
|
45
|
-
#define ASCII_L
|
46
|
-
#define ASCII_l
|
47
|
-
#define ASCII_d
|
48
|
-
#define ASCII_f
|
49
|
-
#define ASCII_i
|
50
|
-
#define ASCII_v
|
47
|
+
#define ASCII_L 76
|
48
|
+
#define ASCII_l 108
|
49
|
+
#define ASCII_d 100
|
50
|
+
#define ASCII_f 102
|
51
|
+
#define ASCII_i 105
|
52
|
+
#define ASCII_v 118
|
51
53
|
|
52
54
|
GLOBAL(dcCallbackThunkEntry)
|
53
55
|
BEGIN_PROC(dcCallbackThunkEntry)
|
@@ -77,7 +79,7 @@ BEGIN_PROC(dcCallbackThunkEntry)
|
|
77
79
|
CALL_DWORD(EAX,CTX_phandler)
|
78
80
|
/* cleanup stack */
|
79
81
|
MOVL(EBP,ESP) /* reset esp to frame */
|
80
|
-
POP(ECX) /* skip parent frame */
|
82
|
+
POP(ECX) /* skip parent frame */
|
81
83
|
POP(ECX) /* pop return address */
|
82
84
|
MOVL(DWORD(EBP,frame_CTX),EDX)
|
83
85
|
ADD(DWORD(EDX,CTX_stack_cleanup),ESP) /* cleanup stack */
|
@@ -85,13 +87,15 @@ BEGIN_PROC(dcCallbackThunkEntry)
|
|
85
87
|
LEA(DWORD(EBP,frame_DCValue), EDX)
|
86
88
|
MOVL(DWORD(EBP,0), EBP) /* EBP = parent frame */
|
87
89
|
/* handle return value */
|
88
|
-
|
90
|
+
|
91
|
+
#if !defined(DC__OS_Minix)
|
89
92
|
CMP(LIT(ASCII_f),AL)
|
90
93
|
JE(LOCAL(return_f32))
|
91
94
|
CMP(LIT(ASCII_d),AL)
|
92
95
|
JE(LOCAL(return_f64))
|
93
|
-
|
94
|
-
|
96
|
+
#endif
|
97
|
+
|
98
|
+
/* All int cases (+ pointer & string cases) fall in the return_i64 case, here */
|
95
99
|
LOCAL(return_i64):
|
96
100
|
MOVL(DWORD(EDX,0),EAX)
|
97
101
|
MOVL(DWORD(EDX,4),EDX)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback - 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
|
@@ -24,22 +24,27 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
|
27
|
-
|
28
|
-
#include "
|
27
|
+
#include "dyncall_callback.h"
|
28
|
+
#include "dyncall_alloc_wx.h"
|
29
|
+
#include "dyncall_thunk.h"
|
29
30
|
#include "dyncall_args_x86.h"
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
/* Callback symbol. */
|
33
|
+
extern void dcCallbackThunkEntry();
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
*/
|
35
|
+
struct DCCallback
|
36
|
+
{
|
37
|
+
DCThunk thunk; /* offset 0, size 16 */
|
38
|
+
DCCallbackHandler* handler; /* offset 16 */
|
39
|
+
DCArgsVT* args_vt; /* offset 20 */
|
40
|
+
size_t stack_cleanup; /* offset 24 */
|
41
|
+
void* userdata; /* offset 28 */
|
42
|
+
};
|
37
43
|
|
38
|
-
extern void dcCallbackThunkEntry();
|
39
44
|
|
40
45
|
/* compute stacksize for callee cleanup calling conventions:
|
41
46
|
*
|
42
|
-
* stdcall,fastcall_ms,fastcall_gnu
|
47
|
+
* cdecl,stdcall,thiscall_ms,fastcall_ms,fastcall_gnu
|
43
48
|
*/
|
44
49
|
|
45
50
|
static int dcbCleanupSize_x86_cdecl(const char* signature)
|
@@ -260,10 +265,18 @@ DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, vo
|
|
260
265
|
int err;
|
261
266
|
DCCallback* pcb;
|
262
267
|
err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
263
|
-
if
|
268
|
+
if(err)
|
269
|
+
return NULL;
|
264
270
|
|
265
271
|
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
266
272
|
dcbInitCallback(pcb, signature, handler, userdata);
|
273
|
+
|
274
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
275
|
+
if(err) {
|
276
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
277
|
+
return NULL;
|
278
|
+
}
|
279
|
+
|
267
280
|
return pcb;
|
268
281
|
}
|
269
282
|
|