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
@@ -2,11 +2,12 @@
2
2
 
3
3
  Package: dyncall
4
4
  Library: dyncall
5
- File: dyncall/dyncall_call_sparc_v9.h
6
- Description:
5
+ File: dyncall/dyncall_callvm_mips_n32.h
6
+ Description: mips64 "n32" ABI callvm C interface.
7
7
  License:
8
8
 
9
- Copyright (c) 2011-2015 Daniel Adler <dadler@uni-goettingen.de>
9
+ Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
10
+ Tassilo Philipp <tphilipp@potion-studios.com>
10
11
 
11
12
  Permission to use, copy, modify, and distribute this software for any
12
13
  purpose with or without fee is hereby granted, provided that the above
@@ -24,20 +25,29 @@
24
25
 
25
26
 
26
27
 
27
- #ifndef DYNCALL_CALL_SPARC_V9_H
28
- #define DYNCALL_CALL_SPARC_V9_H
28
+ #ifndef DYNCALL_CALLVM_MIPS_N32_H
29
+ #define DYNCALL_CALLVM_MIPS_N32_H
29
30
 
30
- #include "dyncall_types.h"
31
+ #include "dyncall_call_mips_n32.h"
32
+ #include "dyncall_callvm.h"
33
+ #include "dyncall_vector.h"
31
34
 
32
35
  #ifdef __cplusplus
33
36
  extern "C" {
34
37
  #endif
35
38
 
36
- void dcCall_v9 (DCCallVM* vm, DCpointer target);
39
+ typedef struct
40
+ {
41
+ DCCallVM mInterface;
42
+ DCint mRegCount;
43
+ struct DCRegData_mips_n32 mRegData;
44
+ DCVecHead mVecHead;
45
+ } DCCallVM_mips_n32;
46
+ /* @@@ this is the same as n64, combine code */
37
47
 
38
48
  #ifdef __cplusplus
39
49
  }
40
50
  #endif
41
51
 
42
- #endif /* DYNCALL_CALL_SPARC_v9_H */
52
+ #endif /* DYNCALL_CALLVM_MIPS_N32_H */
43
53
 
@@ -6,7 +6,7 @@
6
6
  Description: mips "n64" ABI callvm 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
@@ -61,15 +61,6 @@ static void dc_callvm_reset_mips_n64(DCCallVM* in_self)
61
61
  self->mRegData.mUseDouble = 0LL;
62
62
  }
63
63
 
64
- static DCCallVM* dc_callvm_new_mips_n64(DCCallVM_vt* vt, DCsize size)
65
- {
66
- DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)dcAllocMem(sizeof(DCCallVM_mips_n64)+size);
67
- dc_callvm_base_init(&self->mInterface, vt);
68
- dcVecInit(&self->mVecHead, size);
69
- dc_callvm_reset_mips_n64( (DCCallVM*) self );
70
- return (DCCallVM*)self;
71
- }
72
-
73
64
 
74
65
  static void dc_callvm_free_mips_n64(DCCallVM* in_self)
75
66
  {
@@ -148,7 +139,7 @@ static void dc_callvm_argFloat_mips_n64(DCCallVM* in_self, DCfloat x)
148
139
  }
149
140
 
150
141
 
151
- /* Ellipsis calls:
142
+ /* Ellipsis calls:
152
143
  - float is promoted to double (due to ANSI C).
153
144
  - double is passed via integer register-file (due to MIPS ABI).
154
145
  */
@@ -170,14 +161,13 @@ void dc_callvm_call_mips_n64(DCCallVM* in_self, DCpointer target)
170
161
  {
171
162
  DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
172
163
  /* at minimum provide 16-bytes
173
- which hold the first four integer register as spill area
164
+ which hold the first four integer register as spill area
174
165
  and are automatically loaded to $4-$7
175
166
  */
176
167
  size_t size = DC_MAX(16, ( ( (unsigned) dcVecSize(&self->mVecHead) ) +7UL ) & (-8UL) );
177
168
  dcCall_mips_n64(target, &self->mRegData, size, dcVecData(&self->mVecHead));
178
169
  }
179
170
 
