rbdc 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/dyncall/BUGS +1 -1
  3. data/dyncall/CMakeLists.txt +19 -7
  4. data/dyncall/ChangeLog +61 -20
  5. data/dyncall/LICENSE +1 -1
  6. data/dyncall/Makefile.generic +2 -0
  7. data/dyncall/ToDo +97 -29
  8. data/dyncall/autovar/README.txt +1 -0
  9. data/dyncall/autovar/autovar_ABI.h +4 -2
  10. data/dyncall/autovar/autovar_ARCH.h +9 -5
  11. data/dyncall/autovar/autovar_CC.h +3 -1
  12. data/dyncall/autovar/autovar_OS.h +2 -2
  13. data/dyncall/autovar/autovar_OSFAMILY.h +1 -1
  14. data/dyncall/configure +94 -38
  15. data/dyncall/dyncall/dyncall.3 +8 -4
  16. data/dyncall/dyncall/dyncall.h +1 -1
  17. data/dyncall/dyncall/dyncall_alloc.h +1 -1
  18. data/dyncall/dyncall/dyncall_api.c +3 -1
  19. data/dyncall/dyncall/dyncall_call.S +13 -5
  20. data/dyncall/dyncall/dyncall_call_arm32_arm.S +1 -2
  21. data/dyncall/dyncall/dyncall_call_arm32_arm.h +1 -1
  22. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +24 -26
  23. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +1 -1
  24. data/dyncall/dyncall/dyncall_call_arm32_thumb.h +1 -1
  25. data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +1 -1
  26. data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +3 -7
  27. data/dyncall/dyncall/dyncall_call_arm64.S +2 -2
  28. data/dyncall/dyncall/dyncall_call_arm64.h +2 -2
  29. data/dyncall/dyncall/dyncall_call_mips.h +1 -1
  30. data/dyncall/dyncall/dyncall_call_mips_eabi.h +1 -1
  31. data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +16 -16
  32. data/dyncall/dyncall/dyncall_call_mips_gas.S +2 -2
  33. data/dyncall/dyncall/dyncall_call_mips_n32.h +5 -4
  34. data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +4 -4
  35. data/dyncall/dyncall/dyncall_call_mips_n64.h +3 -3
  36. data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +2 -2
  37. data/dyncall/dyncall/dyncall_call_mips_o32.h +4 -3
  38. data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +1 -3
  39. data/dyncall/dyncall/dyncall_call_ppc32.S +1 -1
  40. data/dyncall/dyncall/dyncall_call_ppc32.h +1 -1
  41. data/dyncall/dyncall/dyncall_call_sparc.h +1 -1
  42. data/dyncall/dyncall/{dyncall_call_sparc.S → dyncall_call_sparc.s} +39 -44
  43. data/dyncall/dyncall/dyncall_call_sparc64.h +5 -5
  44. data/dyncall/dyncall/dyncall_call_sparc64.s +177 -0
  45. data/dyncall/dyncall/dyncall_call_x64.S +83 -86
  46. data/dyncall/dyncall/dyncall_call_x64.h +1 -1
  47. data/dyncall/dyncall/dyncall_call_x86.S +9 -9
  48. data/dyncall/dyncall/dyncall_call_x86.h +1 -1
  49. data/dyncall/dyncall/dyncall_call_x86_nasm.asm +5 -5
  50. data/dyncall/dyncall/dyncall_callf.c +18 -18
  51. data/dyncall/dyncall/dyncall_callf.h +1 -1
  52. data/dyncall/dyncall/dyncall_callvm.c +3 -3
  53. data/dyncall/dyncall/dyncall_callvm.h +1 -1
  54. data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +25 -40
  55. data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +1 -5
  56. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +25 -33
  57. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +1 -5
  58. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +24 -36
  59. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +1 -5
  60. data/dyncall/dyncall/dyncall_callvm_arm64.c +23 -27
  61. data/dyncall/dyncall/dyncall_callvm_arm64.h +2 -6
  62. data/dyncall/dyncall/dyncall_callvm_arm64_apple.c +23 -30
  63. data/dyncall/dyncall/dyncall_callvm_base.c +1 -1
  64. data/dyncall/dyncall/dyncall_callvm_mips.c +1 -1
  65. data/dyncall/dyncall/dyncall_callvm_mips.h +1 -1
  66. data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +30 -27
  67. data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +1 -5
  68. data/dyncall/dyncall/dyncall_callvm_mips_n32.c +24 -30
  69. data/dyncall/dyncall/{dyncall_call_sparc_v9.h → dyncall_callvm_mips_n32.h} +18 -8
  70. data/dyncall/dyncall/dyncall_callvm_mips_n64.c +23 -30
  71. data/dyncall/dyncall/dyncall_callvm_mips_n64.h +4 -6
  72. data/dyncall/dyncall/dyncall_callvm_mips_o32.c +31 -29
  73. data/dyncall/dyncall/dyncall_callvm_mips_o32.h +1 -3
  74. data/dyncall/dyncall/dyncall_callvm_ppc32.c +22 -20
  75. data/dyncall/dyncall/dyncall_callvm_ppc32.h +1 -3
  76. data/dyncall/dyncall/dyncall_callvm_ppc64.c +54 -15
  77. data/dyncall/dyncall/dyncall_callvm_ppc64.h +0 -2
  78. data/dyncall/dyncall/dyncall_callvm_sparc.c +34 -26
  79. data/dyncall/dyncall/dyncall_callvm_sparc.h +1 -3
  80. data/dyncall/dyncall/dyncall_callvm_sparc64.c +94 -150
  81. data/dyncall/dyncall/dyncall_callvm_sparc64.h +11 -17
  82. data/dyncall/dyncall/dyncall_callvm_x64.c +37 -36
  83. data/dyncall/dyncall/dyncall_callvm_x64.h +1 -4
  84. data/dyncall/dyncall/dyncall_callvm_x86.c +22 -63
  85. data/dyncall/dyncall/dyncall_callvm_x86.h +1 -17
  86. data/dyncall/dyncall/dyncall_config.h +1 -1
  87. data/dyncall/dyncall/dyncall_macros.h +28 -19
  88. data/dyncall/dyncall/dyncall_signature.h +1 -1
  89. data/dyncall/dyncall/dyncall_types.h +17 -18
  90. data/dyncall/dyncall/dyncall_utils.h +1 -1
  91. data/dyncall/dyncall/dyncall_value.h +28 -21
  92. data/dyncall/dyncall/dyncall_vector.c +1 -1
  93. data/dyncall/dyncall/dyncall_vector.h +1 -1
  94. data/dyncall/dyncall/gen-masm.sh +2 -2
  95. data/dyncall/dyncallback/CMakeLists.txt +1 -2
  96. data/dyncall/dyncallback/Makefile.generic +1 -1
  97. data/dyncall/dyncallback/dyncall_alloc_wx.c +1 -1
  98. data/dyncall/dyncallback/dyncall_alloc_wx.h +4 -3
  99. data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +8 -2
  100. data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +67 -4
  101. data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +7 -2
  102. data/dyncall/dyncallback/dyncall_args.c +19 -15
  103. data/dyncall/dyncallback/dyncall_args.h +1 -1
  104. data/dyncall/dyncallback/{dyncall_args_arm32_arm.c → dyncall_args_arm32.c} +4 -4
  105. data/dyncall/dyncallback/{dyncall_args_arm32_arm.h → dyncall_args_arm32.h} +6 -6
  106. data/dyncall/dyncallback/dyncall_args_arm64.c +2 -2
  107. data/dyncall/dyncallback/dyncall_args_arm64_apple.c +2 -2
  108. data/dyncall/dyncallback/dyncall_args_mips.c +26 -21
  109. data/dyncall/dyncallback/dyncall_args_mips.h +18 -6
  110. data/dyncall/dyncallback/dyncall_args_mips64.c +81 -0
  111. data/dyncall/dyncallback/dyncall_args_mips_o32.c +104 -0
  112. data/dyncall/dyncallback/dyncall_args_ppc32.c +2 -2
  113. data/dyncall/dyncallback/dyncall_args_ppc32.h +1 -1
  114. data/dyncall/dyncallback/dyncall_args_ppc32_sysv.c +1 -1
  115. data/dyncall/dyncallback/dyncall_args_ppc64.c +24 -3
  116. data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -15
  117. data/dyncall/dyncallback/dyncall_args_sparc32.h +2 -2
  118. data/dyncall/dyncallback/dyncall_args_sparc64.c +28 -15
  119. data/dyncall/dyncallback/dyncall_args_sparc64.h +7 -3
  120. data/dyncall/dyncallback/dyncall_args_x64.c +1 -1
  121. data/dyncall/dyncallback/dyncall_args_x64.h +1 -1
  122. data/dyncall/dyncallback/dyncall_args_x86.c +1 -1
  123. data/dyncall/dyncallback/dyncall_args_x86.h +1 -1
  124. data/dyncall/dyncallback/dyncall_callback.c +10 -12
  125. data/dyncall/dyncallback/dyncall_callback.h +2 -4
  126. data/dyncall/dyncallback/dyncall_callback_arch.S +12 -2
  127. data/dyncall/dyncallback/{dyncall_callback_arm32_arm.c → dyncall_callback_arm32.c} +25 -10
  128. data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +7 -7
  129. data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.S +9 -9
  130. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.S +1 -1
  131. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.S +1 -1
  132. data/dyncall/dyncallback/dyncall_callback_arm64.S +2 -2
  133. data/dyncall/dyncallback/dyncall_callback_arm64.c +20 -14
  134. data/dyncall/dyncallback/dyncall_callback_mips.c +26 -9
  135. data/dyncall/dyncallback/dyncall_callback_mips_eabi_gas.s +99 -0
  136. data/dyncall/dyncallback/{dyncall_args_arm32_thumb.h → dyncall_callback_mips_gas.S} +14 -9
  137. data/dyncall/dyncallback/{dyncall_callback_arm32_thumb.c → dyncall_callback_mips_n32_gas.s} +12 -7
  138. data/dyncall/dyncallback/dyncall_callback_mips_n64_gas.s +98 -0
  139. data/dyncall/dyncallback/dyncall_callback_mips_o32_gas.s +100 -0
  140. data/dyncall/dyncallback/dyncall_callback_ppc32.S +54 -54
  141. data/dyncall/dyncallback/dyncall_callback_ppc32.c +23 -5
  142. data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +92 -117
  143. data/dyncall/dyncallback/dyncall_callback_ppc64.S +2 -2
  144. data/dyncall/dyncallback/dyncall_callback_ppc64.c +23 -5
  145. data/dyncall/dyncallback/dyncall_callback_sparc32.c +25 -7
  146. data/dyncall/dyncallback/dyncall_callback_sparc32.s +55 -4
  147. data/dyncall/dyncallback/dyncall_callback_sparc64.c +25 -7
  148. data/dyncall/dyncallback/dyncall_callback_sparc64.s +89 -5
  149. data/dyncall/dyncallback/dyncall_callback_x64.S +8 -8
  150. data/dyncall/dyncallback/dyncall_callback_x64.c +19 -6
  151. data/dyncall/dyncallback/dyncall_callback_x86.S +29 -25
  152. data/dyncall/dyncallback/dyncall_callback_x86.c +24 -11
  153. data/dyncall/dyncallback/dyncall_thunk.c +6 -6
  154. data/dyncall/dyncallback/dyncall_thunk.h +9 -7
  155. data/dyncall/dyncallback/{dyncall_thunk_arm32_arm.c → dyncall_thunk_arm32.c} +5 -3
  156. data/dyncall/dyncallback/{dyncall_thunk_arm32_arm.h → dyncall_thunk_arm32.h} +7 -7
  157. data/dyncall/dyncallback/dyncall_thunk_arm64.c +2 -2
  158. data/dyncall/dyncallback/dyncall_thunk_arm64.h +8 -13
  159. data/dyncall/dyncallback/dyncall_thunk_mips.c +16 -20
  160. data/dyncall/dyncallback/dyncall_thunk_mips.h +4 -2
  161. data/dyncall/dyncallback/dyncall_thunk_mips64.c +103 -0
  162. data/dyncall/dyncallback/{dyncall_callback_arm32_thumb.h → dyncall_thunk_mips64.h} +15 -8
  163. data/dyncall/dyncallback/dyncall_thunk_ppc32.c +4 -4
  164. data/dyncall/dyncallback/dyncall_thunk_ppc32.h +1 -1
  165. data/dyncall/dyncallback/dyncall_thunk_ppc32_sysv.c +9 -9
  166. data/dyncall/dyncallback/dyncall_thunk_ppc64.c +2 -2
  167. data/dyncall/dyncallback/dyncall_thunk_sparc32.c +19 -2
  168. data/dyncall/dyncallback/dyncall_thunk_sparc32.h +5 -4
  169. data/dyncall/dyncallback/dyncall_thunk_sparc64.c +42 -2
  170. data/dyncall/dyncallback/dyncall_thunk_sparc64.h +5 -5
  171. data/dyncall/dyncallback/dyncall_thunk_x64.c +1 -1
  172. data/dyncall/dyncallback/dyncall_thunk_x64.h +2 -2
  173. data/dyncall/dyncallback/dyncall_thunk_x86.c +1 -1
  174. data/dyncall/dyncallback/dyncall_thunk_x86.h +2 -2
  175. data/dyncall/dyncallback/dyncallback.3 +16 -11
  176. data/dyncall/dynload/dynload.3 +63 -8
  177. data/dyncall/dynload/dynload.c +2 -8
  178. data/dyncall/dynload/dynload.h +9 -5
  179. data/dyncall/dynload/dynload_alloc.h +1 -1
  180. data/dyncall/dynload/dynload_syms.c +1 -3
  181. data/dyncall/dynload/dynload_syms_elf.c +19 -11
  182. data/dyncall/dynload/dynload_syms_mach-o.c +151 -75
  183. data/dyncall/dynload/dynload_syms_pe.c +24 -24
  184. data/dyncall/dynload/dynload_unix.c +156 -13
  185. data/dyncall/dynload/dynload_windows.c +15 -11
  186. data/dyncall/portasm/portasm-arm.S +1 -1
  187. data/dyncall/portasm/portasm-ppc.S +1 -1
  188. data/dyncall/portasm/{portasm-x64-att.S → portasm-x64.S} +7 -4
  189. data/dyncall/portasm/portasm-x86.S +4 -2
  190. data/{dyncall-bindings/ruby/rbdc/extconf.rb → extconf.rb} +4 -4
  191. data/{dyncall-bindings/ruby/rbdc/rbdc.c → rbdc.c} +5 -5
  192. metadata +24 -48
  193. data/dyncall/Makefile.M +0 -15
  194. data/dyncall/buildsys/dynmake/Makefile.base.M +0 -82
  195. data/dyncall/buildsys/dynmake/dynmake.bat +0 -2
  196. data/dyncall/buildsys/dynmake/dynmake.sh +0 -4
  197. data/dyncall/dynMakefile +0 -4
  198. data/dyncall/dyncall/Makefile.M +0 -10
  199. data/dyncall/dyncall/TODO +0 -9
  200. data/dyncall/dyncall/dynMakefile +0 -4
  201. data/dyncall/dyncall/dyncall_call_sparc64.S +0 -362
  202. data/dyncall/dyncall/dyncall_call_sparc_v9.S +0 -222
  203. data/dyncall/dyncall/dyncall_call_x64-att.S +0 -147
  204. data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +0 -182
  205. data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +0 -46
  206. data/dyncall/dyncallback/Makefile.M +0 -10
  207. data/dyncall/dyncallback/README.txt +0 -9
  208. data/dyncall/dyncallback/TODO +0 -4
  209. data/dyncall/dyncallback/dynMakefile +0 -4
  210. data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +0 -30
  211. data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +0 -46
  212. data/dyncall/dyncallback/dyncall_callback_mips.h +0 -43
  213. data/dyncall/dyncallback/dyncall_callback_ppc32.h +0 -43
  214. data/dyncall/dyncallback/dyncall_callback_ppc64.h +0 -56
  215. data/dyncall/dyncallback/dyncall_callback_sparc32.h +0 -44
  216. data/dyncall/dyncallback/dyncall_callback_x64.h +0 -45
  217. data/dyncall/dyncallback/dyncall_callback_x86.h +0 -50
  218. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +0 -30
  219. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +0 -36
  220. data/dyncall/dynload/Makefile.M +0 -10
  221. data/dyncall/dynload/TODO +0 -20
  222. data/dyncall/dynload/dynMakefile +0 -4
  223. data/dyncall/dynload/dynload_darwin.c +0 -90
