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:
|
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,8 +24,8 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
#ifndef
|
28
|
-
#define
|
27
|
+
#ifndef DYNCALL_CALL_SPARC_V9_H
|
28
|
+
#define DYNCALL_CALL_SPARC_V9_H
|
29
29
|
|
30
30
|
#include "dyncall_types.h"
|
31
31
|
|
@@ -33,11 +33,11 @@
|
|
33
33
|
extern "C" {
|
34
34
|
#endif
|
35
35
|
|
36
|
-
void
|
36
|
+
void dcCall_v9 (DCCallVM* vm, DCpointer target);
|
37
37
|
|
38
38
|
#ifdef __cplusplus
|
39
39
|
}
|
40
40
|
#endif
|
41
41
|
|
42
|
-
#endif /*
|
42
|
+
#endif /* DYNCALL_CALL_SPARC_v9_H */
|
43
43
|
|
@@ -0,0 +1,177 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncall
|
5
|
+
File: dyncall/dyncall_call_sparc64.S
|
6
|
+
Description: Call kernel for sparc64 (v9) ABI.
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>
|
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
|
+
|
26
|
+
/* NOTE: %sp/%fp for v9 are offset, using them needs a "BIAS" of 2047 */
|
27
|
+
BIAS = 2047
|
28
|
+
|
29
|
+
.text
|
30
|
+
.global dcCall_v9
|
31
|
+
/* dcCall_sparc64( DCCallVM* , void * target ) */
|
32
|
+
/* o0 o1 */
|
33
|
+
dcCall_v9:
|
34
|
+
or %o0, %g0, %o3 /* o3: callvm */
|
35
|
+
or %o1, %g0, %o0 /* o0: target */
|
36
|
+
ldx [%o3+24], %o1 /* o1: mVecSize */
|
37
|
+
add %o3, 32, %o2 /* o2: stack */
|
38
|
+
/* Compute a matching stack size (approximate): o3 = align(o1+136,16) */
|
39
|
+
|
40
|
+
add %o1, (16+1+6)*8+15, %o3
|
41
|
+
and %o3, -16, %o3
|
42
|
+
neg %o3 /* o3: -stacksize */
|
43
|
+
save %sp, %o3, %sp
|
44
|
+
|
45
|
+
ldd [%i2+8*0 ], %f0 /* Load double-precision float registers. */
|
46
|
+
ldd [%i2+8*1 ], %f2
|
47
|
+
ldd [%i2+8*2 ], %f4
|
48
|
+
ldd [%i2+8*3 ], %f6
|
49
|
+
ldd [%i2+8*4 ], %f8
|
50
|
+
ldd [%i2+8*5 ], %f10
|
51
|
+
ldd [%i2+8*6 ], %f12
|
52
|
+
ldd [%i2+8*7 ], %f14
|
53
|
+
ldd [%i2+8*8 ], %f16
|
54
|
+
ldd [%i2+8*9 ], %f18
|
55
|
+
ldd [%i2+8*10], %f20
|
56
|
+
ldd [%i2+8*11], %f22
|
57
|
+
ldd [%i2+8*12], %f24
|
58
|
+
ldd [%i2+8*13], %f26
|
59
|
+
ldd [%i2+8*14], %f28
|
60
|
+
ldd [%i2+8*15], %f30
|
61
|
+
ldx [%i2+8*0 ], %o0 /* Load output registers. */
|
62
|
+
ldx [%i2+8*1 ], %o1
|
63
|
+
ldx [%i2+8*2 ], %o2
|
64
|
+
ldx [%i2+8*3 ], %o3
|
65
|
+
ldx [%i2+8*4 ], %o4
|
66
|
+
ldx [%i2+8*5 ], %o5
|
67
|
+
sub %i1, 48, %i1
|
68
|
+
cmp %i1, 0
|
69
|
+
ble .do_call
|
70
|
+
nop
|
71
|
+
/* Copy loop: */
|
72
|
+
add %i2, 48, %i2 /* skip homing area */
|
73
|
+
or %g0, %g0, %l0 /* l0 = offset initialized to 0. */
|
74
|
+
add %sp, BIAS+((16+6)*8), %l2 /* l2 = argument area on stack space (7th word). (64+4+6*4 = byte offset 92). */
|
75
|
+
.next:
|
76
|
+
ldx [%i2+%l0],%l1 /* Read from arg buffer(%i2) to %l1. */
|
77
|
+
stx %l1, [%l2+%l0] /* Write %l1 to stack space(%l2). */
|
78
|
+
add %l0, 8, %l0 /* Increment offset. */
|
79
|
+
sub %i1, 8, %i1 /* Decrement copy size. */
|
80
|
+
cmp %i1, 0
|
81
|
+
bgt .next
|
82
|
+
nop
|
83
|
+
.do_call:
|
84
|
+
call %i0 /* Call target. */
|
85
|
+
nop
|
86
|
+
or %o0, %g0, %i0 /* pass out retval (mov o0 -> i0) */
|
87
|
+
jmpl %i7 + 8, %g0 /* optimized restore;retl;nop */
|
88
|
+
restore
|
89
|
+
|
90
|
+
/*
|
91
|
+
@@@ complete manual with this, and remove from here once done
|
92
|
+
|
93
|
+
Changes from v8:
|
94
|
+
- fundamental data types
|
95
|
+
- (un)signed int: 8,16,32,64
|
96
|
+
- float: 32,64,128
|
97
|
+
- float: IEEE 754 compilant
|
98
|
+
32 32-bit float registers f0,f1,..,f31
|
99
|
+
32 64-bit float registers f0,f2,..,f62
|
100
|
+
16 128-bit float registers f0,f4,..,f60
|
101
|
+
|
102
|
+
Description:
|
103
|
+
We need to raise up a dynamic stack frame.
|
104
|
+
Therefore we need to compute the stack size. We do this first,
|
105
|
+
in the context of the caller as a leaf function (using o3 as scratch for addition).
|
106
|
+
Then we raise the frame, ending up in o0-o3 is then i0-i3.
|
107
|
+
|
108
|
+
|
109
|
+
Stack Layout:
|
110
|
+
BIAS = 2047
|
111
|
+
|
112
|
+
BIAS+XX: should be 16 byte aligned.
|
113
|
+
...
|
114
|
+
136: argument overflow area
|
115
|
+
128: 1 extended word for struct/union poiner return value
|
116
|
+
BIAS+ 0: 16 extended words for registers (in/local) save area [register window]
|
117
|
+
|
118
|
+
|
119
|
+
Function Argument Passing:
|
120
|
+
- integer %o0..%o5 (caller view).
|
121
|
+
- floating-point %f0 .. %f31
|
122
|
+
- continuous memory starting at %sp+BIAS+136 (caller view).
|
123
|
+
|
124
|
+
Register Usage:
|
125
|
+
%fp0..%fp31 : floating-point arguments.
|
126
|
+
%sp or %o6 : stack pointer, always 8 (or 16?)-byte aligned.
|
127
|
+
%fp or %i6 : frame pointer.
|
128
|
+
%i0 and %o0 : integer and pointer return values.
|
129
|
+
%i7 and %o7 : return address. (caller puts return address to %o7, callee uses %i7)
|
130
|
+
%fp0 and %fp1: return value (float).
|
131
|
+
%i0..%i5 : input argument registers
|
132
|
+
%o0..%o5 : output argument registers
|
133
|
+
%g0 : always zero, writes to it have no effect.
|
134
|
+
|
135
|
+
Register Mappings:
|
136
|
+
r0-7 -> globals
|
137
|
+
r8-15 -> outs
|
138
|
+
r16-r23 -> locals
|
139
|
+
r24-r31 -> ins
|
140
|
+
|
141
|
+
Integer Register Overview Table:
|
142
|
+
ID Class Name Description
|
143
|
+
------------------------------------------------------------------------------
|
144
|
+
0 globals g0 always zero, writes to it have no effect
|
145
|
+
1 g1
|
146
|
+
2 g2
|
147
|
+
3 g3
|
148
|
+
4 g4
|
149
|
+
5 g5
|
150
|
+
6 g6
|
151
|
+
7 g7
|
152
|
+
8 out o0 [int/ptr] arg 0 and return
|
153
|
+
9 o1 arg 1
|
154
|
+
10 o2 arg 2
|
155
|
+
11 o3 arg 3
|
156
|
+
12 o4 arg 4
|
157
|
+
13 o5 arg 5
|
158
|
+
14 o6 stack pointer
|
159
|
+
15 o7
|
160
|
+
16 local l0 scratch
|
161
|
+
17 l1
|
162
|
+
18 l2
|
163
|
+
19 l3
|
164
|
+
20 l4
|
165
|
+
21 l5
|
166
|
+
22 l6
|
167
|
+
23 l7
|
168
|
+
24 in i0 [int/pt] arg 0 and return
|
169
|
+
25 i1
|
170
|
+
26 i2
|
171
|
+
27 i3
|
172
|
+
28 i4
|
173
|
+
29 i5
|
174
|
+
30 i6 frame pointer
|
175
|
+
31 i7
|
176
|
+
*/
|
177
|
+
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description: All x64 abi call kernel 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
|
@@ -30,72 +30,68 @@
|
|
30
30
|
BEGIN_ASM
|
31
31
|
|
32
32
|
/*---------------------------------------------------------------------------
|
33
|
-
|
33
|
+
|
34
34
|
Call Kernel for x64 System V
|
35
|
-
|
36
|
-
Input:
|
37
|
-
RDI : size of arguments to be passed via stack
|
38
|
-
RSI : pointer to arguments to be passed via the stack
|
39
|
-
RDX : pointer to arguments of integral/pointer type to be passed via registers
|
40
|
-
RCX : pointer to arguments of floating point type to be passed via registers
|
41
|
-
R8 : target function pointer
|
42
35
|
|
36
|
+
Input:
|
37
|
+
RDI : size of arguments to be passed via stack
|
38
|
+
RSI : pointer to arguments to be passed via the stack
|
39
|
+
RDX : pointer to arguments of integral/pointer type to be passed via registers
|
40
|
+
RCX : pointer to arguments of floating point type to be passed via registers
|
41
|
+
R8 : target function pointer
|
42
|
+
Notes:
|
43
|
+
RSP+8: is always 16-byte aligned (32-byte align if __m256 is used)
|
43
44
|
*/
|
44
45
|
|
45
46
|
GLOBAL(dcCall_x64_sysv)
|
46
47
|
BEGIN_PROC(dcCall_x64_sysv)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
pop RBX /* Restore RBX. */
|
86
|
-
pop RBP /* Pseudo-epilog. */
|
87
|
-
|
88
|
-
ret
|
48
|
+
PUSH(RBP) /* Pseudo-prolog - preserve RBP. */
|
49
|
+
PUSH(RBX) /* Preserve RBX and store pointer to function in it. */
|
50
|
+
MOV(RSP,RBP) /* Store stack pointer in RBP. */
|
51
|
+
MOV(R8 ,RBX)
|
52
|
+
MOVSD(QWORD(RCX,0) ,XMM0) /* Copy first 8 floats to XMM0-XMM7. */
|
53
|
+
MOVSD(QWORD(RCX,8) ,XMM1)
|
54
|
+
MOVSD(QWORD(RCX,16),XMM2)
|
55
|
+
MOVSD(QWORD(RCX,24),XMM3)
|
56
|
+
MOVSD(QWORD(RCX,32),XMM4)
|
57
|
+
MOVSD(QWORD(RCX,40),XMM5)
|
58
|
+
MOVSD(QWORD(RCX,48),XMM6)
|
59
|
+
MOVSD(QWORD(RCX,56),XMM7)
|
60
|
+
|
61
|
+
ADD(LIT(31),RDI) /* Align stack to 32-byte. */
|
62
|
+
AND(LIT(-32),RDI)
|
63
|
+
ADD(LIT(8),RDI) /* Adjust by 8-byte for the return-address. */
|
64
|
+
SUB(RDI,RSP) /* Setup stack frame by subtracting the size of arguments. */
|
65
|
+
|
66
|
+
MOV(RDI,RCX) /* Store number of bytes to copy to stack in RCX (for rep movsb). */
|
67
|
+
MOV(RSP,RDI) /* Store pointer to beginning of stack arguments in RDI (for rep movsb). */
|
68
|
+
|
69
|
+
REP(MOVSB) /* copy bytes (@@@ should be optimized, movq?). */
|
70
|
+
|
71
|
+
MOV(QWORD(RDX,0),RDI) /* copy first six int/pointer arguments to RDI, RSI, RDX, RCX, R8, R9. */
|
72
|
+
MOV(QWORD(RDX,8),RSI)
|
73
|
+
MOV(QWORD(RDX,24),RCX)
|
74
|
+
MOV(QWORD(RDX,32),R8)
|
75
|
+
MOV(QWORD(RDX,40),R9)
|
76
|
+
MOV(QWORD(RDX,16),RDX) /* Set RDX last to not overwrite it to soon. */
|
77
|
+
|
78
|
+
MOVB(LIT(8),AL) /* Put upper bound of number of used xmm registers in AL. */
|
79
|
+
CALL_REG(RBX) /* Call function. */
|
80
|
+
|
81
|
+
MOV(RBP,RSP) /* Restore stack pointer. */
|
82
|
+
POP(RBX) /* Restore RBX. */
|
83
|
+
POP(RBP) /* Pseudo-epilog. */
|
84
|
+
RET()
|
89
85
|
END_PROC(dcCall_x64_sysv)
|
90
86
|
|
91
87
|
/*---------------------------------------------------------------------------
|
92
88
|
|
93
89
|
Call Kernel for x64 Win64
|
94
|
-
|
90
|
+
|
95
91
|
Input:
|
96
|
-
RCX : size of arguments to be passed via stack
|
97
|
-
RDX : pointer to arguments to be passed via the stack
|
98
|
-
R8 : pointer to arguments of integral/pointer type to be passed via registers
|
92
|
+
RCX : size of arguments to be passed via stack
|
93
|
+
RDX : pointer to arguments to be passed via the stack
|
94
|
+
R8 : pointer to arguments of integral/pointer type to be passed via registers
|
99
95
|
R9 : target function pointer
|
100
96
|
|
101
97
|
*/
|
@@ -103,46 +99,47 @@ END_PROC(dcCall_x64_sysv)
|
|
103
99
|
GLOBAL(dcCall_x64_win64)
|
104
100
|
BEGIN_PROC(dcCall_x64_win64)
|
105
101
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
102
|
+
PUSH(RBP) /* Pseudo-prolog - preserve RBP. */
|
103
|
+
PUSH(RSI) /* Preserve RSI and RDI. */
|
104
|
+
PUSH(RDI)
|
105
|
+
|
106
|
+
MOV(RSP,RBP) /* Store stack pointer in RBP. */
|
107
|
+
|
108
|
+
ADD(LIT(15),RCX) /* Align stack size to 16 bytes. */
|
109
|
+
AND(LIT(-16),RCX)
|
110
|
+
SUB(RCX,RSP) /* Setup stack frame by subtracting the size of the arguments. */
|
111
|
+
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
MOV(RDX, RSI) /* Let RSI point to the arguments. */
|
114
|
+
MOV(RSP, RDI) /* Store pointer to beginning of stack arguments in RDI (for rep movsb). */
|
115
|
+
MOV(R9, RAX) /* Put function address in RAX. */
|
116
116
|
|
117
|
-
|
118
|
-
mov RDI, RSP /* Store pointer to beginning of stack arguments in RDI (for rep movsb). */
|
119
|
-
mov RAX, R9 /* Put function address in RAX. */
|
117
|
+
REP(MOVSB) /* @@@ should be optimized (e.g. movq) */
|
120
118
|
|
121
|
-
|
119
|
+
MOV(QWORD(R8,0),RCX) /* Copy first four arguments to RCX, RDX, R9, R8 ( and XMM0-XMM3. ) */
|
120
|
+
MOV(QWORD(R8,8),RDX)
|
121
|
+
MOV(QWORD(R8,24),R9)
|
122
|
+
MOV(QWORD(R8,16),R8)
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
movd XMM0, RCX
|
128
|
-
movd XMM1, RDX
|
129
|
-
movd XMM2, R8
|
130
|
-
movd XMM3, R9
|
124
|
+
MOVD(RCX, XMM0)
|
125
|
+
MOVD(RDX, XMM1)
|
126
|
+
MOVD(R8, XMM2)
|
127
|
+
MOVD(R9, XMM3)
|
131
128
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
129
|
+
PUSH(R9) /* Push first four arguments onto the stack preserve area. */
|
130
|
+
PUSH(R8)
|
131
|
+
PUSH(RDX)
|
132
|
+
PUSH(RCX)
|
136
133
|
|
137
|
-
|
134
|
+
CALL_REG(RAX) /* Invoke function. */
|
138
135
|
|
139
|
-
|
136
|
+
MOV(RBP, RSP) /* Restore stack pointer (such that we can pop the preserved vALues). */
|
140
137
|
|
141
|
-
|
142
|
-
|
143
|
-
|
138
|
+
POP(RDI) /* Restore RSI and RDI. */
|
139
|
+
POP(RSI)
|
140
|
+
POP(RBP) /* Pseudo-epilog. */
|
144
141
|
|
145
|
-
|
142
|
+
RET()
|
146
143
|
|
147
144
|
END_PROC(dcCall_x64_win64)
|
148
145
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
Description:
|
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: All - except Plan9 - x86 abi call kernel 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
|
@@ -35,7 +35,7 @@ BEGIN_ASM
|
|
35
35
|
ddCall_x86_sys_XXX(int_ptr target, void* args, size_t size);
|
36
36
|
|
37
37
|
Where XXX is one of calling-conventions,
|
38
|
-
|
38
|
+
cdecl, win32_msthis, win32_std, win32_fastcall.
|
39
39
|
|
40
40
|
Parameter Stack layout:
|
41
41
|
size := EBP + 16
|
@@ -67,14 +67,14 @@ BEGIN_PROC(dcCall_x86_cdecl)
|
|
67
67
|
ANDL(LIT(-16),ECX)
|
68
68
|
MOVL(ECX,DWORD(EBP,16)) /* save ECX. */
|
69
69
|
SUBL(ECX,ESP) /* allocate stack size */
|
70
|
-
MOVL(ESP,EDI) /* EDI = stack ptr */
|
71
|
-
|
70
|
+
MOVL(ESP,EDI) /* EDI = stack ptr */
|
71
|
+
|
72
72
|
/*
|
73
73
|
work around for rep movsd (not supported by SunPro)
|
74
|
-
|
75
|
-
SHRL(LIT(2),ECX)
|
74
|
+
|
75
|
+
SHRL(LIT(2),ECX)
|
76
76
|
REP(MOVSD)
|
77
|
-
|
77
|
+
|
78
78
|
*/
|
79
79
|
|
80
80
|
REP(MOVSB)
|
@@ -185,7 +185,7 @@ END_PROC(dcCall_x86_win32_fast)
|
|
185
185
|
GLOBAL(dcCall_x86_sys_int80h_linux)
|
186
186
|
BEGIN_PROC(dcCall_x86_sys_int80h_linux)
|
187
187
|
PUSH(EBP) /* prolog. */
|
188
|
-
|
188
|
+
MOVL(ESP,EBP)
|
189
189
|
PUSH(EBX) /* save preserved. */
|
190
190
|
PUSH(ESI)
|
191
191
|
PUSH(EDI)
|
@@ -215,7 +215,7 @@ END_PROC(dcCall_x86_sys_int80h_linux)
|
|
215
215
|
GLOBAL(dcCall_x86_sys_int80h_bsd)
|
216
216
|
BEGIN_PROC(dcCall_x86_sys_int80h_bsd)
|
217
217
|
PUSH(EBP) /* prolog. */
|
218
|
-
|
218
|
+
MOVL(ESP,EBP)
|
219
219
|
PUSH(ESI) /* save preserved. */
|
220
220
|
PUSH(EDI)
|
221
221
|
MOVL(DWORD(EBP,12),ESI) /* ESI = pointer on args. */
|