180
- /* Forward Declaration. */
181
171
  static void dc_callvm_mode_mips_n64(DCCallVM* in_self,DCint mode);
182
172
 
183
173
  DCCallVM_vt gVT_mips_n64 =
@@ -187,7 +177,7 @@ DCCallVM_vt gVT_mips_n64 =
187
177
  , &dc_callvm_mode_mips_n64
188
178
  , &dc_callvm_argBool_mips_n64
189
179
  , &dc_callvm_argChar_mips_n64
190
- , &dc_callvm_argShort_mips_n64
180
+ , &dc_callvm_argShort_mips_n64
191
181
  , &dc_callvm_argInt_mips_n64
192
182
  , &dc_callvm_argLong_mips_n64
193
183
  , &dc_callvm_argLongLong_mips_n64
@@ -236,34 +226,37 @@ DCCallVM_vt gVT_mips_n64_ellipsis =
236
226
  , NULL /* callStruct */
237
227
  };
238
228
 
239
- static void dc_callvm_mode_mips_n64(DCCallVM* self,DCint mode)
229
+ static void dc_callvm_mode_mips_n64(DCCallVM* in_self, DCint mode)
240
230
  {
231
+ DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self;
232
+ DCCallVM_vt* vt;
233
+
241
234
  switch(mode) {
242
235
  case DC_CALL_C_DEFAULT:
243
- self->mVTpointer = &gVT_mips_n64;
244
- break;
236
+ case DC_CALL_C_MIPS64_N64:
245
237
  case DC_CALL_C_ELLIPSIS:
246
- self->mVTpointer = &gVT_mips_n64_ellipsis;
238
+ vt = &gVT_mips_n64;
247
239
  break;
248
- default:
249
- self->mError = DC_ERROR_UNSUPPORTED_MODE;
240
+ case DC_CALL_C_ELLIPSIS_VARARGS:
241
+ vt = &gVT_mips_n64_ellipsis;
250
242
  break;
243
+ default:
244
+ self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
245
+ return;
251
246
  }
247
+ dc_callvm_base_init(&self->mInterface, vt);
252
248
  }
253
249
 
254
- DCCallVM* dcNewCallVM_mips_n64(DCsize size)
250
+ /* Public API. */
251
+ DCCallVM* dcNewCallVM(DCsize size)
255
252
  {
256
- return dc_callvm_new_mips_n64(&gVT_mips_n64, size);
257
- }
253
+ DCCallVM_mips_n64* p = (DCCallVM_mips_n64*)dcAllocMem(sizeof(DCCallVM_mips_n64)+size);
258
254
 
259
- DCCallVM* dcNewCallVM_mips_n64_ellipsis(DCsize size)
260
- {
261
- return dc_callvm_new_mips_n64(&gVT_mips_n64_ellipsis, size);
262
- }
255
+ dc_callvm_mode_mips_n64((DCCallVM*)p, DC_CALL_C_DEFAULT);
263
256
 
257
+ dcVecInit(&p->mVecHead, size);
258
+ dc_callvm_reset_mips_n64((DCCallVM*)p);
264
259
 
265
- DCCallVM* dcNewCallVM(DCsize size)
266
- {
267
- return dcNewCallVM_mips_n64(size);
260
+ return (DCCallVM*)p;
268
261
  }
269
262
 
@@ -6,7 +6,7 @@
6
6
  Description: mips "n64" ABI callvm C interface.
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
@@ -38,14 +38,12 @@ extern "C" {
38
38
 
39
39
  typedef struct
40
40
  {
41
- DCCallVM mInterface;
42
- int mRegCount;
41
+ DCCallVM mInterface;
42
+ DCint mRegCount;
43
43
  struct DCRegData_mips_n64 mRegData;
44
- DCVecHead mVecHead;
44
+ DCVecHead mVecHead;
45
45
  } DCCallVM_mips_n64;
46
46
 
47
- DCCallVM* dcNewCallVM_mips_n64(DCsize size);
48
-
49
47
  #ifdef __cplusplus
50
48
  }
51
49
  #endif
@@ -6,7 +6,7 @@
6
6
  Description: mips "o32" ABI callvm 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
