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
@@ -1,222 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
Package: dyncall
|
4
|
-
Library: dyncall
|
5
|
-
File: dyncall/dyncall_call_sparc_v9.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
|
-
#define BIAS 2047
|
27
|
-
.global dcCall_v9
|
28
|
-
/* dcCall_sparc64( DCCallVM* , void * target ) */
|
29
|
-
/* o0 o1 */
|
30
|
-
dcCall_v9:
|
31
|
-
or %o0, %g0, %o3 /* o3: callvm */
|
32
|
-
or %o1, %g0, %o0 /* o0: target */
|
33
|
-
ldx [%o3+24], %o1 /* o1: mVecSize */
|
34
|
-
add %o3, 32, %o2 /* o2: stack */
|
35
|
-
/* Compute a matching stack size (approximate): o3 = align(o1+136,16) */
|
36
|
-
|
37
|
-
add %o1, (16+1+6)*8+15, %o3
|
38
|
-
and %o3, -16, %o3
|
39
|
-
neg %o3 /* o3: -stacksize */
|
40
|
-
save %sp, %o3, %sp
|
41
|
-
|
42
|
-
ldd [%i2+8*0 ],%f0 /* Load double-precision float registers. */
|
43
|
-
ldd [%i2+8*1 ],%f2
|
44
|
-
ldd [%i2+8*2 ],%f4
|
45
|
-
ldd [%i2+8*3 ],%f6
|
46
|
-
ldd [%i2+8*4 ],%f8
|
47
|
-
ldd [%i2+8*5 ],%f10
|
48
|
-
ldd [%i2+8*6 ],%f12
|
49
|
-
ldd [%i2+8*7 ],%f14
|
50
|
-
ldd [%i2+8*8 ],%f16
|
51
|
-
ldd [%i2+8*9 ],%f18
|
52
|
-
ldd [%i2+8*10],%f20
|
53
|
-
ldd [%i2+8*11],%f22
|
54
|
-
ldd [%i2+8*12],%f24
|
55
|
-
ldd [%i2+8*13],%f26
|
56
|
-
ldd [%i2+8*14],%f28
|
57
|
-
ldd [%i2+8*15],%f30
|
58
|
-
ldx [%i2+8*0],%o0 /* Load output registers. */
|
59
|
-
ldx [%i2+8*1],%o1
|
60
|
-
ldx [%i2+8*2],%o2
|
61
|
-
ldx [%i2+8*3],%o3
|
62
|
-
ldx [%i2+8*4],%o4
|
63
|
-
ldx [%i2+8*5],%o5
|
64
|
-
sub %i1, 48, %i1
|
65
|
-
cmp %i1, 0
|
66
|
-
ble .do_call
|
67
|
-
nop
|
68
|
-
/* Copy loop: */
|
69
|
-
add %i2, 48, %i2 /* skip homing area */
|
70
|
-
or %g0, %g0, %l0 /* l0 = offset initialized to 0. */
|
71
|
-
add %sp, BIAS+((16+6)*8), %l2 /* l2 = argument area on stack space (7th word). (64+4+6*4 = byte offset 92). */
|
72
|
-
.next:
|
73
|
-
ldx [%i2+%l0],%l1 /* Read from arg buffer(%i2) to %l1. */
|
74
|
-
stx %l1, [%l2+%l0] /* Write %l1 to stack space(%l2). */
|
75
|
-
add %l0, 8, %l0 /* Increment offset. */
|
76
|
-
sub %i1, 8, %i1 /* Decrement copy size. */
|
77
|
-
cmp %i1, 0
|
78
|
-
bgt .next
|
79
|
-
nop
|
80
|
-
.do_call:
|
81
|
-
call %i0 /* Call target. */
|
82
|
-
nop
|
83
|
-
or %o0, %g0, %i0
|
84
|
-
jmpl %i7 + 8, %g0
|
85
|
-
restore
|
86
|
-
|
87
|
-
/*
|
88
|
-
or %o0, %g0, %i0
|
89
|
-
or %o1, %g0, %i1
|
90
|
-
or %o2, %g0, %i2
|
91
|
-
or %o3, %g0, %i3
|
92
|
-
return %i7 + 8
|
93
|
-
nop
|
94
|
-
|
95
|
-
Changes from v8:
|
96
|
-
- fundamental data types
|
97
|
-
- (un)signed int: 8,16,32,64
|
98
|
-
- float: 32,64,128
|
99
|
-
- float: IEEE 754 compilant
|
100
|
-
32 32-bit float registers f0,f1,..,f31
|
101
|
-
32 64-bit float registers f0,f2,..,f62
|
102
|
-
16 128-bit float registers f0,f4,..,f60
|
103
|
-
|
104
|
-
Description:
|
105
|
-
We need to raise up a dynamic stack frame.
|
106
|
-
Therefore we need to compute the stack size. We do this first,
|
107
|
-
in the context of the caller as a leaf function (using o3 as scratch for addition).
|
108
|
-
Then we raise the frame, ending up in o0-o3 is then i0-i3.
|
109
|
-
|
110
|
-
|
111
|
-
Stack Layout:
|
112
|
-
BIAS = 2047
|
113
|
-
|
114
|
-
BIAS+XX: should be 16 byte aligned.
|
115
|
-
...
|
116
|
-
136: argument overflow area
|
117
|
-
128: 1 extended word for struct/union poiner return value
|
118
|
-
BIAS+ 0: 16 extended words for registers (in/local) save area [register window]
|
119
|
-
|
120
|
-
|
121
|
-
Function Argument Passing:
|
122
|
-
- integer %o0..%o5 (caller view).
|
123
|
-
- floating-point %f0 .. %f15
|
124
|
-
- continuous memory starting at %sp+BIAS+136 (caller view).
|
125
|
-
|
126
|
-
Register Usage:
|
127
|
-
%fp0..%fp31 : floating-point arguments.
|
128
|
-
%sp or %o6 : stack pointer, always 8 (or 16?)-byte aligned.
|
129
|
-
%fp or %i6 : frame pointer.
|
130
|
-
%i0 and %o0 : integer and pointer return values.
|
131
|
-
%i7 and %o7 : return address. (caller puts return address to %o7, callee uses %i7)
|
132
|
-
%fp0 and %fp1: return value (float).
|
133
|
-
%i0..%i5 : input argument registers
|
134
|
-
%o0..%o5 : output argument registers
|
135
|
-
%g0 : always zero, writes to it have no effect.
|
136
|
-
|
137
|
-
Register Mappings:
|
138
|
-
r0-7 -> globals
|
139
|
-
r8-15 -> outs
|
140
|
-
r16-r23 -> locals
|
141
|
-
r24-r31 -> ins
|
142
|
-
|
143
|
-
Integer Register Overview Table:
|
144
|
-
ID Class Name Description
|
145
|
-
------------------------------------------------------------------------------
|
146
|
-
0 globals g0 always zero, writes to it have no effect
|
147
|
-
1 g1
|
148
|
-
2 g2
|
149
|
-
3 g3
|
150
|
-
4 g4
|
151
|
-
5 g5
|
152
|
-
6 g6
|
153
|
-
7 g7
|
154
|
-
8 out o0 [int/ptr] arg 0 and return
|
155
|
-
9 o1 arg 1
|
156
|
-
10 o2 arg 2
|
157
|
-
11 o3 arg 3
|
158
|
-
12 o4 arg 4
|
159
|
-
13 o5 arg 5
|
160
|
-
14 o6 stack pointer
|
161
|
-
15 o7
|
162
|
-
16 local l0 scratch
|
163
|
-
17 l1
|
164
|
-
18 l2
|
165
|
-
19 l3
|
166
|
-
20 l4
|
167
|
-
21 l5
|
168
|
-
22 l6
|
169
|
-
23 l7
|
170
|
-
24 in i0 [int/pt] arg 0 and return
|
171
|
-
25 i1
|
172
|
-
26 i2
|
173
|
-
27 i3
|
174
|
-
28 i4
|
175
|
-
29 i5
|
176
|
-
30 i6 frame pointer
|
177
|
-
31 i7
|
178
|
-
*/
|
179
|
-
|
180
|
-
/* ---------------------------------------------------------------------------
|
181
|
-
|
182
|
-
call kernel for sparc64 v9 abi
|
183
|
-
tested on sparc64/linux/debian [gcc54.fsffrance.org - thanx to the farm!]
|
184
|
-
|
185
|
-
new C Interface:
|
186
|
-
void dcCall_sparc (DCCallVM* callvm, DCpointer target);
|
187
|
-
%i0 %1
|
188
|
-
|
189
|
-
see dyncall_call_sparc.S for details.
|
190
|
-
|
191
|
-
old C Interface:
|
192
|
-
void dcCall_sparc (DCpointer target, DCsize size, DCpointer data);
|
193
|
-
%i0 , %i1 , %i2
|
194
|
-
Input:
|
195
|
-
i0 target
|
196
|
-
i1 size
|
197
|
-
i2 data
|
198
|
-
|
199
|
-
*/
|
200
|
-
|
201
|
-
#if 0
|
202
|
-
|
203
|
-
|
204
|
-
#define REGSIZE 8
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
#define SHEAD ((16+6)*8)
|
209
|
-
#define ALIGN 16
|
210
|
-
#define IREGS 6
|
211
|
-
#define FREGS 16
|
212
|
-
#define SREGS 16
|
213
|
-
#define IBASE 0
|
214
|
-
#define FBASE (IREGS*8)
|
215
|
-
|
216
|
-
// #define DHEAD ((IREGS+FREGS)*8)+SREGS*4
|
217
|
-
|
218
|
-
CALLVM_regdata = 72
|
219
|
-
CALLVM_size = 208
|
220
|
-
CALLVM_buffer = 216
|
221
|
-
|
222
|
-
#endif
|
@@ -1,147 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
Package: dyncall
|
4
|
-
Library: dyncall
|
5
|
-
File: dyncall/dyncall_call_x64-att.S
|
6
|
-
Description: All x64 abi call kernel implementation
|
7
|
-
License:
|
8
|
-
|
9
|
-
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
-
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
-
|
12
|
-
Permission to use, copy, modify, and distribute this software for any
|
13
|
-
purpose with or without fee is hereby granted, provided that the above
|
14
|
-
copyright notice and this permission notice appear in all copies.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
-
|
24
|
-
*/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
#include "../portasm/portasm-x64-att.S"
|
29
|
-
|
30
|
-
BEGIN_ASM
|
31
|
-
|
32
|
-
/*---------------------------------------------------------------------------
|
33
|
-
|
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
|
-
Notes:
|
43
|
-
RSP+8: is always 16-byte aligned (32-byte align if __m256 is used)
|
44
|
-
*/
|
45
|
-
|
46
|
-
GLOBAL(dcCall_x64_sysv)
|
47
|
-
BEGIN_PROC(dcCall_x64_sysv)
|
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). */
|
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()
|
85
|
-
END_PROC(dcCALl_x64_sysv)
|
86
|
-
|
87
|
-
/*---------------------------------------------------------------------------
|
88
|
-
|
89
|
-
Call Kernel for x64 Win64
|
90
|
-
|
91
|
-
Input:
|
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
|
95
|
-
R9 : target function pointer
|
96
|
-
|
97
|
-
*/
|
98
|
-
|
99
|
-
GLOBAL(dcCall_x64_win64)
|
100
|
-
BEGIN_PROC(dcCall_x64_win64)
|
101
|
-
|
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
|
-
|
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
|
-
|
117
|
-
REP(MOVSB) /* @@@ should be optimized (e.g. movq) */
|
118
|
-
|
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)
|
123
|
-
|
124
|
-
MOVD(RCX, XMM0)
|
125
|
-
MOVD(RDX, XMM1)
|
126
|
-
MOVD(R8, XMM2)
|
127
|
-
MOVD(R9, XMM3)
|
128
|
-
|
129
|
-
PUSH(R9) /* Push first four arguments onto the stack preserve area. */
|
130
|
-
PUSH(R8)
|
131
|
-
PUSH(RDX)
|
132
|
-
PUSH(RCX)
|
133
|
-
|
134
|
-
CALL_REG(RAX) /* Invoke function. */
|
135
|
-
|
136
|
-
MOV(RBP, RSP) /* Restore stack pointer (such that we can pop the preserved vALues). */
|
137
|
-
|
138
|
-
POP(RDI) /* Restore RSI and RDI. */
|
139
|
-
POP(RSI)
|
140
|
-
POP(RBP) /* Pseudo-epilog. */
|
141
|
-
|
142
|
-
RET()
|
143
|
-
|
144
|
-
END_PROC(dcCall_x64_win64)
|
145
|
-
|
146
|
-
END_ASM
|
147
|
-
|
@@ -1,182 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
Package: dyncall
|
4
|
-
Library: dyncall
|
5
|
-
File: dyncall/dyncall_callvm_sparc_v9.c
|
6
|
-
Description: Call VM for sparc-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
|
-
|
27
|
-
#include "dyncall_callvm_sparc_v9.h"
|
28
|
-
#include "dyncall_call_sparc_v9.h"
|
29
|
-
#include "dyncall_alloc.h"
|
30
|
-
|
31
|
-
/* Reset argument buffer. */
|
32
|
-
static void dc_callvm_reset_v9(DCCallVM* in_self)
|
33
|
-
{
|
34
|
-
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
35
|
-
dcVecResize(&self->mVecHead,0);
|
36
|
-
}
|
37
|
-
|
38
|
-
/* Construtor. */
|
39
|
-
static DCCallVM* dc_callvm_new_v9(DCCallVM_vt* vt, DCsize size)
|
40
|
-
{
|
41
|
-
DCCallVM_v9* self = (DCCallVM_v9*) dcAllocMem(sizeof(DCCallVM_v9)+size);
|
42
|
-
dc_callvm_base_init(&self->mInterface, vt);
|
43
|
-
dcVecInit(&self->mVecHead,size);
|
44
|
-
dc_callvm_reset_v9(&self->mInterface);
|
45
|
-
return (DCCallVM*)self;
|
46
|
-
}
|
47
|
-
|
48
|
-
/* Destructor. */
|
49
|
-
static void dc_callvm_free_v9(DCCallVM* in_self)
|
50
|
-
{
|
51
|
-
dcFreeMem(in_self);
|
52
|
-
}
|
53
|
-
|
54
|
-
static void dc_callvm_argLongLong_v9(DCCallVM* in_self, DClonglong x)
|
55
|
-
{
|
56
|
-
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
57
|
-
dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong));
|
58
|
-
}
|
59
|
-
|
60
|
-
/* all integers are promoted to 64-bit. */
|
61
|
-
static void dc_callvm_argLong_v9 (DCCallVM* in_self, DClong x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
62
|
-
static void dc_callvm_argInt_v9 (DCCallVM* in_self, DCint x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
63
|
-
static void dc_callvm_argBool_v9 (DCCallVM* in_self, DCbool x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
64
|
-
static void dc_callvm_argChar_v9 (DCCallVM* in_self, DCchar x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
65
|
-
static void dc_callvm_argShort_v9 (DCCallVM* in_self, DCshort x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
66
|
-
static void dc_callvm_argPointer_v9(DCCallVM* in_self, DCpointer x) { dc_callvm_argLongLong_v9(in_self, (DClonglong) x ); }
|
67
|
-
|
68
|
-
static void dc_callvm_argDouble_v9(DCCallVM* in_self, DCdouble x)
|
69
|
-
{
|
70
|
-
DCCallVM_v9* self = (DCCallVM_v9*)in_self;
|
71
|
-
dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble));
|
72
|
-
}
|
73
|
-
|
74
|
-
static void dc_callvm_argDouble_v9_ellipsis(DCCallVM* in_self, DCdouble x)
|
75
|
-
{
|
76
|
-
union {
|
77
|
-
long long l;
|
78
|
-
double d;
|
79
|
-
} u;
|
80
|
-
u.d = x;
|
81
|
-
dc_callvm_argLongLong_v9(in_self, u.l);
|
82
|
-
}
|
83
|
-
|
84
|
-
static void dc_callvm_argFloat_v9_ellipsis(DCCallVM* in_self, DCfloat x)
|
85
|
-
{
|
86
|
-
dc_callvm_argDouble_v9_ellipsis(in_self, (DCdouble) x);
|
87
|
-
}
|
88
|
-
|
89
|
-
static void dc_callvm_argFloat_v9(DCCallVM* in_self, DCfloat x)
|
90
|
-
{
|
91
|
-
union {
|
92
|
-
double d;
|
93
|
-
float f[2];
|
94
|
-
} u;
|
95
|
-
u.f[1] = x;
|
96
|
-
dc_callvm_argDouble_v9(in_self, u.d);
|
97
|
-
}
|
98
|
-
|
99
|
-
static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode);
|
100
|
-
|
101
|
-
DCCallVM_vt gVT_v9_ellipsis =
|
102
|
-
{
|
103
|
-
&dc_callvm_free_v9,
|
104
|
-
&dc_callvm_reset_v9,
|
105
|
-
&dc_callvm_mode_v9,
|
106
|
-
&dc_callvm_argBool_v9,
|
107
|
-
&dc_callvm_argChar_v9,
|
108
|
-
&dc_callvm_argShort_v9,
|
109
|
-
&dc_callvm_argInt_v9,
|
110
|
-
&dc_callvm_argLong_v9,
|
111
|
-
&dc_callvm_argLongLong_v9,
|
112
|
-
&dc_callvm_argFloat_v9_ellipsis,
|
113
|
-
&dc_callvm_argDouble_v9_ellipsis,
|
114
|
-
&dc_callvm_argPointer_v9,
|
115
|
-
NULL /* argStruct */,
|
116
|
-
(DCvoidvmfunc*) &dcCall_v9,
|
117
|
-
(DCboolvmfunc*) &dcCall_v9,
|
118
|
-
(DCcharvmfunc*) &dcCall_v9,
|
119
|
-
(DCshortvmfunc*) &dcCall_v9,
|
120
|
-
(DCintvmfunc*) &dcCall_v9,
|
121
|
-
(DClongvmfunc*) &dcCall_v9,
|
122
|
-
(DClonglongvmfunc*) &dcCall_v9,
|
123
|
-
(DCfloatvmfunc*) &dcCall_v9,
|
124
|
-
(DCdoublevmfunc*) &dcCall_v9,
|
125
|
-
(DCpointervmfunc*) &dcCall_v9,
|
126
|
-
NULL /* callStruct */
|
127
|
-
};
|
128
|
-
|
129
|
-
/* CallVM virtual table. */
|
130
|
-
DCCallVM_vt gVT_v9 =
|
131
|
-
{
|
132
|
-
&dc_callvm_free_v9,
|
133
|
-
&dc_callvm_reset_v9,
|
134
|
-
&dc_callvm_mode_v9,
|
135
|
-
&dc_callvm_argBool_v9,
|
136
|
-
&dc_callvm_argChar_v9,
|
137
|
-
&dc_callvm_argShort_v9,
|
138
|
-
&dc_callvm_argInt_v9,
|
139
|
-
&dc_callvm_argLong_v9,
|
140
|
-
&dc_callvm_argLongLong_v9,
|
141
|
-
&dc_callvm_argFloat_v9,
|
142
|
-
&dc_callvm_argDouble_v9,
|
143
|
-
&dc_callvm_argPointer_v9,
|
144
|
-
NULL /* argStruct */,
|
145
|
-
(DCvoidvmfunc*) &dcCall_v9,
|
146
|
-
(DCboolvmfunc*) &dcCall_v9,
|
147
|
-
(DCcharvmfunc*) &dcCall_v9,
|
148
|
-
(DCshortvmfunc*) &dcCall_v9,
|
149
|
-
(DCintvmfunc*) &dcCall_v9,
|
150
|
-
(DClongvmfunc*) &dcCall_v9,
|
151
|
-
(DClonglongvmfunc*) &dcCall_v9,
|
152
|
-
(DCfloatvmfunc*) &dcCall_v9,
|
153
|
-
(DCdoublevmfunc*) &dcCall_v9,
|
154
|
-
(DCpointervmfunc*) &dcCall_v9,
|
155
|
-
NULL /* callStruct */
|
156
|
-
};
|
157
|
-
|
158
|
-
/* mode: only a single mode available currently. */
|
159
|
-
static void dc_callvm_mode_v9(DCCallVM* in_self, DCint mode)
|
160
|
-
{
|
161
|
-
switch(mode) {
|
162
|
-
case DC_CALL_C_DEFAULT:
|
163
|
-
case DC_CALL_C_ELLIPSIS:
|
164
|
-
case DC_CALL_C_SPARC64:
|
165
|
-
in_self->mVTpointer = &gVT_v9;
|
166
|
-
break;
|
167
|
-
case DC_CALL_C_ELLIPSIS_VARARGS:
|
168
|
-
in_self->mVTpointer = &gVT_v9_ellipsis;
|
169
|
-
break;
|
170
|
-
default:
|
171
|
-
in_self->mError = DC_ERROR_UNSUPPORTED_MODE;
|
172
|
-
break;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
|
176
|
-
|
177
|
-
/* Public API. */
|
178
|
-
DCCallVM* dcNewCallVM(DCsize size)
|
179
|
-
{
|
180
|
-
return dc_callvm_new_v9(&gVT_v9,size);
|
181
|
-
}
|
182
|
-
|