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: Type and calling-convention signature character defines
|
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: Typedefs
|
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
|
@@ -45,24 +45,23 @@
|
|
45
45
|
extern "C" {
|
46
46
|
#endif
|
47
47
|
|
48
|
-
typedef void
|
49
|
-
typedef DC_BOOL
|
50
|
-
typedef char
|
51
|
-
typedef unsigned char
|
52
|
-
typedef short
|
53
|
-
typedef unsigned short
|
54
|
-
typedef int
|
55
|
-
typedef unsigned int
|
56
|
-
typedef long
|
57
|
-
typedef unsigned long
|
58
|
-
typedef DC_LONG_LONG
|
48
|
+
typedef void DCvoid;
|
49
|
+
typedef DC_BOOL DCbool;
|
50
|
+
typedef char DCchar;
|
51
|
+
typedef unsigned char DCuchar;
|
52
|
+
typedef short DCshort;
|
53
|
+
typedef unsigned short DCushort;
|
54
|
+
typedef int DCint;
|
55
|
+
typedef unsigned int DCuint;
|
56
|
+
typedef long DClong;
|
57
|
+
typedef unsigned long DCulong;
|
58
|
+
typedef DC_LONG_LONG DClonglong;
|
59
59
|
typedef unsigned DC_LONG_LONG DCulonglong;
|
60
|
-
typedef float
|
61
|
-
typedef double
|
62
|
-
typedef DC_POINTER
|
63
|
-
typedef const char*
|
64
|
-
|
65
|
-
typedef size_t DCsize;
|
60
|
+
typedef float DCfloat;
|
61
|
+
typedef double DCdouble;
|
62
|
+
typedef DC_POINTER DCpointer;
|
63
|
+
typedef const char* DCstring;
|
64
|
+
typedef size_t DCsize;
|
66
65
|
|
67
66
|
#define DC_TRUE 1
|
68
67
|
#define DC_FALSE 0
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Type and calling-convention signature character defines
|
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: Value variant type
|
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
|
@@ -48,15 +48,17 @@ typedef union DCValue_ DCValue;
|
|
48
48
|
|
49
49
|
union DCValue_
|
50
50
|
{
|
51
|
-
|
52
|
-
|
51
|
+
/* dyncallback assembly pulls value directly from DCValue structs, without */
|
52
|
+
/* knowledge about types used, so lay it out as needed at compile time, here */
|
53
|
+
#if defined(DC__Endian_BIG) && (defined(DC__Arch_PPC32) || defined(DC__Arch_MIPS) || defined(DC__Arch_Sparc))
|
54
|
+
DCbool B;
|
53
55
|
struct { DCchar c_pad[3]; DCchar c; };
|
54
56
|
struct { DCuchar C_pad[3]; DCuchar C; };
|
55
57
|
struct { DCshort s_pad; DCshort s; };
|
56
58
|
struct { DCshort S_pad; DCshort S; };
|
57
|
-
DCint
|
58
|
-
DCuint
|
59
|
-
#elif defined (DC__Arch_PPC64)
|
59
|
+
DCint i;
|
60
|
+
DCuint I;
|
61
|
+
#elif defined(DC__Endian_BIG) && (defined(DC__Arch_PPC64) || defined(DC__Arch_MIPS64) || defined(DC__Arch_Sparc64))
|
60
62
|
struct { DCbool B_pad; DCbool B; };
|
61
63
|
struct { DCchar c_pad[7]; DCchar c; };
|
62
64
|
struct { DCuchar C_pad[7]; DCuchar C; };
|
@@ -65,22 +67,27 @@ union DCValue_
|
|
65
67
|
struct { DCint i_pad; DCint i; };
|
66
68
|
struct { DCint I_pad; DCuint I; };
|
67
69
|
#else
|
68
|
-
DCbool
|
69
|
-
DCchar
|
70
|
-
DCuchar
|
71
|
-
DCshort
|
72
|
-
DCushort
|
73
|
-
DCint
|
74
|
-
DCuint
|
70
|
+
DCbool B;
|
71
|
+
DCchar c;
|
72
|
+
DCuchar C;
|
73
|
+
DCshort s;
|
74
|
+
DCushort S;
|
75
|
+
DCint i;
|
76
|
+
DCuint I;
|
75
77
|
#endif
|
76
|
-
DClong
|
77
|
-
DCulong
|
78
|
-
DClonglong
|
79
|
-
DCulonglong
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
DClong j;
|
79
|
+
DCulong J;
|
80
|
+
DClonglong l;
|
81
|
+
DCulonglong L;
|
82
|
+
/* floats on mips are right justified in fp-registers on big endian targets, as they aren't promoted */
|
83
|
+
#if defined(DC__Endian_BIG) && (defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64))
|
84
|
+
struct { DCfloat f_pad; DCfloat f; };
|
85
|
+
#else
|
86
|
+
DCfloat f;
|
87
|
+
#endif
|
88
|
+
DCdouble d;
|
89
|
+
DCpointer p;
|
90
|
+
DCstring Z;
|
84
91
|
};
|
85
92
|
|
86
93
|
#ifdef __cplusplus
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Simple dynamic vector container type implementation
|
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: Simple dynamic vector container type header
|
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
|
data/dyncall/dyncall/gen-masm.sh
CHANGED
@@ -3,5 +3,5 @@
|
|
3
3
|
# Uses portasm to generates MASM sources for intel platforms.
|
4
4
|
printf "; auto-generated by `basename $0`\r\n" > dyncall_call_x86_generic_masm.asm
|
5
5
|
printf "; auto-generated by `basename $0`\r\n" > dyncall_call_x64_generic_masm.asm
|
6
|
-
gcc -E -P -DGEN_MASM dyncall_call_x86.S
|
7
|
-
gcc -E -P -DGEN_MASM dyncall_call_x64
|
6
|
+
gcc -E -P -DGEN_MASM dyncall_call_x86.S | awk '{printf "%s\r\n", $0}' >> dyncall_call_x86_generic_masm.asm
|
7
|
+
gcc -E -P -DGEN_MASM dyncall_call_x64.S | awk '{printf "%s\r\n", $0}' >> dyncall_call_x64_generic_masm.asm
|
@@ -1,6 +1,6 @@
|
|
1
1
|
LIBNAME = dyncallback
|
2
2
|
OBJS = dyncall_alloc_wx.o dyncall_args.o dyncall_callback.o dyncall_callback_arch.o dyncall_thunk.o
|
3
|
-
HEADERS = ${VPATH}/dyncall_thunk.h ${VPATH}/dyncall_thunk_x86.h ${VPATH}/dyncall_thunk_ppc32.h ${VPATH}/dyncall_thunk_x64.h ${VPATH}/
|
3
|
+
HEADERS = ${VPATH}/dyncall_thunk.h ${VPATH}/dyncall_thunk_x86.h ${VPATH}/dyncall_thunk_ppc32.h ${VPATH}/dyncall_thunk_x64.h ${VPATH}/dyncall_thunk_arm32.h ${VPATH}/dyncall_thunk_arm64.h ${VPATH}/dyncall_thunk_mips.h ${VPATH}/dyncall_thunk_mips64.h ${VPATH}/dyncall_thunk_ppc64.h ${VPATH}/dyncall_thunk_sparc32.h ${VPATH}/dyncall_thunk_sparc64.h ${VPATH}/dyncall_args.h ${VPATH}/dyncall_callback.h
|
4
4
|
TOP = ${VPATH}/..
|
5
5
|
CFLAGS += -I${TOP}/dyncall
|
6
6
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Allocate write/executable memory - Implementation back-end selector (mmap or win32)
|
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: Allocate write/executable memory - Interface
|
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,8 +35,9 @@ typedef int DCerror;
|
|
35
35
|
extern "C" {
|
36
36
|
#endif
|
37
37
|
|
38
|
-
DCerror dcAllocWX(DCsize size, void** p);
|
39
|
-
|
38
|
+
DCerror dcAllocWX (DCsize size, void** p);
|
39
|
+
DCerror dcInitExecWX(void* p, DCsize size);
|
40
|
+
void dcFreeWX (void* p, DCsize size);
|
40
41
|
|
41
42
|
#ifdef __cplusplus
|
42
43
|
}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Allocate write/executable memory - Fallback implementation based
|
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,13 +29,19 @@
|
|
29
29
|
#include <stdlib.h>
|
30
30
|
|
31
31
|
|
32
|
-
|
32
|
+
DCerror dcAllocWX(size_t size, void** pp)
|
33
33
|
{
|
34
34
|
*pp = malloc(size);
|
35
35
|
return 0;
|
36
36
|
}
|
37
37
|
|
38
|
+
DCerror dcInitExecWX(void* p, size_t size)
|
39
|
+
{
|
40
|
+
return 0;
|
41
|
+
}
|
42
|
+
|
38
43
|
void dcFreeWX(void* p, size_t size)
|
39
44
|
{
|
40
45
|
free(p);
|
41
46
|
}
|
47
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Allocate write/executable memory - Implementation for posix
|
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,15 +29,78 @@
|
|
29
29
|
#include <sys/types.h>
|
30
30
|
#include <sys/mman.h>
|
31
31
|
|
32
|
-
|
32
|
+
/* MAP_ANON is not POSIX, if lacking, we'll use a portable fallback on *nix systems */
|
33
|
+
#if !defined(MAP_ANON)
|
34
|
+
# if defined(MAP_ANONYMOUS)
|
35
|
+
# define MAP_ANON MAP_ANONYMOUS
|
36
|
+
# elif defined(DC_UNIX)
|
37
|
+
# include <fcntl.h>
|
38
|
+
# else
|
39
|
+
# error "Platform implementation missing for anonymous rwx memory"
|
40
|
+
# endif
|
41
|
+
#endif
|
42
|
+
|
43
|
+
/* platforms without mprotect */
|
44
|
+
#if defined(DC__OS_Minix)
|
45
|
+
# define NO_MPROTECT
|
46
|
+
#endif
|
47
|
+
|
48
|
+
/* if no mprotect() available/wanted, make mmap alloc pages as rwx */
|
49
|
+
#if defined(NO_MPROTECT)
|
50
|
+
# define MMAP_PROT_INIT (PROT_READ|PROT_WRITE|PROT_EXEC)
|
51
|
+
#else
|
52
|
+
# define MMAP_PROT_INIT (PROT_READ|PROT_WRITE)
|
53
|
+
#endif
|
54
|
+
|
55
|
+
DCerror dcAllocWX(size_t size, void** pp)
|
33
56
|
{
|
34
|
-
void* p
|
35
|
-
|
57
|
+
void* p;
|
58
|
+
#if !defined(MAP_ANON) && defined(DC_UNIX)
|
59
|
+
/* Hack around not having POSIX' MAP_ANON by going through /dev/zero; store
|
60
|
+
file descr to close on dcFreeWX at beginning of memory, as tiny hack */
|
61
|
+
int fd = open("/dev/zero", O_RDWR);
|
62
|
+
if(fd == -1)
|
63
|
+
return -1;
|
64
|
+
p = mmap(0, size+sizeof(int), MMAP_PROT_INIT, MAP_PRIVATE, fd, 0);
|
65
|
+
if(p == MAP_FAILED) {
|
66
|
+
close(fd);
|
67
|
+
return -1;
|
68
|
+
}
|
69
|
+
*(int*)p = fd;
|
70
|
+
p += sizeof(int);
|
71
|
+
#else
|
72
|
+
p = mmap(0, size, MMAP_PROT_INIT, MAP_PRIVATE|MAP_ANON, -1, 0);
|
73
|
+
if(p == MAP_FAILED)
|
74
|
+
return -1;
|
75
|
+
#endif
|
76
|
+
|
36
77
|
*pp = p;
|
37
78
|
return 0;
|
38
79
|
}
|
39
80
|
|
81
|
+
DCerror dcInitExecWX(void* p, size_t size)
|
82
|
+
{
|
83
|
+
#if defined(NO_MPROTECT)
|
84
|
+
return 0;
|
85
|
+
#else
|
86
|
+
|
87
|
+
#if !defined(MAP_ANON) && defined(DC_UNIX)
|
88
|
+
/* Fixup pointer for no-MAP_ANON workaround (see above) */
|
89
|
+
p -= sizeof(int);
|
90
|
+
size += sizeof(int);
|
91
|
+
#endif
|
92
|
+
return mprotect(p, size, PROT_READ|PROT_EXEC);
|
93
|
+
#endif
|
94
|
+
}
|
95
|
+
|
40
96
|
void dcFreeWX(void* p, size_t size)
|
41
97
|
{
|
98
|
+
#if !defined(MAP_ANON) && defined(DC_UNIX)
|
99
|
+
/* Close file descriptor for no-MAP_ANON workaround (see above) */
|
100
|
+
p -= sizeof(int);
|
101
|
+
size += sizeof(int);
|
102
|
+
close(*(int*)p);
|
103
|
+
#endif
|
42
104
|
munmap(p, size);
|
43
105
|
}
|
106
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Allocate write/executable memory - Implementation for win32 platform
|
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,7 +28,7 @@
|
|
28
28
|
#include <windows.h>
|
29
29
|
#include <assert.h>
|
30
30
|
|
31
|
-
|
31
|
+
DCerror dcAllocWX(size_t size, void** ptr)
|
32
32
|
{
|
33
33
|
LPVOID p = VirtualAlloc(0, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
34
34
|
if (p == NULL) return -1;
|
@@ -36,6 +36,11 @@ int dcAllocWX(size_t size, void** ptr)
|
|
36
36
|
return 0;
|
37
37
|
}
|
38
38
|
|
39
|
+
DCerror dcInitExecWX(void* p, size_t size)
|
40
|
+
{
|
41
|
+
return 0;
|
42
|
+
}
|
43
|
+
|
39
44
|
void dcFreeWX(void* p, size_t size)
|
40
45
|
{
|
41
46
|
BOOL b = VirtualFree( p, 0, MEM_RELEASE);
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback's Arguments VM - Implementation back-end selector
|
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
|
@@ -27,28 +27,32 @@
|
|
27
27
|
|
28
28
|
#if defined(DC__Arch_Intel_x86)
|
29
29
|
# include "dyncall_args_x86.c"
|
30
|
-
#elif defined
|
30
|
+
#elif defined(DC__Arch_AMD64)
|
31
31
|
# include "dyncall_args_x64.c"
|
32
|
-
#elif defined
|
33
|
-
# if defined
|
32
|
+
#elif defined(DC__Arch_PPC32)
|
33
|
+
# if defined(DC__OS_Darwin)
|
34
34
|
# include "dyncall_args_ppc32.c"
|
35
35
|
# else
|
36
36
|
# include "dyncall_args_ppc32_sysv.c"
|
37
37
|
# endif
|
38
|
-
#elif defined
|
38
|
+
#elif defined(DC__Arch_PPC64)
|
39
39
|
# include "dyncall_args_ppc64.c"
|
40
|
-
#elif defined
|
41
|
-
# include "
|
42
|
-
#elif defined
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
40
|
+
#elif defined(DC__Arch_ARM)
|
41
|
+
# include "dyncall_args_arm32.c"
|
42
|
+
#elif defined(DC__Arch_MIPS)
|
43
|
+
# if defined(DC__ABI_MIPS_O32)
|
44
|
+
# include "dyncall_args_mips_o32.c"
|
45
|
+
# else
|
46
|
+
# include "dyncall_args_mips.c"
|
47
|
+
# endif
|
48
|
+
#elif defined(DC__Arch_MIPS64)
|
49
|
+
# include "dyncall_args_mips64.c"
|
50
|
+
#elif defined(DC__Arch_Sparc)
|
47
51
|
# include "dyncall_args_sparc32.c"
|
48
|
-
#elif defined
|
52
|
+
#elif defined(DC__Arch_Sparc64)
|
49
53
|
# include "dyncall_args_sparc64.c"
|
50
|
-
#elif defined
|
51
|
-
# if defined
|
54
|
+
#elif defined(DC__Arch_ARM64)
|
55
|
+
# if defined(DC__OS_Darwin)
|
52
56
|
# include "dyncall_args_arm64_apple.c"
|
53
57
|
# else
|
54
58
|
# include "dyncall_args_arm64.c"
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: Callback's Arguments VM - Interface
|
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
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Package: dyncall
|
4
4
|
Library: dyncallback
|
5
|
-
File: dyncallback/
|
6
|
-
Description: Callback's Arguments VM - Implementation for ARM32 (ARM mode)
|
5
|
+
File: dyncallback/dyncall_args_arm32.c
|
6
|
+
Description: Callback's Arguments VM - Implementation for ARM32 (ARM and THUMB mode)
|
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,7 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
|
28
|
-
#include "
|
28
|
+
#include "dyncall_args_arm32.h"
|
29
29
|
|
30
30
|
|
31
31
|
static void arm_align_64(DCArgs* args)
|