@@ -60,34 +60,12 @@ static void dc_callvm_reset_mips_o32(DCCallVM* in_self)
60
60
  self->mArgCount = 0;
61
61
  }
62
62
 
63
- static DCCallVM* dc_callvm_new_mips_o32(DCCallVM_vt* vt, DCsize size)
64
- {
65
- DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)dcAllocMem(sizeof(DCCallVM_mips_o32)+size);
66
- dc_callvm_base_init(&self->mInterface, vt);
67
- dcVecInit(&self->mVecHead, size);
68
- dc_callvm_reset_mips_o32( (DCCallVM*) self );
69
- return (DCCallVM*)self;
70
- }
71
-
72
63
 
73
64
  static void dc_callvm_free_mips_o32(DCCallVM* in_self)
74
65
  {
75
66
  dcFreeMem(in_self);
76
67
  }
77
68
 
78
- static void dc_callvm_mode_mips_o32(DCCallVM* self, DCint mode)
79
- {
80
- switch(mode) {
81
- case DC_CALL_C_DEFAULT:
82
- case DC_CALL_C_ELLIPSIS:
83
- case DC_CALL_C_MIPS32_O32:
84
- break;
85
- default:
86
- self->mError = DC_ERROR_UNSUPPORTED_MODE;
87
- break;
88
- }
89
- }
90
-
91
69
  /* arg int -- fillup integer register file OR push on stack */
92
70
 
93
71
  static void dc_callvm_argInt_mips_o32(DCCallVM* in_self, DCint i)
@@ -138,7 +116,7 @@ static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
138
116
 
139
117
  dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) );
140
118
  if (self->mArgCount < 2) {
141
- #if defined(__MIPSEL__)
119
+ #if defined(DC__Endian_LITTLE)
142
120
  self->mRegData.u[self->mArgCount].f[0] = x;
143
121
  #else
144
122
  self->mRegData.u[self->mArgCount].f[1] = x;
@@ -158,7 +136,7 @@ static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x)
158
136
  lwc1 $f14, 8($5) <--- byte offset 12
159
137
  lwc1 $f15, 12($5)
160
138
 
161
- #if defined(__MIPSEL__)
139
+ #if defined(DC__Endian_LITTLE)
162
140
  /* index 0 and 2 */
163
141
  self->mRegData.floats[self->mArgCount*2] = x;
164
142
  #else
@@ -195,6 +173,8 @@ void dc_callvm_call_mips_o32(DCCallVM* in_self, DCpointer target)
195
173
  dcCall_mips_o32(target, &self->mRegData, size, dcVecData(&self->mVecHead));
196
174
  }
197
175
 
176
+ static void dc_callvm_mode_mips_o32(DCCallVM* in_self, DCint mode);
177
+
198
178
  DCCallVM_vt gVT_mips_o32 =
199
179
  {
200
180
  &dc_callvm_free_mips_o32
@@ -223,14 +203,36 @@ DCCallVM_vt gVT_mips_o32 =
223
203
  , NULL /* callStruct */
224
204
  };
225
205
 
226
- DCCallVM* dcNewCallVM_mips_o32(DCsize size)
206
+ /* mode: only a single mode available currently. */
207
+ static void dc_callvm_mode_mips_o32(DCCallVM* in_self, DCint mode)
227
208
  {
228
- return dc_callvm_new_mips_o32(&gVT_mips_o32, size);
229
- }
209
+ DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self;
210
+ DCCallVM_vt* vt;
230
211
 
212
+ switch(mode) {
213
+ case DC_CALL_C_DEFAULT:
214
+ case DC_CALL_C_MIPS32_O32:
215
+ case DC_CALL_C_ELLIPSIS:
216
+ case DC_CALL_C_ELLIPSIS_VARARGS:
217
+ vt = &gVT_mips_o32;
218
+ break;
219
+ default:
220
+ self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
221
+ return;
222
+ }
223
+ dc_callvm_base_init(&self->mInterface, vt);
224
+ }
231
225
 
226
+ /* Public API. */
232
227
  DCCallVM* dcNewCallVM(DCsize size)
