rbdc 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. data/bindings/ruby/rbdc/extconf.rb +57 -0
  2. data/bindings/ruby/rbdc/rbdc.c +304 -0
  3. data/dyncall/AUTHORS +4 -0
  4. data/dyncall/BUGS +3 -0
  5. data/dyncall/CMakeLists.txt +79 -0
  6. data/dyncall/ChangeLog +165 -0
  7. data/dyncall/LICENSE +15 -0
  8. data/dyncall/Makefile.M +15 -0
  9. data/dyncall/Makefile.embedded +71 -0
  10. data/dyncall/Makefile.generic +36 -0
  11. data/dyncall/Nmakefile +45 -0
  12. data/dyncall/README +92 -0
  13. data/dyncall/ToDo +114 -0
  14. data/dyncall/autovar/LICENSE.txt +15 -0
  15. data/dyncall/autovar/README.txt +69 -0
  16. data/dyncall/autovar/autovar_ABI.h +44 -0
  17. data/dyncall/autovar/autovar_ARCH.h +56 -0
  18. data/dyncall/autovar/autovar_CC.h +46 -0
  19. data/dyncall/autovar/autovar_OS.h +78 -0
  20. data/dyncall/autovar/autovar_OSFAMILY.h +39 -0
  21. data/dyncall/buildsys/cmake/Modules/FindDynCall.cmake +43 -0
  22. data/dyncall/buildsys/cmake/Modules/FindDynCallback.cmake +43 -0
  23. data/dyncall/buildsys/cmake/Modules/FindDynLoad.cmake +45 -0
  24. data/dyncall/buildsys/cmake/Modules/UseLATEX.cmake +811 -0
  25. data/dyncall/buildsys/dynmake/Makefile.base.M +82 -0
  26. data/dyncall/buildsys/dynmake/dynmake.bat +2 -0
  27. data/dyncall/buildsys/dynmake/dynmake.sh +4 -0
  28. data/dyncall/buildsys/lua/Makefile +10 -0
  29. data/dyncall/buildsys/lua/README.txt +4 -0
  30. data/dyncall/buildsys/lua/bootstrap.sh +34 -0
  31. data/dyncall/buildsys/lua/cleanup.sh +6 -0
  32. data/dyncall/buildsys/lua/mkfile +34 -0
  33. data/dyncall/buildsys/lua/setenv.sh +4 -0
  34. data/dyncall/buildsys/mk/app.mk +30 -0
  35. data/dyncall/buildsys/mk/dirs.mk +27 -0
  36. data/dyncall/buildsys/mk/epilog.mk +30 -0
  37. data/dyncall/buildsys/mk/lib.mk +23 -0
  38. data/dyncall/buildsys/mk/pcc.mk +60 -0
  39. data/dyncall/buildsys/mk/prolog.mk +35 -0
  40. data/dyncall/buildsys/nmake/common.nmake +61 -0
  41. data/dyncall/buildsys/nmake/epilog.nmake +28 -0
  42. data/dyncall/buildsys/nmake/prolog.nmake +76 -0
  43. data/dyncall/buildsys/nmake/tool_gcc.nmake +82 -0
  44. data/dyncall/buildsys/nmake/tool_msvc.nmake +67 -0
  45. data/dyncall/buildsys/scripts/batch-build-linux.sh +11 -0
  46. data/dyncall/buildsys/scripts/batch-build-minix.sh +11 -0
  47. data/dyncall/buildsys/scripts/batch-build-psp.sh +11 -0
  48. data/dyncall/buildsys/scripts/conf-nds.bat +41 -0
  49. data/dyncall/buildsys/scripts/setenv-cross-ios.sh +8 -0
  50. data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +22 -0
  51. data/dyncall/buildsys/vs2005/dyncall/dyncall.vcproj +245 -0
  52. data/dyncall/buildsys/vs2005/test_plain/test_plain.vcproj +202 -0
  53. data/dyncall/buildsys/vs2005/vs2005.sln +29 -0
  54. data/dyncall/configure +152 -0
  55. data/dyncall/configure.bat +157 -0
  56. data/dyncall/configure.rc +234 -0
  57. data/dyncall/dynMakefile +4 -0
  58. data/dyncall/dyncall/CMakeLists.txt +53 -0
  59. data/dyncall/dyncall/DynCallConfig.cmake +3 -0
  60. data/dyncall/dyncall/Makefile.M +10 -0
  61. data/dyncall/dyncall/Makefile.embedded +20 -0
  62. data/dyncall/dyncall/Makefile.generic +16 -0
  63. data/dyncall/dyncall/Nmakefile +62 -0
  64. data/dyncall/dyncall/README-Developer.txt +45 -0
  65. data/dyncall/dyncall/README.txt +65 -0
  66. data/dyncall/dyncall/TODO +9 -0
  67. data/dyncall/dyncall/dynMakefile +4 -0
  68. data/dyncall/dyncall/dyncall.3 +189 -0
  69. data/dyncall/dyncall/dyncall.h +135 -0
  70. data/dyncall/dyncall/dyncall_alloc.h +40 -0
  71. data/dyncall/dyncall/dyncall_api.c +167 -0
  72. data/dyncall/dyncall/dyncall_call.S +72 -0
  73. data/dyncall/dyncall/dyncall_call_arm32_arm.S +80 -0
  74. data/dyncall/dyncall/dyncall_call_arm32_arm.h +61 -0
  75. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +96 -0
  76. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +44 -0
  77. data/dyncall/dyncall/dyncall_call_arm32_thumb.h +65 -0
  78. data/dyncall/dyncall/dyncall_call_arm32_thumb_apple.s +80 -0
  79. data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +121 -0
  80. data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +101 -0
  81. data/dyncall/dyncall/dyncall_call_mips.h +50 -0
  82. data/dyncall/dyncall/dyncall_call_mips_eabi.h +61 -0
  83. data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +115 -0
  84. data/dyncall/dyncall/dyncall_call_mips_gas.S +36 -0
  85. data/dyncall/dyncall/dyncall_call_mips_n32.h +67 -0
  86. data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +192 -0
  87. data/dyncall/dyncall/dyncall_call_mips_n64.h +67 -0
  88. data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +192 -0
  89. data/dyncall/dyncall/dyncall_call_mips_o32.h +70 -0
  90. data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +109 -0
  91. data/dyncall/dyncall/dyncall_call_ppc32.S +266 -0
  92. data/dyncall/dyncall/dyncall_call_ppc32.h +62 -0
  93. data/dyncall/dyncall/dyncall_call_sparc.S +192 -0
  94. data/dyncall/dyncall/dyncall_call_sparc.h +42 -0
  95. data/dyncall/dyncall/dyncall_call_sparc64.S +361 -0
  96. data/dyncall/dyncall/dyncall_call_sparc64.h +42 -0
  97. data/dyncall/dyncall/dyncall_call_sparc_v9.S +220 -0
  98. data/dyncall/dyncall/dyncall_call_sparc_v9.h +42 -0
  99. data/dyncall/dyncall/dyncall_call_x64-att.S +146 -0
  100. data/dyncall/dyncall/dyncall_call_x64.S +149 -0
  101. data/dyncall/dyncall/dyncall_call_x64.h +63 -0
  102. data/dyncall/dyncall/dyncall_call_x64_generic_masm.asm +70 -0
  103. data/dyncall/dyncall/dyncall_call_x86.S +238 -0
  104. data/dyncall/dyncall/dyncall_call_x86.h +70 -0
  105. data/dyncall/dyncall/dyncall_call_x86_8a.s +127 -0
  106. data/dyncall/dyncall/dyncall_call_x86_generic_masm.asm +136 -0
  107. data/dyncall/dyncall/dyncall_call_x86_nasm.asm +234 -0
  108. data/dyncall/dyncall/dyncall_callf.c +112 -0
  109. data/dyncall/dyncall/dyncall_callf.h +52 -0
  110. data/dyncall/dyncall/dyncall_callvm.c +68 -0
  111. data/dyncall/dyncall/dyncall_callvm.h +88 -0
  112. data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +250 -0
  113. data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +59 -0
  114. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +204 -0
  115. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +63 -0
  116. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +271 -0
  117. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +59 -0
  118. data/dyncall/dyncall/dyncall_callvm_base.c +33 -0
  119. data/dyncall/dyncall/dyncall_callvm_mips.c +40 -0
  120. data/dyncall/dyncall/dyncall_callvm_mips.h +37 -0
  121. data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +181 -0
  122. data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +61 -0
  123. data/dyncall/dyncall/dyncall_callvm_mips_n32.c +268 -0
  124. data/dyncall/dyncall/dyncall_callvm_mips_n64.c +268 -0
  125. data/dyncall/dyncall/dyncall_callvm_mips_n64.h +53 -0
  126. data/dyncall/dyncall/dyncall_callvm_mips_o32.c +235 -0
  127. data/dyncall/dyncall/dyncall_callvm_mips_o32.h +45 -0
  128. data/dyncall/dyncall/dyncall_callvm_ppc32.c +372 -0
  129. data/dyncall/dyncall/dyncall_callvm_ppc32.h +61 -0
  130. data/dyncall/dyncall/dyncall_callvm_sparc.c +155 -0
  131. data/dyncall/dyncall/dyncall_callvm_sparc.h +44 -0
  132. data/dyncall/dyncall/dyncall_callvm_sparc64.c +239 -0
  133. data/dyncall/dyncall/dyncall_callvm_sparc64.h +47 -0
  134. data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +182 -0
  135. data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +45 -0
  136. data/dyncall/dyncall/dyncall_callvm_x64.c +228 -0
  137. data/dyncall/dyncall/dyncall_callvm_x64.h +111 -0
  138. data/dyncall/dyncall/dyncall_callvm_x86.c +667 -0
  139. data/dyncall/dyncall/dyncall_callvm_x86.h +75 -0
  140. data/dyncall/dyncall/dyncall_config.h +46 -0
  141. data/dyncall/dyncall/dyncall_macros.h +248 -0
  142. data/dyncall/dyncall/dyncall_signature.h +71 -0
  143. data/dyncall/dyncall/dyncall_struct.c +255 -0
  144. data/dyncall/dyncall/dyncall_struct.h +69 -0
  145. data/dyncall/dyncall/dyncall_types.h +74 -0
  146. data/dyncall/dyncall/dyncall_utils.h +38 -0
  147. data/dyncall/dyncall/dyncall_value.h +73 -0
  148. data/dyncall/dyncall/dyncall_vector.c +52 -0
  149. data/dyncall/dyncall/dyncall_vector.h +56 -0
  150. data/dyncall/dyncall/gen-masm.sh +7 -0
  151. data/dyncall/dyncall/mkfile +29 -0
  152. data/dyncall/dyncallback/CMakeLists.txt +55 -0
  153. data/dyncall/dyncallback/DynCallbackConfig.cmake +2 -0
  154. data/dyncall/dyncallback/Makefile.M +10 -0
  155. data/dyncall/dyncallback/Makefile.embedded +15 -0
  156. data/dyncall/dyncallback/Makefile.generic +20 -0
  157. data/dyncall/dyncallback/Nmakefile +71 -0
  158. data/dyncall/dyncallback/README.txt +9 -0
  159. data/dyncall/dyncallback/TODO +4 -0
  160. data/dyncall/dyncallback/dynMakefile +4 -0
  161. data/dyncall/dyncallback/dyncall_alloc_wx.c +35 -0
  162. data/dyncall/dyncallback/dyncall_alloc_wx.h +46 -0
  163. data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +40 -0
  164. data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +42 -0
  165. data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +42 -0
  166. data/dyncall/dyncallback/dyncall_args.c +45 -0
  167. data/dyncall/dyncallback/dyncall_args.h +65 -0
  168. data/dyncall/dyncallback/dyncall_args_arm32_arm.c +112 -0
  169. data/dyncall/dyncallback/dyncall_args_arm32_arm.h +40 -0
  170. data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +29 -0
  171. data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +32 -0
  172. data/dyncall/dyncallback/dyncall_args_mips.c +81 -0
  173. data/dyncall/dyncallback/dyncall_args_mips.h +41 -0
  174. data/dyncall/dyncallback/dyncall_args_ppc32.c +88 -0
  175. data/dyncall/dyncallback/dyncall_args_ppc32.h +41 -0
  176. data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -0
  177. data/dyncall/dyncallback/dyncall_args_sparc32.h +37 -0
  178. data/dyncall/dyncallback/dyncall_args_sparc64.c +41 -0
  179. data/dyncall/dyncallback/dyncall_args_sparc64.h +37 -0
  180. data/dyncall/dyncallback/dyncall_args_x64.c +73 -0
  181. data/dyncall/dyncallback/dyncall_args_x64.h +44 -0
  182. data/dyncall/dyncallback/dyncall_args_x86.c +121 -0
  183. data/dyncall/dyncallback/dyncall_args_x86.h +58 -0
  184. data/dyncall/dyncallback/dyncall_callback.c +45 -0
  185. data/dyncall/dyncallback/dyncall_callback.h +51 -0
  186. data/dyncall/dyncallback/dyncall_callback_arch.S +71 -0
  187. data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +63 -0
  188. data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +45 -0
  189. data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +73 -0
  190. data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.s +73 -0
  191. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +29 -0
  192. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +33 -0
  193. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.s +32 -0
  194. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.s +32 -0
  195. data/dyncall/dyncallback/dyncall_callback_mips.c +61 -0
  196. data/dyncall/dyncallback/dyncall_callback_mips.h +42 -0
  197. data/dyncall/dyncallback/dyncall_callback_ppc32.S +33 -0
  198. data/dyncall/dyncallback/dyncall_callback_ppc32.c +60 -0
  199. data/dyncall/dyncallback/dyncall_callback_ppc32.h +43 -0
  200. data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +180 -0
  201. data/dyncall/dyncallback/dyncall_callback_sparc32.c +57 -0
  202. data/dyncall/dyncallback/dyncall_callback_sparc32.h +43 -0
  203. data/dyncall/dyncallback/dyncall_callback_sparc32.s +30 -0
  204. data/dyncall/dyncallback/dyncall_callback_sparc64.c +57 -0
  205. data/dyncall/dyncallback/dyncall_callback_sparc64.s +30 -0
  206. data/dyncall/dyncallback/dyncall_callback_x64.S +187 -0
  207. data/dyncall/dyncallback/dyncall_callback_x64.c +69 -0
  208. data/dyncall/dyncallback/dyncall_callback_x64.h +44 -0
  209. data/dyncall/dyncallback/dyncall_callback_x64_apple.s +122 -0
  210. data/dyncall/dyncallback/dyncall_callback_x64_gas.s +119 -0
  211. data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +102 -0
  212. data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +89 -0
  213. data/dyncall/dyncallback/dyncall_callback_x86.S +115 -0
  214. data/dyncall/dyncallback/dyncall_callback_x86.c +281 -0
  215. data/dyncall/dyncallback/dyncall_callback_x86.h +49 -0
  216. data/dyncall/dyncallback/dyncall_callback_x86_8a.s +100 -0
  217. data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +74 -0
  218. data/dyncall/dyncallback/dyncall_thunk.c +47 -0
  219. data/dyncall/dyncallback/dyncall_thunk.h +84 -0
  220. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +45 -0
  221. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +40 -0
  222. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +29 -0
  223. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +35 -0
  224. data/dyncall/dyncallback/dyncall_thunk_mips.c +52 -0
  225. data/dyncall/dyncallback/dyncall_thunk_mips.h +37 -0
  226. data/dyncall/dyncallback/dyncall_thunk_ppc32.c +51 -0
  227. data/dyncall/dyncallback/dyncall_thunk_ppc32.h +40 -0
  228. data/dyncall/dyncallback/dyncall_thunk_sparc32.c +32 -0
  229. data/dyncall/dyncallback/dyncall_thunk_sparc32.h +36 -0
  230. data/dyncall/dyncallback/dyncall_thunk_sparc64.c +32 -0
  231. data/dyncall/dyncallback/dyncall_thunk_sparc64.h +36 -0
  232. data/dyncall/dyncallback/dyncall_thunk_x64.c +48 -0
  233. data/dyncall/dyncallback/dyncall_thunk_x64.h +39 -0
  234. data/dyncall/dyncallback/dyncall_thunk_x86.c +44 -0
  235. data/dyncall/dyncallback/dyncall_thunk_x86.h +39 -0
  236. data/dyncall/dyncallback/dyncallback.3 +134 -0
  237. data/dyncall/dyncallback/gen-masm.sh +8 -0
  238. data/dyncall/dyncallback/mkfile +29 -0
  239. data/dyncall/dynload/CMakeLists.txt +25 -0
  240. data/dyncall/dynload/DynLoadConfig.cmake +3 -0
  241. data/dyncall/dynload/Makefile.M +10 -0
  242. data/dyncall/dynload/Makefile.embedded +22 -0
  243. data/dyncall/dynload/Makefile.generic +18 -0
  244. data/dyncall/dynload/Nmakefile +57 -0
  245. data/dyncall/dynload/README.txt +113 -0
  246. data/dyncall/dynload/TODO +20 -0
  247. data/dyncall/dynload/dynMakefile +4 -0
  248. data/dyncall/dynload/dynload.3 +64 -0
  249. data/dyncall/dynload/dynload.c +38 -0
  250. data/dyncall/dynload/dynload.h +65 -0
  251. data/dyncall/dynload/dynload_alloc.h +40 -0
  252. data/dyncall/dynload/dynload_darwin.c +89 -0
  253. data/dyncall/dynload/dynload_syms.c +38 -0
  254. data/dyncall/dynload/dynload_syms_elf.c +214 -0
  255. data/dyncall/dynload/dynload_syms_mach-o.c +167 -0
  256. data/dyncall/dynload/dynload_syms_pe.c +109 -0
  257. data/dyncall/dynload/dynload_unix.c +57 -0
  258. data/dyncall/dynload/dynload_windows.c +59 -0
  259. data/dyncall/mkfile +36 -0
  260. data/dyncall/portasm/README.txt +42 -0
  261. data/dyncall/portasm/gen-masm.sh +3 -0
  262. data/dyncall/portasm/portasm-arm.S +36 -0
  263. data/dyncall/portasm/portasm-ppc.S +98 -0
  264. data/dyncall/portasm/portasm-x64-att.S +155 -0
  265. data/dyncall/portasm/portasm-x86.S +127 -0
  266. metadata +311 -0
