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 MIPS
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c) 2013-
|
9
|
+
Copyright (c) 2013-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,31 +25,49 @@
|
|
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
|
+
/* might want to make use of __packed__ or so @@@ */
|
35
|
+
struct DCCallback /* mips32 | mips64 */
|
36
|
+
{ /* ------------------+------------------ */
|
37
|
+
DCThunk thunk; /* offset 0 size 20 | offset 0 size 56 */
|
38
|
+
DCCallbackHandler* handler; /* offset 20 size 4 | offset 56 size 8 */
|
39
|
+
void* userdata; /* offset 24 size 4 | offset 64 size 8 */
|
40
|
+
};
|
41
|
+
|
29
42
|
|
30
43
|
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
31
44
|
{
|
32
|
-
const char* ptr;
|
33
|
-
char ch;
|
34
|
-
|
35
45
|
pcb->handler = handler;
|
36
46
|
pcb->userdata = userdata;
|
37
47
|
}
|
38
48
|
|
39
|
-
extern void dcCallbackThunkEntry();
|
40
49
|
|
41
50
|
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
42
51
|
{
|
52
|
+
int err;
|
43
53
|
DCCallback* pcb;
|
44
|
-
|
45
|
-
if
|
54
|
+
err = dcAllocWX(sizeof(DCCallback), (void**)&pcb);
|
55
|
+
if(err)
|
56
|
+
return NULL;
|
46
57
|
|
47
58
|
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
48
59
|
dcbInitCallback(pcb, signature, handler, userdata);
|
49
60
|
|
61
|
+
err = dcInitExecWX(pcb, sizeof(DCCallback));
|
62
|
+
if(err) {
|
63
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
64
|
+
return NULL;
|
65
|
+
}
|
66
|
+
|
50
67
|
return pcb;
|
51
68
|
}
|
52
69
|
|
70
|
+
|
53
71
|
void dcbFreeCallback(DCCallback* pcb)
|
54
72
|
{
|
55
73
|
dcFreeWX(pcb, sizeof(DCCallback));
|
@@ -59,4 +77,3 @@ void* dcbGetUserData(DCCallback* pcb)
|
|
59
77
|
{
|
60
78
|
return pcb->userdata;
|
61
79
|
}
|
62
|
-
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_mips_eabi_gas.s
|
6
|
+
Description: Callback Thunk - Implementation for mips32 eabi
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2016 Tassilo Philipp <tphilipp@potion-studios.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
|
+
/* input:
|
26
|
+
$t4 -> thunk
|
27
|
+
$t4+20 -> cb handler
|
28
|
+
$t4+24 -> userdata
|
29
|
+
*/
|
30
|
+
|
31
|
+
.text
|
32
|
+
.globl dcCallbackThunkEntry
|
33
|
+
.ent dcCallbackThunkEntry
|
34
|
+
|
35
|
+
/* Called by thunk - thunk stores pointer to DCCallback in $12 ($t4), and */
|
36
|
+
/* pointer to called function in $25 ($t9, required for PIC) */
|
37
|
+
dcCallbackThunkEntry:
|
38
|
+
.set noreorder
|
39
|
+
|
40
|
+
/* Prolog. */
|
41
|
+
/* Frame size of 88b comes from following: */
|
42
|
+
/* DCargs(fregs:32 + iregs:32 + regcounts:4 + stackptr:4) + retval:8 + ra:4 (+ pad:4) */
|
43
|
+
subu $sp, 88 /* open frame */
|
44
|
+
sw $ra, 84($sp) /* save link register */
|
45
|
+
|
46
|
+
.frame $fp,88,$31 /* specify our frame: fp,size,lr; creates virt $fp */
|
47
|
+
/* code below doesn't use $fp though, as n/a with -O1 */
|
48
|
+
/* Init return value */
|
49
|
+
sw $zero, 72($sp)
|
50
|
+
sw $zero, 76($sp)
|
51
|
+
|
52
|
+
/* Store float and int args where our DCargs member arrays are, in local area. */
|
53
|
+
sw $4, 0($sp)
|
54
|
+
sw $5, 4($sp)
|
55
|
+
sw $6, 8($sp)
|
56
|
+
sw $7, 12($sp)
|
57
|
+
sw $8, 16($sp)
|
58
|
+
sw $9, 20($sp)
|
59
|
+
sw $10, 24($sp)
|
60
|
+
sw $11, 28($sp)
|
61
|
+
s.s $f12, 32($sp)
|
62
|
+
s.s $f13, 36($sp)
|
63
|
+
s.s $f14, 40($sp)
|
64
|
+
s.s $f15, 44($sp)
|
65
|
+
s.s $f16, 48($sp)
|
66
|
+
s.s $f17, 52($sp)
|
67
|
+
s.s $f18, 56($sp)
|
68
|
+
s.s $f19, 60($sp)
|
69
|
+
|
70
|
+
/* Init DCarg's reg_counts and stackptr. */
|
71
|
+
sw $zero, 64($sp) /* reg_count */
|
72
|
+
addiu $4, $sp, 88
|
73
|
+
sw $4, 68($sp) /* stackptr */
|
74
|
+
|
75
|
+
/* Prepare callback handler call. */
|
76
|
+
move $4, $12 /* Param 0 = DCCallback*, $12 ($t4) holds pointer to thunk */
|
77
|
+
move $5, $sp /* Param 1 = DCArgs*, pointer to where pointer to args is stored */
|
78
|
+
addiu $6, $sp, 72 /* Param 2 = results pointer to 8b of local data on stack */
|
79
|
+
lw $7, 24($12) /* Param 3 = userdata pointer */
|
80
|
+
|
81
|
+
lw $25, 20($12) /* store handler entry in $25 ($t9), required for PIC */
|
82
|
+
jalr $25 /* jump */
|
83
|
+
nop /* branch delay nop */
|
84
|
+
|
85
|
+
/* Copy result in corresponding registers $2-$3 ($v0-$v1) and $f0 */
|
86
|
+
lw $2, 72($sp)
|
87
|
+
lw $3, 76($sp)
|
88
|
+
l.d $f0, 72($sp)
|
89
|
+
|
90
|
+
/* Epilog. Tear down frame and return. */
|
91
|
+
lw $ra, 84($sp) /* restore return address */
|
92
|
+
addiu $sp, $sp, 88 /* close frame */
|
93
|
+
j $ra /* return */
|
94
|
+
nop /* branch delay nop */
|
95
|
+
|
96
|
+
.set reorder
|
97
|
+
.end dcCallbackThunkEntry
|
98
|
+
.ident "handwritten"
|
99
|
+
|
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
|
-
File: dyncallback/
|
6
|
-
Description:
|
5
|
+
File: dyncallback/dyncall_callback_mips_gas.S
|
6
|
+
Description: auto-select (via C preprocessor) mips abi callback implementation
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c)
|
10
|
-
Tassilo Philipp <tphilipp@potion-studios.com>
|
9
|
+
Copyright (c) 2016-2018 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
|
@@ -24,10 +23,16 @@
|
|
24
23
|
*/
|
25
24
|
|
26
25
|
|
27
|
-
#ifndef DYNCALLBACK_ARGS_ARM32_THUMB_H
|
28
|
-
#define DYNCALLBACK_ARGS_ARM32_THUMB_H
|
29
26
|
|
30
|
-
#
|
31
|
-
|
32
|
-
#
|
27
|
+
#if defined(DC__ABI_MIPS_EABI)
|
28
|
+
# include "dyncall_callback_mips_eabi_gas.s"
|
29
|
+
#elif defined(DC__ABI_MIPS_O32)
|
30
|
+
# include "dyncall_callback_mips_o32_gas.s"
|
31
|
+
#elif defined(DC__ABI_MIPS_N64)
|
32
|
+
# include "dyncall_callback_mips_n64_gas.s"
|
33
|
+
#elif defined(DC__ABI_MIPS_N32)
|
34
|
+
# include "dyncall_callback_mips_n32_gas.s"
|
35
|
+
#else
|
36
|
+
# error Unknown MIPS ABI.
|
37
|
+
#endif
|
33
38
|
|
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
|
-
File: dyncallback/
|
6
|
-
Description: Callback - Implementation for
|
5
|
+
File: dyncallback/dyncall_callback_mips_n32_gas.s
|
6
|
+
Description: Callback Thunk - Implementation for mips64 n32
|
7
7
|
License:
|
8
8
|
|
9
|
-
Copyright (c)
|
10
|
-
Tassilo Philipp <tphilipp@potion-studios.com>
|
9
|
+
Copyright (c) 2016 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,14 @@
|
|
23
22
|
|
24
23
|
*/
|
25
24
|
|
25
|
+
.section .mdebug.abiN32
|
26
|
+
.previous
|
27
|
+
.abicalls
|
28
|
+
.text
|
29
|
+
.align 2
|
30
|
+
.globl dcCallbackThunkEntry
|
31
|
+
.ent dcCallbackThunkEntry
|
32
|
+
dcCallbackThunkEntry:
|
26
33
|
|
27
|
-
|
28
|
-
#include "dyncall_callback_arm32_thumb.h"
|
29
|
-
#include "dyncall_callback_arm32_arm.c" /* Uses same code as ARM mode. */
|
34
|
+
.end dcCallbackThunkEntry
|
30
35
|
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_mips_n64_gas.s
|
6
|
+
Description: Callback Thunk - Implementation for mips64 n64
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2016 Tassilo Philipp <tphilipp@potion-studios.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
|
+
/* input:
|
26
|
+
$t8 -> thunk
|
27
|
+
$t8+56 -> cb handler
|
28
|
+
$t8+64 -> userdata
|
29
|
+
*/
|
30
|
+
|
31
|
+
.section .mdebug.abi64
|
32
|
+
.previous
|
33
|
+
.abicalls
|
34
|
+
.text
|
35
|
+
.align 2
|
36
|
+
.globl dcCallbackThunkEntry
|
37
|
+
.ent dcCallbackThunkEntry
|
38
|
+
dcCallbackThunkEntry:
|
39
|
+
.set noreorder
|
40
|
+
|
41
|
+
/* Prolog. */
|
42
|
+
/* Frame size of 160b comes from following: */
|
43
|
+
/* DCargs(fregs:64 + iregs:64 + regcounts:8 + stackptr:8) + retval:8 + ra:8 */
|
44
|
+
daddiu $sp, $sp, -160 /* open frame */
|
45
|
+
sd $ra, 152($sp) /* save link register */
|
46
|
+
|
47
|
+
.frame $fp,160,$31 /* specify our frame: fp,size,lr; creates virt $fp */
|
48
|
+
/* code below doesn't use $fp though, as n/a with -O1 */
|
49
|
+
/* Init return value */
|
50
|
+
sd $zero, 144($sp)
|
51
|
+
|
52
|
+
/* Store float and int args where our DCargs member arrays are, in local area. */
|
53
|
+
sd $4, 0($sp)
|
54
|
+
sd $5, 8($sp)
|
55
|
+
sd $6, 16($sp)
|
56
|
+
sd $7, 24($sp)
|
57
|
+
sd $8, 32($sp)
|
58
|
+
sd $9, 40($sp)
|
59
|
+
sd $10, 48($sp)
|
60
|
+
sd $11, 56($sp)
|
61
|
+
s.d $f12, 64($sp)
|
62
|
+
s.d $f13, 72($sp)
|
63
|
+
s.d $f14, 80($sp)
|
64
|
+
s.d $f15, 88($sp)
|
65
|
+
s.d $f16, 96($sp)
|
66
|
+
s.d $f17, 104($sp)
|
67
|
+
s.d $f18, 112($sp)
|
68
|
+
s.d $f19, 120($sp)
|
69
|
+
|
70
|
+
/* Init DCarg's reg_counts and stackptr. */
|
71
|
+
sd $zero, 128($sp) /* reg_count */
|
72
|
+
daddiu $4, $sp, 160
|
73
|
+
sd $4, 136($sp) /* stackptr */
|
74
|
+
|
75
|
+
/* Prepare callback handler call. */
|
76
|
+
move $4, $24 /* Param 0 = DCCallback*, $24 ($t8) holds pointer to thunk */
|
77
|
+
move $5, $sp /* Param 1 = DCArgs*, pointer to where pointer to args is stored */
|
78
|
+
daddiu $6, $sp, 144 /* Param 2 = results pointer to 8b of local data on stack */
|
79
|
+
ld $7, 64($24) /* Param 3 = userdata pointer */
|
80
|
+
|
81
|
+
ld $25, 56($24) /* store handler entry in $25 ($t9), required for PIC */
|
82
|
+
jalr $25 /* jump */
|
83
|
+
nop /* branch delay nop */
|
84
|
+
|
85
|
+
/* Copy result in corresponding registers $2-$3 ($v0-$v1) and $f0 */
|
86
|
+
ld $2, 144($sp) /* note: ignoring second possible retval in $3, here */
|
87
|
+
l.d $f0, 144($sp)
|
88
|
+
|
89
|
+
/* Epilog. Tear down frame and return. */
|
90
|
+
ld $ra, 152($sp) /* restore return address */
|
91
|
+
daddiu $sp, $sp, 160 /* close frame */
|
92
|
+
j $ra /* return */
|
93
|
+
nop /* branch delay nop */
|
94
|
+
|
95
|
+
.set reorder
|
96
|
+
.end dcCallbackThunkEntry
|
97
|
+
.ident "handwritten"
|
98
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_mips_o32_gas.s
|
6
|
+
Description: Callback Thunk - Implementation mips32 o32
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2016 Tassilo Philipp <tphilipp@potion-studios.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
|
+
/* input:
|
26
|
+
$t4 -> thunk
|
27
|
+
$t4+20 -> cb handler
|
28
|
+
$t4+24 -> userdata
|
29
|
+
*/
|
30
|
+
|
31
|
+
.section .mdebug.abi32
|
32
|
+
.previous
|
33
|
+
.abicalls
|
34
|
+
.text
|
35
|
+
.align 2
|
36
|
+
.globl dcCallbackThunkEntry
|
37
|
+
.ent dcCallbackThunkEntry
|
38
|
+
.type dcCallbackThunkEntry, @function
|
39
|
+
|
40
|
+
/* Called by thunk - thunk stores pointer to DCCallback in $12 ($t4), and */
|
41
|
+
/* pointer to called function in $25 ($t9, required for PIC) */
|
42
|
+
dcCallbackThunkEntry:
|
43
|
+
.set noreorder
|
44
|
+
|
45
|
+
/* Prolog. Just store the minimum, return address, spill area. */
|
46
|
+
/* Frame size of 56b comes from following areas (each 8b aligned): */
|
47
|
+
/* local: fpregs:16 + retval:8 + DCArgs:8 */
|
48
|
+
/* save: ra:4 (+ pad:4) */
|
49
|
+
/* param: spill:16 */
|
50
|
+
subu $sp, 56 /* open frame */
|
51
|
+
sw $ra, 20($sp) /* save link register */
|
52
|
+
|
53
|
+
.frame $fp,56,$31 /* specify our frame: fp,size,lr; creates virt $fp */
|
54
|
+
/* code below doesn't use $fp though, as n/a with -O1 */
|
55
|
+
/* Init return value */
|
56
|
+
sw $zero, 32($sp)
|
57
|
+
sw $zero, 36($sp)
|
58
|
+
|
59
|
+
/* Store the arguments passed via registers somewhere for dcArg* to access. */
|
60
|
+
/* For $4-$7 ($a0-$a3), use dedicated spill area (caller doesn't spill, but */
|
61
|
+
/* provides it at end of _caller's_ frame, so $fp points right to it). */
|
62
|
+
/* For $f12 and $f14 use our space (in local data), which is adjacent. */
|
63
|
+
s.d $f12, 40($sp) /* -16($fp) */
|
64
|
+
s.d $f14, 48($sp) /* -8($fp) */
|
65
|
+
sw $4, 56($sp) /* 0($fp) */
|
66
|
+
sw $5, 60($sp) /* 4($fp) */
|
67
|
+
sw $6, 64($sp) /* 8($fp) */
|
68
|
+
sw $7, 68($sp) /* 12($fp) */
|
69
|
+
|
70
|
+
/* Init DCArg, which contains reg_count and stackptr* to the args. Point */
|
71
|
+
/* stackptr to the area where the non-float args start (which is at $fp). */
|
72
|
+
addiu $4, $sp, 56 /* non-$fp replacement for: */
|
73
|
+
sw $4, 28($sp) /* sw $fp, 28($sp) */
|
74
|
+
sw $zero, 24($sp)
|
75
|
+
|
76
|
+
/* Prepare callback handler call. */
|
77
|
+
move $4, $12 /* Param 0 = DCCallback*, $12 ($t4) holds pointer to thunk */
|
78
|
+
addiu $5, $sp, 24 /* Param 1 = DCArgs*, pointer to where pointer to args is stored */
|
79
|
+
addiu $6, $sp, 32 /* Param 2 = results pointer to 8b of local data on stack */
|
80
|
+
lw $7, 24($12) /* Param 3 = userdata pointer */
|
81
|
+
|
82
|
+
lw $25, 20($12) /* store handler entry in $25 ($t9), required for PIC */
|
83
|
+
jalr $25 /* jump */
|
84
|
+
nop /* branch delay nop */
|
85
|
+
|
86
|
+
/* Copy result in corresponding registers $2-$3 ($v0-$v1) and $f0 */
|
87
|
+
lw $2, 32($sp)
|
88
|
+
lw $3, 36($sp)
|
89
|
+
l.d $f0, 32($sp)
|
90
|
+
|
91
|
+
/* Epilog. Tear down frame and return. */
|
92
|
+
lw $ra, 20($sp) /* restore return address */
|
93
|
+
addiu $sp, $sp, 56 /* close frame */
|
94
|
+
j $ra /* return */
|
95
|
+
nop /* branch delay nop */
|
96
|
+
|
97
|
+
.set reorder
|
98
|
+
.end dcCallbackThunkEntry
|
99
|
+
.ident "handwritten"
|
100
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback Thunk Entry for PowerPC 32-bit System V Big-Endian 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,16 +25,16 @@
|
|
25
25
|
|
26
26
|
#include "../portasm/portasm-ppc.S"
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
.machine ppc
|
29
|
+
.text
|
30
|
+
.align 2
|
31
31
|
|
32
32
|
/* Struct DCCallback */
|
33
33
|
|
34
|
-
DCB_THUNK
|
35
|
-
DCB_HANDLER
|
36
|
-
DCB_CLEANUP
|
37
|
-
DCB_USERDATA
|
34
|
+
DCB_THUNK = 0
|
35
|
+
DCB_HANDLER = 24
|
36
|
+
DCB_CLEANUP = 28
|
37
|
+
DCB_USERDATA = 32
|
38
38
|
|
39
39
|
/* Struct DCArgs */
|
40
40
|
|
@@ -74,30 +74,30 @@ ENTRY_C(dcCallbackThunkEntry)
|
|
74
74
|
/* --------------------------------------------------------------------------
|
75
75
|
|
76
76
|
Input:
|
77
|
-
r1
|
78
|
-
r3-r10
|
79
|
-
f1-f8
|
80
|
-
r11
|
77
|
+
r1 Stack Pointer
|
78
|
+
r3-r10 Integer Arguments
|
79
|
+
f1-f8 Floating-point Arguments
|
80
|
+
r11 Thunk Pointer
|
81
81
|
|
82
82
|
*/
|
83
|
-
|
83
|
+
|
84
84
|
/* prolog */
|
85
85
|
|
86
|
-
mflr
|
87
|
-
stw
|
88
|
-
addi
|
86
|
+
mflr r0
|
87
|
+
stw r0, SP_LR(r1) /* store return address */
|
88
|
+
addi r12,r1, SP_PAR /* temporary r12: parameter area on callers stack frame */
|
89
89
|
stwu r1, -FRAMESIZE(r1)
|
90
|
-
|
91
|
-
stw
|
92
|
-
stw
|
93
|
-
stw
|
90
|
+
|
91
|
+
stw r3, SP_IREGS + 0*4(r1) /* spill 8 integer parameter registers */
|
92
|
+
stw r4, SP_IREGS + 1*4(r1)
|
93
|
+
stw r5, SP_IREGS + 2*4(r1)
|
94
94
|
stw r6, SP_IREGS + 3*4(r1)
|
95
95
|
stw r7, SP_IREGS + 4*4(r1)
|
96
96
|
stw r8, SP_IREGS + 5*4(r1)
|
97
97
|
stw r9, SP_IREGS + 6*4(r1)
|
98
98
|
stw r10,SP_IREGS + 7*4(r1)
|
99
|
-
|
100
|
-
|
99
|
+
|
100
|
+
stfd f1, SP_FREGS + 0*8(r1) /* spill 8 (of 13) float parameter registers */
|
101
101
|
stfd f2, SP_FREGS + 1*8(r1)
|
102
102
|
stfd f3, SP_FREGS + 2*8(r1)
|
103
103
|
stfd f4, SP_FREGS + 3*8(r1)
|
@@ -106,39 +106,39 @@ Input:
|
|
106
106
|
stfd f7, SP_FREGS + 6*8(r1)
|
107
107
|
stfd f8, SP_FREGS + 7*8(r1)
|
108
108
|
|
109
|
-
stw
|
110
|
-
xor
|
111
|
-
stw
|
112
|
-
stw
|
113
|
-
stw r0, SP_RESULT(r1)
|
114
|
-
|
115
|
-
|
116
|
-
mr
|
117
|
-
addi
|
118
|
-
addi
|
119
|
-
lwz
|
120
|
-
|
121
|
-
|
122
|
-
lwz
|
123
|
-
mtctr
|
109
|
+
stw r12,SP_SP(r1) /* init stack pointer */
|
110
|
+
xor r0, r0, r0 /* init register counters */
|
111
|
+
stw r0, SP_ICNT(r1)
|
112
|
+
stw r0, SP_FCNT(r1)
|
113
|
+
stw r0, SP_RESULT(r1) /* init result object */
|
114
|
+
stw r0, SP_RESULT + 4(r1)
|
115
|
+
/* invoke callback handler */
|
116
|
+
mr r3, r11 /* arg 1: DCCallback* pcb (r11 = thunk ptr) */
|
117
|
+
addi r4, r1, SP_ARGS /* arg 2: DCArgs* args */
|
118
|
+
addi r5, r1, SP_RESULT /* arg 3: DCValue* result */
|
119
|
+
lwz r6, DCB_USERDATA(r11) /* arg 4: void* userdata */
|
120
|
+
|
121
|
+
/* branch-and-link to DCCallback.handler */
|
122
|
+
lwz r12, DCB_HANDLER(r11)
|
123
|
+
mtctr r12
|
124
124
|
bctrl
|
125
|
-
|
126
|
-
cmpi
|
127
|
-
beq
|
128
|
-
cmpi
|
129
|
-
beq
|
125
|
+
/* check result type */
|
126
|
+
cmpi cr0, r3, 0x66 /* 'f */
|
127
|
+
beq .f32
|
128
|
+
cmpi cr0, r3, 0x64 /* 'd */
|
129
|
+
beq .f64
|
130
130
|
.i64:
|
131
|
-
lwz
|
132
|
-
lwz
|
131
|
+
lwz r3, SP_RESULT (r1)
|
132
|
+
lwz r4, SP_RESULT + 4 (r1)
|
133
133
|
.end:
|
134
|
-
lwz
|
135
|
-
lwz
|
136
|
-
mtlr
|
137
|
-
blr
|
138
|
-
.f32:
|
139
|
-
lfs
|
140
|
-
b
|
134
|
+
lwz r1, SP_PREV(r1) /* restore stack pointer */
|
135
|
+
lwz r0, SP_LR(r1) /* load link register with return address */
|
136
|
+
mtlr r0
|
137
|
+
blr /* branch back to link register */
|
138
|
+
.f32:
|
139
|
+
lfs f1, SP_RESULT(r1)
|
140
|
+
b .end
|
141
141
|
.f64:
|
142
|
-
lfd
|
143
|
-
b
|
144
|
-
|
142
|
+
lfd f1, SP_RESULT(r1)
|
143
|
+
b .end
|
144
|
+
|