233
228
  {
234
- return dcNewCallVM_mips_o32(size);
229
+ DCCallVM_mips_o32* p = (DCCallVM_mips_o32*)dcAllocMem(sizeof(DCCallVM_mips_o32)+size);
230
+
231
+ dc_callvm_mode_mips_o32((DCCallVM*)p, DC_CALL_C_DEFAULT);
232
+
233
+ dcVecInit(&p->mVecHead, size);
234
+ dc_callvm_reset_mips_o32((DCCallVM*)p);
235
+
236
+ return (DCCallVM*)p;
235
237
  }
236
238
 
@@ -6,7 +6,7 @@
6
6
  Description: mips "o32" ABI callvm C interface.
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
@@ -40,7 +40,5 @@ typedef struct
40
40
  DCVecHead mVecHead;
41
41
  } DCCallVM_mips_o32;
42
42
 
43
- DCCallVM* dcNewCallVM_mips_o32(DCsize size);
44
-
45
43
  #endif /* DYNCALL_CALLVM_MIPS_O32_H */
46
44
 
@@ -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
@@ -50,12 +50,14 @@
50
50
 
51
51
  /* Support for Mac OS X (Darwin) and Systen V ABI for Power PC 32-bit */
52
52
 
53
- #if defined(DC__OS_Darwin)
54
- #define DC__ABI_Darwin
55
- #elif defined(DC__OS_Linux) || defined(DC__OS_FreeBSD) || defined(DC__OS_OpenBSD) || defined(DC__OS_NetBSD) || defined(DC__OS_DragonFlyBSD) || defined(DC__OS_SunOS)
56
- #define DC__ABI_SysV
53
+ #if defined(DC_UNIX)
54
+ # if defined(DC__OS_Darwin)
55
+ # define DC__ABI_Darwin
56
+ # else
57
+ # define DC__ABI_SysV
58
+ # endif
57
59
  #else
58
- #error Unsupported OS for ppc32 architecture.
60
+ # error Unsupported OS for ppc32 architecture.
59
61
  #endif
60
62
 
61
63
  static void dc_callvm_free_ppc32(DCCallVM* in_self)
@@ -364,29 +366,26 @@ DCCallVM_vt gVT_ppc32_syscall =
364
366
 
365
367
  void dc_callvm_mode_ppc32(DCCallVM* in_self, DCint mode)
366
368
  {
367
- DCCallVM_ppc32* self = (DCCallVM_ppc32*) in_self;
369
+ DCCallVM_ppc32* self = (DCCallVM_ppc32*)in_self;
368
370
  DCCallVM_vt* vt;
369
- switch(mode) {
370
371
 
371
- case DC_CALL_C_PPC32_OSX:
372
+ switch(mode) {
372
373
 
373
374
  #if defined(DC__ABI_Darwin)
374
375
  case DC_CALL_C_DEFAULT:
375
376
  case DC_CALL_C_ELLIPSIS:
376
377
  case DC_CALL_C_ELLIPSIS_VARARGS:
377
378
  #endif
378
-
379
+ case DC_CALL_C_PPC32_OSX:
379
380
  vt = &gVT_ppc32_darwin;
380
381
  break;
381
382
 
382
- case DC_CALL_C_PPC32_SYSV:
383
-
384
383
  #if defined(DC__ABI_SysV)
385
384
  case DC_CALL_C_DEFAULT:
386
385
  case DC_CALL_C_ELLIPSIS:
387
386
  case DC_CALL_C_ELLIPSIS_VARARGS:
388
387
  #endif
389
-
388
+ case DC_CALL_C_PPC32_SYSV:
390
389
  vt = &gVT_ppc32_sysv;
391
390
  break;
392
391
 
@@ -399,17 +398,20 @@ void dc_callvm_mode_ppc32(DCCallVM* in_self, DCint mode)
399
398
  self->mInterface.mError = DC_ERROR_UNSUPPORTED_MODE;
400
399
  return;
401
400
  }
402
-
401
+
403
402
  dc_callvm_base_init(&self->mInterface, vt);
404
403
  }
405
404
 
405
+ /* Public API. */
406
406
  DCCallVM* dcNewCallVM(DCsize size)
407
407
  {
408
- DCCallVM_ppc32* self = (DCCallVM_ppc32*)dcAllocMem(sizeof(DCCallVM_ppc32)+size);
409
- dcVecInit(&self->mVecHead, size);
410
- self->mIntRegs = 0;
411
- self->mFloatRegs = 0;
412
- dc_callvm_mode_ppc32( (DCCallVM*) self, DC_CALL_C_DEFAULT );
413
- return (DCCallVM*)self;
408
+ DCCallVM_ppc32* p = (DCCallVM_ppc32*)dcAllocMem(sizeof(DCCallVM_ppc32)+size);
409
+
410
+ dc_callvm_mode_ppc32((DCCallVM*)p, DC_CALL_C_DEFAULT);
411
+
412
+ dcVecInit(&p->mVecHead, size);
413
+ dc_callvm_reset_ppc32((DCCallVM*)p);
414
+
415
+ return (DCCallVM*)p;
414
416
  }
415
417
 
@@ -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
@@ -56,7 +56,5 @@ struct DCCallVM_ppc32_
56
56
  DCVecHead mVecHead;
57
57
  };