@@ -6,7 +6,7 @@
6
6
  Description:
7
7
  License:
8
8
 
9
- Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>
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 DYNCALL_CALL_SPARC64_H
28
- #define DYNCALL_CALL_SPARC64_H
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 dcCall_sparc64 (DCpointer target, DCsize size, DCpointer data);
36
+ void dcCall_v9 (DCCallVM* vm, DCpointer target);
37
37
 
38
38
  #ifdef __cplusplus
39
39
  }
40
40
  #endif
41
41
 
42
- #endif /* DYNCALL_CALL_SPARC64_H */
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-2015 Daniel Adler <dadler@uni-goettingen.de>,
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
- push RBP /* Pseudo-prolog - preserve RBP. */
49
- push RBX /* Preserve RBX and store pointer to function in it. */
50
-
51
- mov RBP, RSP /* Store stack pointer in RBP. */
52
-
53
- mov RBX, R8
54
-
55
- movsd XMM0, qword ptr[RCX ] /* Copy first 8 floats to XMM0-XMM7 (this makes RCX free to use). */
56
- movsd XMM1, qword ptr[RCX+ 8]
57
- movsd XMM2, qword ptr[RCX+16]
58
- movsd XMM3, qword ptr[RCX+24]
59
- movsd XMM4, qword ptr[RCX+32]
60
- movsd XMM5, qword ptr[RCX+40]
61
- movsd XMM6, qword ptr[RCX+48]
62
- movsd XMM7, qword ptr[RCX+56]
63
-
64
- sub RSP, RDI /* Setup stack frame by subtracting the size of the arguments. */
65
-
66
- and RSP, -32 /* Align stack to 32-byte border. */
67
-
68
- mov RCX, RDI /* Store number of bytes to copy to stack in RCX (for rep movsb). */
69
- mov RDI, RSP /* Store pointer to beginning of stack arguments in RDI (for rep movsb). */
70
-
71
- rep movsb /* @@@ should be optimized (e.g. movq) */
72
-
73
- mov RDI, qword ptr[RDX ] /* Copy first six int/pointer arguments to RDI, RSI, RDX, RCX, R8, R9. */
74
- mov RSI, qword ptr[RDX+ 8]
75
- mov RCX, qword ptr[RDX+24]
76
- mov R8, qword ptr[RDX+32]
77
- mov R9, qword ptr[RDX+40]
78
- mov RDX, qword ptr[RDX+16] /* Set RDX last to not overwrite it to soon. */
79
-
80
- mov AL, 8 /* Put upper bound of number of used xmm registers in AL. */
81
- call RBX /* Invoke function. */
82
-
83
- mov RSP, RBP /* Restore stack pointer (such that we can pop the preserved vALues). */
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
- push RBP /* Pseudo-prolog - preserve RBP. */
107
- push RSI /* Preserve RSI and RDI. */
108
- push RDI
109
-
110
- /* and RSP, -16 /* Align frame to 16 bytes. */
111
- mov RBP, RSP /* Store stack pointer in RBP. */
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
- add RCX, 15 /* Align stack size to 16 bytes. */
114
- and RCX, -16
115
- sub RSP, RCX /* Setup stack frame by subtracting the size of the arguments. */
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
- mov RSI, RDX /* Let RSI point to the arguments. */
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
- rep movsb /* @@@ should be optimized (e.g. movq) */
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
- mov RCX, qword ptr[R8 ] /* Copy first four arguments to RCX, RDX, R8, R9 and XMM0-XMM3. */
124
- mov RDX, qword ptr[R8+ 8]
125
- mov R9, qword ptr[R8+24] /* Set R9 first to not overwrite R8 too soon. */
126
- mov R8, qword ptr[R8+16]
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
- push R9 /* Push first four arguments onto the stack preserve area. */
133
- push R8
134
- push RDX
135
- push RCX
129
+ PUSH(R9) /* Push first four arguments onto the stack preserve area. */
130
+ PUSH(R8)
131
+ PUSH(RDX)
132
+ PUSH(RCX)
136
133
 
137
- call RAX /* Invoke function. */
134
+ CALL_REG(RAX) /* Invoke function. */
138
135
 
139
- mov RSP, RBP /* Restore stack pointer (such that we can pop the preserved vALues). */
136
+ MOV(RBP, RSP) /* Restore stack pointer (such that we can pop the preserved vALues). */
140
137
 
141
- pop RDI /* Restore RSI and RDI. */
142
- pop RSI
143
- pop RBP /* Pseudo-epilog. */
138
+ POP(RDI) /* Restore RSI and RDI. */
139
+ POP(RSI)
140
+ POP(RBP) /* Pseudo-epilog. */
144
141
 
145
- ret
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-2015 Daniel Adler <dadler@uni-goettingen.de>,
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-2015 Daniel Adler <dadler@uni-goettingen.de>,
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
- cdecl, win32_msthis, win32_std, win32_fastcall.
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
- MOVL(ESP,EBP)
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
- MOVL(ESP,EBP)
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. */