@@ -0,0 +1,111 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncall
5
+ File: dyncall/dyncall_callvm_x64.h
6
+ Description:
7
+ License:
8
+
9
+ Copyright (c) 2007-2011 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
+
29
+ dyncall callvm for x64 architecture
30
+
31
+ SUPPORTED CALLING CONVENTIONS
32
+ MS Windows x64 calling convention, AMD64 SystemV ABI
33
+
34
+ REVISION
35
+ 2007/12/11 initial
36
+
37
+ */
38
+
39
+
40
+ #ifndef DYNCALL_CALLVM_X64_H
41
+ #define DYNCALL_CALLVM_X64_H
42
+
43
+ #include "dyncall_macros.h"
44
+ #include "dyncall_call_x64.h"
45
+ #include "dyncall_callvm.h"
46
+ #include "dyncall_vector.h"
47
+
48
+
49
+ #if defined(DC_WINDOWS)
50
+
51
+ typedef long long int64; /* llp64 */
52
+
53
+ #define numIntRegs 4
54
+ #define numFloatRegs 4
55
+ #define DCRegCount_x64 DCRegCount_x64_u
56
+ #define DCRegData_x64 DCRegData_x64_u
57
+
58
+ #elif defined(DC_UNIX)
59
+
60
+ typedef long int64; /* lp64 */
61
+
62
+ #define numIntRegs 6
63
+ #define numFloatRegs 8
64
+ #define DCRegCount_x64 DCRegCount_x64_s
65
+ #define DCRegData_x64 DCRegData_x64_s
66
+
67
+ #else
68
+
69
+ #error Unsupported OS.
70
+
71
+ #endif
72
+
73
+ typedef union
74
+ {
75
+ int i;
76
+ int f;
77
+ } DCRegCount_x64_u;
78
+
79
+ typedef struct
80
+ {
81
+ int i;
82
+ int f;
83
+ } DCRegCount_x64_s;
84
+
85
+ typedef union
86
+ {
87
+ int64 i[numIntRegs ];
88
+ double f[numFloatRegs];
89
+ } DCRegData_x64_u;
90
+
91
+ typedef struct
92
+ {
93
+ int64 i[numIntRegs ];
94
+ double f[numFloatRegs];
95
+ } DCRegData_x64_s;
96
+
97
+
98
+ typedef struct
99
+ {
100
+ DCCallVM mInterface; /* This CallVM interface. */
101
+ DCpointer mpCallFunc; /* Function to call. */
102
+ DCRegCount_x64 mRegCount; /* Number of int/sse registers used for parameter passing. */
103
+ DCRegData_x64 mRegData; /* Parameters to be passed via registers. */
104
+ DCVecHead mVecHead; /* Parameters to be pushed onto stack. */
105
+ } DCCallVM_x64;
106
+
107
+ DCCallVM* dcNewCallVM_x64(DCsize size);
108
+
109
+
110
+ #endif /* DYNCALL_CALLVM_X64_H */
111
+
@@ -0,0 +1,667 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncall
5
+ File: dyncall/dyncall_callvm_x86.c
6
+ Description: Call VM for x86 architecture implementation
7
+ License:
8
+
9
+ Copyright (c) 2007-2011 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
+ #include "dyncall_callvm_x86.h"
28
+ #include "dyncall_alloc.h"
29
+
30
+
31
+ void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode);
32
+
33
+ /* call vm allocator */
34
+
35
+ static DCCallVM* dc_callvm_new_x86(DCCallVM_vt* vt, DCsize size)
36
+ {
37
+ DCCallVM_x86* self = (DCCallVM_x86*) dcAllocMem( sizeof(DCCallVM_x86)+size );
38
+
39
+ dc_callvm_base_init(&self->mInterface, vt);
40
+
41
+ self->mIntRegs = 0;
42
+ dcVecInit(&self->mVecHead, size);
43
+ return (DCCallVM*) self;
44
+ }
45
+
46
+ /* call vm destructor */
47
+
48
+ static void dc_callvm_free_x86(DCCallVM* in_self)
49
+ {
50
+ dcFreeMem(in_self);
51
+ }
52
+
53
+ /* reset */
54
+
55
+ static void dc_callvm_reset_x86(DCCallVM* in_self)
56
+ {
57
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
58
+ dcVecReset(&self->mVecHead);
59
+ self->mIntRegs = 0;
60
+ }
61
+
62
+ /* arg (bool,char,short,long auto-promoted) to int */
63
+
64
+ static void dc_callvm_argInt_x86(DCCallVM* in_self, DCint x)
65
+ {
66
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
67
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCint) );
68
+ }
69
+
70
+ /* arg bool - promoted to int */
71
+
72
+ static void dc_callvm_argBool_x86(DCCallVM* in_self, DCbool x)
73
+ {
74
+
75
+ DCint v = (DCint) x;
76
+ dc_callvm_argInt_x86(in_self, v);
77
+ }
78
+
79
+ /* arg char - promoted to int */
80
+
81
+ static void dc_callvm_argChar_x86(DCCallVM* in_self, DCchar x)
82
+ {
83
+ DCint v = (DCint) x;
84
+ dc_callvm_argInt_x86(in_self, v);
85
+ }
86
+
87
+ /* arg short - promoted to int */
88
+
89
+ static void dc_callvm_argShort_x86(DCCallVM* in_self, DCshort x)
90
+ {
91
+ DCint v = (DCint) x;
92
+ dc_callvm_argInt_x86(in_self, v);
93
+ }
94
+
95
+ /* arg long - promoted to int */
96
+
97
+ static void dc_callvm_argLong_x86(DCCallVM* in_self, DClong x)
98
+ {
99
+ DCint v = (DCint) x;
100
+ dc_callvm_argInt_x86(in_self, v);
101
+ }
102
+
103
+ /* arg long long */
104
+
105
+ static void dc_callvm_argLongLong_x86(DCCallVM* in_self, DClonglong x)
106
+ {
107
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
108
+ dcVecAppend(&self->mVecHead, &x, sizeof(DClonglong) );
109
+ }
110
+
111
+ /* arg float */
112
+
113
+ static void dc_callvm_argFloat_x86(DCCallVM* in_self, DCfloat x)
114
+ {
115
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
116
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
117
+ }
118
+
119
+ /* arg double */
120
+
121
+ static void dc_callvm_argDouble_x86(DCCallVM* in_self, DCdouble x)
122
+ {
123
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
124
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCdouble) );
125
+ }
126
+
127
+ /* arg pointer */
128
+
129
+ static void dc_callvm_argPointer_x86(DCCallVM* in_self, DCpointer x)
130
+ {
131
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
132
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCpointer) );
133
+ }
134
+
135
+
136
+ /* Plan9 specific calling convention. */
137
+ #if defined(DC__OS_Plan9)
138
+
139
+ /* call 'plan9' */
140
+
141
+ void dc_callvm_call_x86_plan9(DCCallVM* in_self, DCpointer target)
142
+ {
143
+ /* Calls with 32-bit return values have it returned via EAX, so we don't */
144
+ /* need to do anything special here. */
145
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
146
+ dcCall_x86_plan9(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
147
+ }
148
+
149
+ DClonglong dc_callvm_call_x86_plan9_ll(DCCallVM* in_self, DCpointer target)
150
+ {
151
+ /* Call for 64 bit integer return values is a bit different, call a */
152
+ /* different assembler stub that stores the return value in a variable */
153
+ /* for us, and return the latter. */
154
+ DClonglong ret;
155
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
156
+ dcCall_x86_plan9_ll(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead), &ret );
157
+ return ret;
158
+ }
159
+
160
+ DCCallVM_vt gVT_x86_plan9 =
161
+ {
162
+ &dc_callvm_free_x86
163
+ , &dc_callvm_reset_x86
164
+ , &dc_callvm_mode_x86
165
+ , &dc_callvm_argBool_x86
166
+ , &dc_callvm_argChar_x86
167
+ , &dc_callvm_argShort_x86
168
+ , &dc_callvm_argInt_x86
169
+ , &dc_callvm_argLong_x86
170
+ , &dc_callvm_argLongLong_x86
171
+ , &dc_callvm_argFloat_x86
172
+ , &dc_callvm_argDouble_x86
173
+ , &dc_callvm_argPointer_x86
174
+ , NULL /* argStruct */
175
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_plan9
176
+ , (DCboolvmfunc*) &dc_callvm_call_x86_plan9
177
+ , (DCcharvmfunc*) &dc_callvm_call_x86_plan9
178
+ , (DCshortvmfunc*) &dc_callvm_call_x86_plan9
179
+ , (DCintvmfunc*) &dc_callvm_call_x86_plan9
180
+ , (DClongvmfunc*) &dc_callvm_call_x86_plan9
181
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_plan9_ll
182
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_plan9
183
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_plan9
184
+ , (DCpointervmfunc*) &dc_callvm_call_x86_plan9
185
+ , NULL /* callStruct */
186
+ };
187
+
188
+ DCCallVM* dcNewCallVM_x86_plan9(DCsize size)
189
+ {
190
+ return dc_callvm_new_x86( &gVT_x86_plan9, size );
191
+ }
192
+
193
+
194
+ #else
195
+
196
+
197
+ /* call 'cdecl' */
198
+
199
+ void dc_callvm_call_x86_cdecl(DCCallVM* in_self, DCpointer target)
200
+ {
201
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
202
+ dcCall_x86_cdecl( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
203
+ }
204
+
205
+ DCCallVM_vt gVT_x86_cdecl =
206
+ {
207
+ &dc_callvm_free_x86
208
+ , &dc_callvm_reset_x86
209
+ , &dc_callvm_mode_x86
210
+ , &dc_callvm_argBool_x86
211
+ , &dc_callvm_argChar_x86
212
+ , &dc_callvm_argShort_x86
213
+ , &dc_callvm_argInt_x86
214
+ , &dc_callvm_argLong_x86
215
+ , &dc_callvm_argLongLong_x86
216
+ , &dc_callvm_argFloat_x86
217
+ , &dc_callvm_argDouble_x86
218
+ , &dc_callvm_argPointer_x86
219
+ , NULL /* argStruct */
220
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_cdecl
221
+ , (DCboolvmfunc*) &dc_callvm_call_x86_cdecl
222
+ , (DCcharvmfunc*) &dc_callvm_call_x86_cdecl
223
+ , (DCshortvmfunc*) &dc_callvm_call_x86_cdecl
224
+ , (DCintvmfunc*) &dc_callvm_call_x86_cdecl
225
+ , (DClongvmfunc*) &dc_callvm_call_x86_cdecl
226
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_cdecl
227
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_cdecl
228
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_cdecl
229
+ , (DCpointervmfunc*) &dc_callvm_call_x86_cdecl
230
+ , NULL /* callStruct */
231
+ };
232
+
233
+ DCCallVM* dcNewCallVM_x86_cdecl(DCsize size)
234
+ {
235
+ return dc_callvm_new_x86( &gVT_x86_cdecl, size );
236
+ }
237
+
238
+
239
+
240
+ /* --- stdcall -------------------------------------------------------------- */
241
+
242
+ /* call win32/std */
243
+
244
+ void dc_callvm_call_x86_win32_std(DCCallVM* in_self, DCpointer target)
245
+ {
246
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
247
+ dcCall_x86_win32_std( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
248
+ }
249
+
250
+ /* win32/std vtable */
251
+
252
+ DCCallVM_vt gVT_x86_win32_std =
253
+ {
254
+ &dc_callvm_free_x86
255
+ , &dc_callvm_reset_x86
256
+ , &dc_callvm_mode_x86
257
+ , &dc_callvm_argBool_x86
258
+ , &dc_callvm_argChar_x86
259
+ , &dc_callvm_argShort_x86
260
+ , &dc_callvm_argInt_x86
261
+ , &dc_callvm_argLong_x86
262
+ , &dc_callvm_argLongLong_x86
263
+ , &dc_callvm_argFloat_x86
264
+ , &dc_callvm_argDouble_x86
265
+ , &dc_callvm_argPointer_x86
266
+ , NULL /* argStruct */
267
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_win32_std
268
+ , (DCboolvmfunc*) &dc_callvm_call_x86_win32_std
269
+ , (DCcharvmfunc*) &dc_callvm_call_x86_win32_std
270
+ , (DCshortvmfunc*) &dc_callvm_call_x86_win32_std
271
+ , (DCintvmfunc*) &dc_callvm_call_x86_win32_std
272
+ , (DClongvmfunc*) &dc_callvm_call_x86_win32_std
273
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_win32_std
274
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_win32_std
275
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_win32_std
276
+ , (DCpointervmfunc*) &dc_callvm_call_x86_win32_std
277
+ , NULL /* callStruct */
278
+ };
279
+
280
+ /* win32/std callvm allocator */
281
+
282
+ DCCallVM* dcNewCallVM_x86_win32_std(DCsize size)
283
+ {
284
+ return dc_callvm_new_x86( &gVT_x86_win32_std, size );
285
+ }
286
+
287
+ /* --- fastcall common (ms/gnu) -------------------------------------------- */
288
+
289
+ /* call win32 ms fast */
290
+
291
+ static void dc_callvm_call_x86_win32_fast(DCCallVM* in_self, DCpointer target)
292
+ {
293
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
294
+ dcCall_x86_win32_fast( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
295
+ }
296
+
297
+ /* reset - always resize to 8 bytes (stores ECX and EDX) */
298
+
299
+ static void dc_callvm_reset_x86_win32_fast(DCCallVM* in_self)
300
+ {
301
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
302
+ dcVecResize(&self->mVecHead, sizeof(DCint) * 2 );
303
+ self->mIntRegs = 0;
304
+ }
305
+
306
+
307
+ /* --- fastcall ms --------------------------------------------------------- */
308
+
309
+ /* arg int - probably hold in ECX and EDX */
310
+
311
+ static void dc_callvm_argInt_x86_win32_fast_ms(DCCallVM* in_self, DCint x)
312
+ {
313
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
314
+ if (self->mIntRegs < 2) {
315
+ *( (int*) dcVecAt(&self->mVecHead, sizeof(DCint) * self->mIntRegs ) ) = x;
316
+ ++( self->mIntRegs );
317
+ } else
318
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCint) );
319
+ }
320
+
321
+ /* arg bool - promote to int */
322
+
323
+ static void dc_callvm_argBool_x86_win32_fast_ms(DCCallVM* in_self, DCbool x)
324
+ {
325
+ DCint v = (DCint) x;
326
+ dc_callvm_argInt_x86_win32_fast_ms(in_self,v);
327
+ }
328
+
329
+ /* arg char - promote to int */
330
+
331
+ static void dc_callvm_argChar_x86_win32_fast_ms(DCCallVM* in_self, DCchar x)
332
+ {
333
+ DCint v = (DCint) x;
334
+ dc_callvm_argInt_x86_win32_fast_ms(in_self,v);
335
+ }
336
+
337
+ /* arg short - promote to int */
338
+
339
+ static void dc_callvm_argShort_x86_win32_fast_ms(DCCallVM* in_self, DCshort x)
340
+ {
341
+ DCint v = (DCint) x;
342
+ dc_callvm_argInt_x86_win32_fast_ms(in_self,v);
343
+ }
344
+
345
+ /* arg long - promote to int */
346
+
347
+ static void dc_callvm_argLong_x86_win32_fast_ms(DCCallVM* in_self, DClong x)
348
+ {
349
+ DCint v = (DCint) x;
350
+ dc_callvm_argInt_x86_win32_fast_ms(in_self,v);
351
+ }
352
+
353
+ /* arg pointer - promote to int */
354
+
355
+ static void dc_callvm_argPointer_x86_win32_fast_ms(DCCallVM* in_self, DCpointer x)
356
+ {
357
+ DCint v = (DCint) x;
358
+ dc_callvm_argInt_x86_win32_fast_ms(in_self,v);
359
+ }
360
+
361
+ /* win32/fast vt */
362
+
363
+ DCCallVM_vt gVT_x86_win32_fast_ms =
364
+ {
365
+ &dc_callvm_free_x86
366
+ , &dc_callvm_reset_x86_win32_fast
367
+ , &dc_callvm_mode_x86
368
+ , &dc_callvm_argBool_x86_win32_fast_ms
369
+ , &dc_callvm_argChar_x86_win32_fast_ms
370
+ , &dc_callvm_argShort_x86_win32_fast_ms
371
+ , &dc_callvm_argInt_x86_win32_fast_ms
372
+ , &dc_callvm_argLong_x86_win32_fast_ms
373
+ , &dc_callvm_argLongLong_x86
374
+ , &dc_callvm_argFloat_x86
375
+ , &dc_callvm_argDouble_x86
376
+ , &dc_callvm_argPointer_x86_win32_fast_ms
377
+ , NULL /* argStruct */
378
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_win32_fast
379
+ , (DCboolvmfunc*) &dc_callvm_call_x86_win32_fast
380
+ , (DCcharvmfunc*) &dc_callvm_call_x86_win32_fast
381
+ , (DCshortvmfunc*) &dc_callvm_call_x86_win32_fast
382
+ , (DCintvmfunc*) &dc_callvm_call_x86_win32_fast
383
+ , (DClongvmfunc*) &dc_callvm_call_x86_win32_fast
384
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_win32_fast
385
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_win32_fast
386
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_win32_fast
387
+ , (DCpointervmfunc*) &dc_callvm_call_x86_win32_fast
388
+ , NULL /* callStruct */
389
+ };
390
+
391
+ DCCallVM* dcNewCallVM_x86_win32_fast_ms(DCsize size)
392
+ {
393
+ return dc_callvm_new_x86( &gVT_x86_win32_fast_ms, size );
394
+ }
395
+
396
+ /* --- gnu fastcall -------------------------------------------------------- */
397
+
398
+ /* arg int - probably hold in ECX and EDX */
399
+
400
+ static void dc_callvm_argInt_x86_win32_fast_gnu(DCCallVM* in_self, DCint x)
401
+ {
402
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
403
+ if (self->mIntRegs < 2) {
404
+ *( (int*) dcVecAt(&self->mVecHead, sizeof(DCint) * self->mIntRegs ) ) = x;
405
+ ++( self->mIntRegs );
406
+ } else
407
+ dcVecAppend(&self->mVecHead, &x, sizeof(DCint) );
408
+ }
409
+
410
+ /* arg bool - promote to int */
411
+
412
+ static void dc_callvm_argBool_x86_win32_fast_gnu(DCCallVM* in_self, DCbool x)
413
+ {
414
+ DCint v = (DCint) x;
415
+ dc_callvm_argInt_x86_win32_fast_gnu(in_self,v);
416
+ }
417
+
418
+ /* arg char - promote to int */
419
+
420
+ static void dc_callvm_argChar_x86_win32_fast_gnu(DCCallVM* in_self, DCchar x)
421
+ {
422
+ DCint v = (DCint) x;
423
+ dc_callvm_argInt_x86_win32_fast_gnu(in_self,v);
424
+ }
425
+
426
+ /* arg short - promote to int */
427
+
428
+ static void dc_callvm_argShort_x86_win32_fast_gnu(DCCallVM* in_self, DCshort x)
429
+ {
430
+ DCint v = (DCint) x;
431
+ dc_callvm_argInt_x86_win32_fast_gnu(in_self,v);
432
+ }
433
+
434
+ /* arg long - promote to int */
435
+
436
+ static void dc_callvm_argLong_x86_win32_fast_gnu(DCCallVM* in_self, DClong x)
437
+ {
438
+ DCint v = (DCint) x;
439
+ dc_callvm_argInt_x86_win32_fast_gnu(in_self,v);
440
+ }
441
+
442
+ /* arg pointer - promote to int */
443
+
444
+ static void dc_callvm_argPointer_x86_win32_fast_gnu(DCCallVM* in_self, DCpointer x)
445
+ {
446
+ DCint v = (DCint) x;
447
+ dc_callvm_argInt_x86_win32_fast_gnu(in_self,v);
448
+ }
449
+
450
+ /* arg long long - skip registers and push on stack */
451
+
452
+ static void dc_callvm_argLongLong_x86_win32_fast_gnu(DCCallVM* in_self, DClonglong x)
453
+ {
454
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
455
+ self->mIntRegs = 2;
456
+ dc_callvm_argLongLong_x86(in_self,x);
457
+ }
458
+
459
+ /* win32/fast/gnu vt */
460
+
461
+ DCCallVM_vt gVT_x86_win32_fast_gnu =
462
+ {
463
+ &dc_callvm_free_x86
464
+ , &dc_callvm_reset_x86_win32_fast
465
+ , &dc_callvm_mode_x86
466
+ , &dc_callvm_argBool_x86_win32_fast_gnu
467
+ , &dc_callvm_argChar_x86_win32_fast_gnu
468
+ , &dc_callvm_argShort_x86_win32_fast_gnu
469
+ , &dc_callvm_argInt_x86_win32_fast_gnu
470
+ , &dc_callvm_argLong_x86_win32_fast_gnu
471
+ , &dc_callvm_argLongLong_x86_win32_fast_gnu
472
+ , &dc_callvm_argFloat_x86
473
+ , &dc_callvm_argDouble_x86
474
+ , &dc_callvm_argPointer_x86_win32_fast_gnu
475
+ , NULL /* argStruct */
476
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_win32_fast
477
+ , (DCboolvmfunc*) &dc_callvm_call_x86_win32_fast
478
+ , (DCcharvmfunc*) &dc_callvm_call_x86_win32_fast
479
+ , (DCshortvmfunc*) &dc_callvm_call_x86_win32_fast
480
+ , (DCintvmfunc*) &dc_callvm_call_x86_win32_fast
481
+ , (DClongvmfunc*) &dc_callvm_call_x86_win32_fast
482
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_win32_fast
483
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_win32_fast
484
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_win32_fast
485
+ , (DCpointervmfunc*) &dc_callvm_call_x86_win32_fast
486
+ , NULL /* callStruct */
487
+ };
488
+
489
+ DCCallVM* dcNewCallVM_x86_win32_fast_gnu(DCsize size)
490
+ {
491
+ return dc_callvm_new_x86( &gVT_x86_win32_fast_gnu, size );
492
+ }
493
+
494
+ /* --- this ms ------------------------------------------------------------- */
495
+
496
+ /* call win32/this/ms */
497
+
498
+ void dc_callvm_call_x86_win32_this_ms(DCCallVM* in_self, DCpointer target)
499
+ {
500
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
501
+ dcCall_x86_win32_msthis( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
502
+ }
503
+
504
+ /* win32/this/ms vt */
505
+
506
+ DCCallVM_vt gVT_x86_win32_this_ms =
507
+ {
508
+ &dc_callvm_free_x86
509
+ , &dc_callvm_reset_x86
510
+ , &dc_callvm_mode_x86
511
+ , &dc_callvm_argBool_x86
512
+ , &dc_callvm_argChar_x86
513
+ , &dc_callvm_argShort_x86
514
+ , &dc_callvm_argInt_x86
515
+ , &dc_callvm_argLong_x86
516
+ , &dc_callvm_argLongLong_x86
517
+ , &dc_callvm_argFloat_x86
518
+ , &dc_callvm_argDouble_x86
519
+ , &dc_callvm_argPointer_x86
520
+ , NULL /* argStruct */
521
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_win32_this_ms
522
+ , (DCboolvmfunc*) &dc_callvm_call_x86_win32_this_ms
523
+ , (DCcharvmfunc*) &dc_callvm_call_x86_win32_this_ms
524
+ , (DCshortvmfunc*) &dc_callvm_call_x86_win32_this_ms
525
+ , (DCintvmfunc*) &dc_callvm_call_x86_win32_this_ms
526
+ , (DClongvmfunc*) &dc_callvm_call_x86_win32_this_ms
527
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_win32_this_ms
528
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_win32_this_ms
529
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_win32_this_ms
530
+ , (DCpointervmfunc*) &dc_callvm_call_x86_win32_this_ms
531
+ , NULL /* callStruct */
532
+ };
533
+
534
+ /* --- syscall ------------------------------------------------------------- */
535
+
536
+ /* call syscall */
537
+
538
+ void dc_callvm_call_x86_sys_int80h_linux(DCCallVM* in_self, DCpointer target)
539
+ {
540
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
541
+ dcCall_x86_sys_int80h_linux( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
542
+ }
543
+
544
+ void dc_callvm_call_x86_sys_int80h_bsd(DCCallVM* in_self, DCpointer target)
545
+ {
546
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
547
+ dcCall_x86_sys_int80h_bsd( target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead) );
548
+ }
549
+
550
+ DCCallVM_vt gVT_x86_sys_int80h_linux =
551
+ {
552
+ &dc_callvm_free_x86
553
+ , &dc_callvm_reset_x86
554
+ , &dc_callvm_mode_x86
555
+ , &dc_callvm_argBool_x86
556
+ , &dc_callvm_argChar_x86
557
+ , &dc_callvm_argShort_x86
558
+ , &dc_callvm_argInt_x86
559
+ , &dc_callvm_argLong_x86
560
+ , &dc_callvm_argLongLong_x86
561
+ , &dc_callvm_argFloat_x86
562
+ , &dc_callvm_argDouble_x86
563
+ , &dc_callvm_argPointer_x86
564
+ , NULL /* argStruct */
565
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
566
+ , (DCboolvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
567
+ , (DCcharvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
568
+ , (DCshortvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
569
+ , (DCintvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
570
+ , (DClongvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
571
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
572
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_sys_int80h_linux
573
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_sys_int80h_linux
574
+ , (DCpointervmfunc*) &dc_callvm_call_x86_sys_int80h_linux
575
+ , NULL /* callStruct */
576
+ };
577
+
578
+ DCCallVM_vt gVT_x86_sys_int80h_bsd =
579
+ {
580
+ &dc_callvm_free_x86
581
+ , &dc_callvm_reset_x86
582
+ , &dc_callvm_mode_x86
583
+ , &dc_callvm_argBool_x86
584
+ , &dc_callvm_argChar_x86
585
+ , &dc_callvm_argShort_x86
586
+ , &dc_callvm_argInt_x86
587
+ , &dc_callvm_argLong_x86
588
+ , &dc_callvm_argLongLong_x86
589
+ , &dc_callvm_argFloat_x86
590
+ , &dc_callvm_argDouble_x86
591
+ , &dc_callvm_argPointer_x86
592
+ , NULL /* argStruct */
593
+ , (DCvoidvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
594
+ , (DCboolvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
595
+ , (DCcharvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
596
+ , (DCshortvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
597
+ , (DCintvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
598
+ , (DClongvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
599
+ , (DClonglongvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
600
+ , (DCfloatvmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
601
+ , (DCdoublevmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
602
+ , (DCpointervmfunc*) &dc_callvm_call_x86_sys_int80h_bsd
603
+ , NULL /* callStruct */
604
+ };
605
+
606
+
607
+ /* win32/this/ms callvm allocator */
608
+
609
+ DCCallVM* dcNewCallVM_x86_win32_this_ms(DCsize size)
610
+ {
611
+ return dc_callvm_new_x86( &gVT_x86_win32_this_ms, size );
612
+ }
613
+
614
+ #endif
615
+
616
+
617
+ /* mode */
618
+
619
+ void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode)
620
+ {
621
+ DCCallVM_x86* self = (DCCallVM_x86*) in_self;
622
+ DCCallVM_vt* vt;
623
+ switch(mode) {
624
+ case DC_CALL_C_ELLIPSIS:
625
+ case DC_CALL_C_ELLIPSIS_VARARGS:
626
+ case DC_CALL_C_DEFAULT:
627
+ #if defined(DC_PLAN9) /* Plan9 (and forks) have their own calling convention (and no support for foreign ones). */
628
+ case DC_CALL_C_X86_PLAN9: vt = &gVT_x86_plan9; break;
629
+ #else
630
+ case DC_CALL_C_X86_CDECL: vt = &gVT_x86_cdecl; break;
631
+ case DC_CALL_C_X86_WIN32_STD: vt = &gVT_x86_win32_std; break;
632
+ case DC_CALL_C_X86_WIN32_FAST_MS: vt = &gVT_x86_win32_fast_ms; break;
633
+ case DC_CALL_C_X86_WIN32_THIS_MS: vt = &gVT_x86_win32_this_ms; break;
634
+ case DC_CALL_C_X86_WIN32_FAST_GNU: vt = &gVT_x86_win32_fast_gnu; break;
635
+ case DC_CALL_C_X86_WIN32_THIS_GNU: vt = &gVT_x86_cdecl; break;
636
+ case DC_CALL_SYS_DEFAULT:
637
+ # if defined DC_UNIX
638
+ # if defined DC__OS_Linux
639
+ vt = &gVT_x86_sys_int80h_linux; break;
640
+ # else
641
+ vt = &gVT_x86_sys_int80h_bsd; break;
642
+ # endif
643
+ # else
644
+ self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return;
645
+ # endif
646
+ case DC_CALL_SYS_X86_INT80H_LINUX:
647
+ vt = &gVT_x86_sys_int80h_linux; break;
648
+ case DC_CALL_SYS_X86_INT80H_BSD:
649
+ vt = &gVT_x86_sys_int80h_bsd; break;
650
+ #endif
651
+ default:
652
+ self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE; return;
653
+ }
654
+ self->mInterface.mVTpointer = vt;
655
+ }
656
+
657
+ /* new */
658
+
659
+ DCCallVM* dcNewCallVM(DCsize size)
660
+ {
661
+ #if defined(DC__OS_Plan9)
662
+ return dcNewCallVM_x86_plan9(size);
663
+ #else
664
+ return dcNewCallVM_x86_cdecl(size);
665
+ #endif
666
+ }
667
+