58
58
 
59
- DCCallVM* dcNewCallVM_ppc32(DCsize size);
60
-
61
59
  #endif /* DYNCALL_CALLVM_PPC32_H */
62
60
 
@@ -74,7 +74,7 @@ static void dc_callvm_argDouble_ppc64(DCCallVM* in_self, DCdouble d)
74
74
  {
75
75
  DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
76
76
 
77
- if (self->mFloatRegs < 13) {
77
+ if (self->mFloatRegs < 13) {
78
78
  self->mRegData.mFloatData[self->mFloatRegs++] = d;
79
79
  if (self->mIntRegs < 8) {
80
80
  self->mRegData.mIntData[self->mIntRegs++] = *( (DClonglong*) &d );
@@ -82,7 +82,7 @@ static void dc_callvm_argDouble_ppc64(DCCallVM* in_self, DCdouble d)
82
82
  return;
83
83
  #endif
84
84
  }
85
- }
85
+ }
86
86
 
87
87
  #if DC__ABI_PPC64_ELF_V == 2
88
88
  if (dcVecSize(&self->mVecHead) == 0) {
@@ -99,10 +99,10 @@ static void dc_callvm_argDouble_ppc64_ellipsis(DCCallVM* in_self, DCdouble d)
99
99
  {
100
100
  DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
101
101
 
102
- if (dcVecSize(&self->mVecHead) == 0)
102
+ if (dcVecSize(&self->mVecHead) == 0)
103
103
  dcVecSkip(&self->mVecHead,(sizeof(DClonglong))*(self->mIntRegs));
104
104
 
105
- if (self->mFloatRegs < 13) {
105
+ if (self->mFloatRegs < 13) {
106
106
  self->mRegData.mFloatData[self->mFloatRegs++] = d;
107
107
  if (self->mIntRegs < 8) {
108
108
  self->mRegData.mIntData[self->mIntRegs++] = *( (DClonglong*) &d );
@@ -116,19 +116,55 @@ static void dc_callvm_argDouble_ppc64_ellipsis(DCCallVM* in_self, DCdouble d)
116
116
 
117
117
 
118
118
  /* Floating-point */
119
-
119
+
120
120
  static void dc_callvm_argFloat_ppc64(DCCallVM* in_self, DCfloat f)
121
+ {
122
+ DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
123
+
124
+ DCdouble d;
125
+ #if defined(DC__Endian_BIG)
126
+ struct { DCfloat f_pad; DCfloat f; } sf;
127
+ #else /* Endian_LITTLE */
128
+ struct { DCfloat f; DCfloat f_pad; } sf;
129
+ #endif
130
+
131
+ if (self->mFloatRegs < 13) {
132
+ d = (DCdouble)f;
133
+ self->mRegData.mFloatData[self->mFloatRegs++] = d;
134
+ if (self->mIntRegs < 8) {
135
+ self->mRegData.mIntData[self->mIntRegs++] = *( (DClonglong*) &d );
136
+ #if DC__ABI_PPC64_ELF_V == 2
137
+ return;
138
+ #endif
139
+ }
140
+ }
141
+
142
+ #if DC__ABI_PPC64_ELF_V == 2
143
+ if (dcVecSize(&self->mVecHead) == 0) {
144
+ dcVecSkip(&self->mVecHead,sizeof(DClonglong)*8);
145
+ }
146
+ #endif
147
+
148
+ /* push on stack */
149
+ sf.f = f;
150
+ dcVecAppend(&self->mVecHead,(DCpointer) &sf,sizeof(DCdouble));
151
+ }
152
+
153
+ #if DC__ABI_PPC64_ELF_V == 2
154
+ static void dc_callvm_argFloat_ppc64_ellipsis(DCCallVM* in_self, DCfloat f)
121
155
  {
122
156
  /* promote to double */
123
157
  dcArgDouble(in_self, (DCdouble) f );
124
158
  }
159
+ #endif
160
+
125
161
 
126
162
  /* long long integer */
127
163
 
128
164
  static void dc_callvm_argLongLong_ppc64(DCCallVM* in_self, DClonglong L)
129
165
  {
130
166
  DCCallVM_ppc64* self = (DCCallVM_ppc64*)in_self;
131
-
167
+
132
168
  /* fillup integer register file */
133
169
  if (self->mIntRegs < 8) {
134
170
  self->mRegData.mIntData[self->mIntRegs++] = L;
@@ -259,7 +295,7 @@ DCCallVM_vt gVT_ppc64_ellipsis =
259
295
  , &dc_callvm_argInt_ppc64
260
296
  , &dc_callvm_argLong_ppc64
261
297
  , &dc_callvm_argLongLong_ppc64_ellipsis
262
- , &dc_callvm_argFloat_ppc64
298
+ , &dc_callvm_argFloat_ppc64_ellipsis
263
299
  , &dc_callvm_argDouble_ppc64_ellipsis
264
300
  , &dc_callvm_argPointer_ppc64
265
301
  , NULL /* argStruct */
@@ -309,10 +345,10 @@ void dc_callvm_mode_ppc64(DCCallVM* in_self, DCint mode)
309
345
  {
310
346
  DCCallVM_ppc64* self = (DCCallVM_ppc64*) in_self;
311
347
  DCCallVM_vt* vt;
312
- switch(mode) {
313
348
 
314
- case DC_CALL_C_PPC64:
349
+ switch(mode) {
315
350
  case DC_CALL_C_DEFAULT:
351
+ case DC_CALL_C_PPC64:
316
352
  case DC_CALL_C_ELLIPSIS:
317
353
  #if DC__ABI_PPC64_ELF_V == 2
318
354
  vt = &gVT_ppc64;
@@ -339,13 +375,16 @@ void dc_callvm_mode_ppc64(DCCallVM* in_self, DCint mode)
339
375
  dc_callvm_base_init(&self->mInterface, vt);
340
376
  }
341
377
 
378
+ /* Public API. */
342
379
  DCCallVM* dcNewCallVM(DCsize size)
343
380
  {
344
- DCCallVM_ppc64* self = (DCCallVM_ppc64*)dcAllocMem(sizeof(DCCallVM_ppc64)+size);
345
- dcVecInit(&self->mVecHead, size);
346
- self->mIntRegs = 0;
347
- self->mFloatRegs = 0;
348
- dc_callvm_mode_ppc64( (DCCallVM*) self, DC_CALL_C_DEFAULT );
349
- return (DCCallVM*)self;
381
+ DCCallVM_ppc64* p = (DCCallVM_ppc64*)dcAllocMem(sizeof(DCCallVM_ppc64)+size);
382
+
383
+ dc_callvm_mode_ppc64((DCCallVM*)p, DC_CALL_C_DEFAULT);
384
+
385
+ dcVecInit(&p->mVecHead, size);
386
+ dc_callvm_reset_ppc64((DCCallVM*)p);
387
+
388
+ return (DCCallVM*)p;
350
389
  }
351
390