rbdc 0.8.7 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +7 -0
  2. data/{bindings → dyncall-bindings}/ruby/rbdc/extconf.rb +1 -1
  3. data/{bindings → dyncall-bindings}/ruby/rbdc/rbdc.c +3 -1
  4. data/dyncall/AUTHORS +2 -0
  5. data/dyncall/BUGS +1 -0
  6. data/dyncall/CMakeLists.txt +10 -2
  7. data/dyncall/ChangeLog +46 -11
  8. data/dyncall/LICENSE +4 -1
  9. data/dyncall/Makefile.embedded +7 -3
  10. data/dyncall/README +23 -14
  11. data/dyncall/ToDo +27 -28
  12. data/dyncall/autovar/autovar_ABI.h +3 -2
  13. data/dyncall/autovar/autovar_ARCH.h +13 -10
  14. data/dyncall/autovar/autovar_CC.h +3 -2
  15. data/dyncall/autovar/autovar_OS.h +3 -2
  16. data/dyncall/autovar/autovar_OSFAMILY.h +3 -2
  17. data/dyncall/buildsys/scripts/batch-build-linux.sh +6 -2
  18. data/dyncall/buildsys/scripts/batch-build-minix.sh +2 -0
  19. data/dyncall/buildsys/scripts/batch-build-psp.sh +4 -1
  20. data/dyncall/buildsys/scripts/elf-to-psp-eboot.sh +19 -0
  21. data/dyncall/buildsys/scripts/setenv-cross-ios.sh +0 -0
  22. data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +0 -0
  23. data/dyncall/configure +83 -30
  24. data/dyncall/dyncall/dyncall.3 +16 -4
  25. data/dyncall/dyncall/dyncall.h +9 -1
  26. data/dyncall/dyncall/dyncall_alloc.h +2 -1
  27. data/dyncall/dyncall/dyncall_api.c +2 -1
  28. data/dyncall/dyncall/dyncall_call.S +9 -2
  29. data/dyncall/dyncall/dyncall_call_arm32_arm.S +2 -1
  30. data/dyncall/dyncall/dyncall_call_arm32_arm.h +8 -2
  31. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +11 -19
  32. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +15 -2
  33. data/dyncall/dyncall/dyncall_call_arm32_thumb.h +8 -6
  34. data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +10 -18
  35. data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +0 -16
  36. data/dyncall/dyncall/dyncall_call_arm64.S +226 -0
  37. data/dyncall/dyncall/dyncall_call_arm64.h +45 -0
  38. data/dyncall/dyncall/dyncall_call_mips.h +2 -1
  39. data/dyncall/dyncall/dyncall_call_mips_eabi.h +2 -1
  40. data/dyncall/dyncall/dyncall_call_mips_gas.S +2 -1
  41. data/dyncall/dyncall/dyncall_call_mips_n32.h +2 -1
  42. data/dyncall/dyncall/dyncall_call_mips_n64.h +2 -1
  43. data/dyncall/dyncall/dyncall_call_mips_o32.h +2 -1
  44. data/dyncall/dyncall/dyncall_call_ppc32.S +27 -2
  45. data/dyncall/dyncall/dyncall_call_ppc32.h +2 -2
  46. data/dyncall/dyncall/dyncall_call_ppc64.S +210 -0
  47. data/dyncall/dyncall/dyncall_call_ppc64.h +55 -0
  48. data/dyncall/dyncall/dyncall_call_sparc.S +2 -1
  49. data/dyncall/dyncall/dyncall_call_sparc.h +2 -1
  50. data/dyncall/dyncall/dyncall_call_sparc64.S +2 -1
  51. data/dyncall/dyncall/dyncall_call_sparc64.h +2 -1
  52. data/dyncall/dyncall/dyncall_call_sparc_v9.S +25 -23
  53. data/dyncall/dyncall/dyncall_call_sparc_v9.h +2 -1
  54. data/dyncall/dyncall/dyncall_call_x64-att.S +2 -1
  55. data/dyncall/dyncall/dyncall_call_x64.S +2 -1
  56. data/dyncall/dyncall/dyncall_call_x64.h +2 -1
  57. data/dyncall/dyncall/dyncall_call_x86.S +2 -1
  58. data/dyncall/dyncall/dyncall_call_x86.h +2 -1
  59. data/dyncall/dyncall/dyncall_callf.c +56 -66
  60. data/dyncall/dyncall/dyncall_callf.h +5 -1
  61. data/dyncall/dyncall/dyncall_callvm.c +11 -2
  62. data/dyncall/dyncall/dyncall_callvm.h +2 -1
  63. data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +2 -1
  64. data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +2 -1
  65. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +60 -30
  66. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +3 -2
  67. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +2 -24
  68. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +2 -1
  69. data/dyncall/dyncall/dyncall_callvm_arm64.c +165 -0
  70. data/dyncall/dyncall/dyncall_callvm_arm64.h +51 -0
  71. data/dyncall/dyncall/dyncall_callvm_arm64_apple.c +272 -0
  72. data/dyncall/dyncall/dyncall_callvm_base.c +2 -1
  73. data/dyncall/dyncall/dyncall_callvm_mips.c +2 -1
  74. data/dyncall/dyncall/dyncall_callvm_mips.h +2 -1
  75. data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +2 -1
  76. data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +2 -1
  77. data/dyncall/dyncall/dyncall_callvm_mips_n32.c +2 -1
  78. data/dyncall/dyncall/dyncall_callvm_mips_n64.c +2 -1
  79. data/dyncall/dyncall/dyncall_callvm_mips_n64.h +2 -1
  80. data/dyncall/dyncall/dyncall_callvm_mips_o32.c +2 -1
  81. data/dyncall/dyncall/dyncall_callvm_mips_o32.h +2 -1
  82. data/dyncall/dyncall/dyncall_callvm_ppc32.c +45 -2
  83. data/dyncall/dyncall/dyncall_callvm_ppc32.h +2 -1
  84. data/dyncall/dyncall/dyncall_callvm_ppc64.c +351 -0
  85. data/dyncall/dyncall/dyncall_callvm_ppc64.h +60 -0
  86. data/dyncall/dyncall/dyncall_callvm_sparc.c +2 -1
  87. data/dyncall/dyncall/dyncall_callvm_sparc.h +2 -1
  88. data/dyncall/dyncall/dyncall_callvm_sparc64.c +2 -2
  89. data/dyncall/dyncall/dyncall_callvm_sparc64.h +2 -1
  90. data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +3 -3
  91. data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +2 -1
  92. data/dyncall/dyncall/dyncall_callvm_x64.c +2 -1
  93. data/dyncall/dyncall/dyncall_callvm_x64.h +2 -1
  94. data/dyncall/dyncall/dyncall_callvm_x86.c +2 -1
  95. data/dyncall/dyncall/dyncall_callvm_x86.h +2 -1
  96. data/dyncall/dyncall/dyncall_config.h +2 -1
  97. data/dyncall/dyncall/dyncall_macros.h +46 -9
  98. data/dyncall/dyncall/dyncall_signature.h +2 -1
  99. data/dyncall/dyncall/dyncall_struct.c +2 -1
  100. data/dyncall/dyncall/dyncall_struct.h +2 -1
  101. data/dyncall/dyncall/dyncall_types.h +2 -1
  102. data/dyncall/dyncall/dyncall_utils.h +2 -1
  103. data/dyncall/dyncall/dyncall_value.h +19 -1
  104. data/dyncall/dyncall/dyncall_vector.c +2 -1
  105. data/dyncall/dyncall/dyncall_vector.h +3 -1
  106. data/dyncall/dyncall/gen-masm.sh +0 -0
  107. data/dyncall/dyncallback/Makefile.generic +1 -1
  108. data/dyncall/dyncallback/dyncall_alloc_wx.c +2 -1
  109. data/dyncall/dyncallback/dyncall_alloc_wx.h +2 -1
  110. data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +2 -1
  111. data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +2 -1
  112. data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +2 -1
  113. data/dyncall/dyncallback/dyncall_args.c +22 -10
  114. data/dyncall/dyncallback/dyncall_args.h +2 -1
  115. data/dyncall/dyncallback/dyncall_args_arm32_arm.c +35 -4
  116. data/dyncall/dyncallback/dyncall_args_arm32_arm.h +7 -1
  117. data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +2 -1
  118. data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +2 -1
  119. data/dyncall/dyncallback/dyncall_args_arm64.c +77 -0
  120. data/dyncall/dyncallback/dyncall_args_arm64_apple.c +160 -0
  121. data/dyncall/dyncallback/dyncall_args_mips.c +3 -2
  122. data/dyncall/dyncallback/dyncall_args_mips.h +3 -2
  123. data/dyncall/dyncallback/dyncall_args_ppc32.c +2 -1
  124. data/dyncall/dyncallback/dyncall_args_ppc32.h +9 -7
  125. data/dyncall/dyncallback/dyncall_args_ppc32_sysv.c +95 -0
  126. data/dyncall/dyncallback/dyncall_args_ppc64.c +71 -0
  127. data/dyncall/dyncallback/dyncall_args_ppc64.h +40 -0
  128. data/dyncall/dyncallback/dyncall_args_sparc32.c +2 -1
  129. data/dyncall/dyncallback/dyncall_args_sparc32.h +2 -1
  130. data/dyncall/dyncallback/dyncall_args_sparc64.c +2 -1
  131. data/dyncall/dyncallback/dyncall_args_sparc64.h +2 -1
  132. data/dyncall/dyncallback/dyncall_args_x64.c +2 -1
  133. data/dyncall/dyncallback/dyncall_args_x64.h +2 -1
  134. data/dyncall/dyncallback/dyncall_args_x86.c +2 -1
  135. data/dyncall/dyncallback/dyncall_args_x86.h +2 -1
  136. data/dyncall/dyncallback/dyncall_callback.c +7 -2
  137. data/dyncall/dyncallback/dyncall_callback.h +3 -1
  138. data/dyncall/dyncallback/dyncall_callback_arch.S +14 -6
  139. data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +2 -1
  140. data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +2 -1
  141. data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +1 -1
  142. data/dyncall/dyncallback/{dyncall_callback_arm32_arm_gas.s → dyncall_callback_arm32_arm_gas.S} +17 -7
  143. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +2 -1
  144. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +2 -1
  145. data/dyncall/dyncallback/{dyncall_callback_arm32_thumb_apple.s → dyncall_callback_arm32_thumb_apple.S} +2 -2
  146. data/dyncall/dyncallback/{dyncall_callback_arm32_thumb_gas.s → dyncall_callback_arm32_thumb_gas.S} +2 -2
  147. data/dyncall/dyncallback/dyncall_callback_arm64.S +111 -0
  148. data/dyncall/dyncallback/dyncall_callback_arm64.c +71 -0
  149. data/dyncall/dyncallback/dyncall_callback_mips.c +3 -2
  150. data/dyncall/dyncallback/dyncall_callback_mips.h +3 -2
  151. data/dyncall/dyncallback/dyncall_callback_ppc32.S +115 -4
  152. data/dyncall/dyncallback/dyncall_callback_ppc32.c +3 -2
  153. data/dyncall/dyncallback/dyncall_callback_ppc32.h +6 -6
  154. data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +6 -5
  155. data/dyncall/dyncallback/dyncall_callback_ppc64.S +170 -0
  156. data/dyncall/dyncallback/dyncall_callback_ppc64.c +60 -0
  157. data/dyncall/dyncallback/dyncall_callback_ppc64.h +56 -0
  158. data/dyncall/dyncallback/dyncall_callback_sparc32.c +2 -1
  159. data/dyncall/dyncallback/dyncall_callback_sparc32.h +2 -1
  160. data/dyncall/dyncallback/dyncall_callback_sparc32.s +1 -1
  161. data/dyncall/dyncallback/dyncall_callback_sparc64.c +2 -1
  162. data/dyncall/dyncallback/dyncall_callback_sparc64.s +1 -1
  163. data/dyncall/dyncallback/dyncall_callback_x64.S +5 -12
  164. data/dyncall/dyncallback/dyncall_callback_x64.c +2 -1
  165. data/dyncall/dyncallback/dyncall_callback_x64.h +2 -1
  166. data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +0 -7
  167. data/dyncall/dyncallback/dyncall_callback_x86.S +5 -12
  168. data/dyncall/dyncallback/dyncall_callback_x86.c +2 -1
  169. data/dyncall/dyncallback/dyncall_callback_x86.h +2 -1
  170. data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +2 -11
  171. data/dyncall/dyncallback/dyncall_thunk.c +11 -3
  172. data/dyncall/dyncallback/dyncall_thunk.h +8 -2
  173. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +7 -7
  174. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +2 -1
  175. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +2 -1
  176. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +2 -1
  177. data/dyncall/dyncallback/dyncall_thunk_arm64.c +64 -0
  178. data/dyncall/dyncallback/dyncall_thunk_arm64.h +42 -0
  179. data/dyncall/dyncallback/dyncall_thunk_mips.c +49 -17
  180. data/dyncall/dyncallback/dyncall_thunk_mips.h +3 -2
  181. data/dyncall/dyncallback/dyncall_thunk_ppc32.c +3 -2
  182. data/dyncall/dyncallback/dyncall_thunk_ppc32.h +7 -7
  183. data/dyncall/dyncallback/dyncall_thunk_ppc32_sysv.c +50 -0
  184. data/dyncall/dyncallback/dyncall_thunk_ppc64.c +87 -0
  185. data/dyncall/dyncallback/dyncall_thunk_ppc64.h +55 -0
  186. data/dyncall/dyncallback/dyncall_thunk_sparc32.c +2 -1
  187. data/dyncall/dyncallback/dyncall_thunk_sparc32.h +2 -1
  188. data/dyncall/dyncallback/dyncall_thunk_sparc64.c +2 -1
  189. data/dyncall/dyncallback/dyncall_thunk_sparc64.h +2 -1
  190. data/dyncall/dyncallback/dyncall_thunk_x64.c +2 -1
  191. data/dyncall/dyncallback/dyncall_thunk_x64.h +2 -1
  192. data/dyncall/dyncallback/dyncall_thunk_x86.c +2 -1
  193. data/dyncall/dyncallback/dyncall_thunk_x86.h +2 -1
  194. data/dyncall/dyncallback/dyncallback.3 +3 -3
  195. data/dyncall/dyncallback/gen-masm.sh +0 -0
  196. data/dyncall/dynload/dynload.c +2 -1
  197. data/dyncall/dynload/dynload.h +2 -1
  198. data/dyncall/dynload/dynload_alloc.h +2 -1
  199. data/dyncall/dynload/dynload_darwin.c +2 -1
  200. data/dyncall/dynload/dynload_syms.c +2 -1
  201. data/dyncall/dynload/dynload_syms_elf.c +2 -1
  202. data/dyncall/dynload/dynload_syms_mach-o.c +3 -2
  203. data/dyncall/dynload/dynload_syms_pe.c +2 -1
  204. data/dyncall/dynload/dynload_unix.c +2 -1
  205. data/dyncall/dynload/dynload_windows.c +2 -1
  206. data/dyncall/portasm/gen-masm.sh +0 -0
  207. data/dyncall/portasm/portasm-arm.S +3 -2
  208. data/dyncall/portasm/portasm-ppc.S +2 -1
  209. data/dyncall/portasm/portasm-ppc64.S +119 -0
  210. data/dyncall/portasm/portasm-x64-att.S +2 -1
  211. data/dyncall/portasm/portasm-x86.S +2 -1
  212. metadata +39 -18
  213. data/dyncall/dyncallback/dyncall_callback_x64_apple.s +0 -122
  214. data/dyncall/dyncallback/dyncall_callback_x64_gas.s +0 -119
  215. data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +0 -102
@@ -6,8 +6,8 @@
6
6
  Description: Callback - Header for MIPS
7
7
  License:
8
8
 
9
- Copyright (c) 2013 Daniel Adler <dadler@uni-goettingen.de>,
10
- Tassilo Philipp <tphilipp@potion-studios.com>
9
+ Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
10
+ Tassilo Philipp <tphilipp@potion-studios.com>
11
11
 
12
12
  Permission to use, copy, modify, and distribute this software for any
13
13
  purpose with or without fee is hereby granted, provided that the above
@@ -23,6 +23,7 @@
23
23
 
24
24
  */
25
25
 
26
+
26
27
  #ifndef DYNCALL_CALLBACK_MIPS_H
27
28
  #define DYNCALL_CALLBACK_MIPS_H
28
29
 
@@ -3,11 +3,10 @@
3
3
  Package: dyncall
4
4
  Library: dyncallback
5
5
  File: dyncallback/dyncall_callback_ppc32.S
6
- Description: Callback Thunk - Implementation for PowerPC 32-bit on Darwin/Apple's as
6
+ Description: Callback Thunk Entry for PowerPC 32-bit System V Big-Endian ABI
7
7
  License:
8
8
 
9
- Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
10
- Tassilo Philipp <tphilipp@potion-studios.com>
9
+ Copyright (c) 2015 Daniel Adler <dadler@uni-goettingen.de>
11
10
 
12
11
  Permission to use, copy, modify, and distribute this software for any
13
12
  purpose with or without fee is hereby granted, provided that the above
@@ -23,11 +22,123 @@
23
22
 
24
23
  */
25
24
 
25
+
26
26
  #include "../portasm/portasm-ppc.S"
27
+
27
28
  .machine ppc
28
29
  .text
29
30
  .align 2
31
+
32
+ /* Struct DCCallback */
33
+
34
+ DCB_THUNK = 0
35
+ DCB_HANDLER = 24
36
+ DCB_CLEANUP = 28
37
+ DCB_USERDATA = 32
38
+
39
+ /* Struct DCArgs */
40
+
41
+ ARGS_IREGS = 0
42
+ ARGS_FREGS = ARGS_IREGS + 4*8
43
+ ARGS_SP = ARGS_FREGS + 8*13
44
+ ARGS_ICNT = ARGS_SP + 4
45
+ ARGS_FCNT = ARGS_ICNT + 4
46
+ ARGS_SIZE = ARGS_FCNT + 4
47
+
48
+ /* Struct DCValue */
49
+
50
+ RESULT_SIZE = 8
51
+
52
+ /* Stack Offsets: */
53
+
54
+ SP_PREV = 0
55
+ SP_LR = (SP_PREV + 4)
56
+ SP_PAR = SP_LR + 4
57
+ PAR_SZ = 0
58
+ SP_ARGS = SP_PAR + PAR_SZ
59
+ SP_IREGS = SP_ARGS + ARGS_IREGS
60
+ SP_FREGS = SP_ARGS + ARGS_FREGS
61
+ SP_SP = SP_ARGS + ARGS_SP
62
+ SP_ICNT = SP_ARGS + ARGS_ICNT
63
+ SP_FCNT = SP_ARGS + ARGS_FCNT
64
+ SP_RESULT = SP_ARGS + ARGS_SIZE
65
+ SP_SIZE = SP_RESULT + RESULT_SIZE
66
+
67
+ #define ALIGN(M,X) ( M+(X-1) & (-X) )
68
+
69
+ FRAMESIZE = ALIGN(SP_SIZE,16)
70
+
30
71
  GLOBAL_C(dcCallbackThunkEntry)
31
72
  ENTRY_C(dcCallbackThunkEntry)
32
- blr /* return */
33
73
 
74
+ /* --------------------------------------------------------------------------
75
+
76
+ Input:
77
+ r1 Stack Pointer
78
+ r3-r10 Integer Arguments
79
+ f1-f8 Floating-point Arguments
80
+ r11 Thunk Pointer
81
+
82
+ */
83
+
84
+ /* prolog */
85
+
86
+ mflr r0
87
+ stw r0, SP_LR(r1) /* store return address */
88
+ addi r12, r1, SP_PAR /* temporary r12: parameter area on callers stack frame */
89
+ stwu r1, -FRAMESIZE(r1)
90
+
91
+ stw r3, SP_IREGS + 0*4(r1) /* spill 8 integer parameter registers */
92
+ stw r4, SP_IREGS + 1*4(r1)
93
+ stw r5, SP_IREGS + 2*4(r1)
94
+ stw r6, SP_IREGS + 3*4(r1)
95
+ stw r7, SP_IREGS + 4*4(r1)
96
+ stw r8, SP_IREGS + 5*4(r1)
97
+ stw r9, SP_IREGS + 6*4(r1)
98
+ stw r10,SP_IREGS + 7*4(r1)
99
+
100
+ stfd f1, SP_FREGS + 0*8(r1) /* spill 8 (of 13) float parameter registers */
101
+ stfd f2, SP_FREGS + 1*8(r1)
102
+ stfd f3, SP_FREGS + 2*8(r1)
103
+ stfd f4, SP_FREGS + 3*8(r1)
104
+ stfd f5, SP_FREGS + 4*8(r1)
105
+ stfd f6, SP_FREGS + 5*8(r1)
106
+ stfd f7, SP_FREGS + 6*8(r1)
107
+ stfd f8, SP_FREGS + 7*8(r1)
108
+
109
+ stw r12, SP_SP(r1) /* init stack pointer */
110
+ xor r0, r0, r0 /* init register counters */
111
+ stw r0, SP_ICNT(r1)
112
+ stw r0, SP_FCNT(r1)
113
+ stw r0, SP_RESULT(r1) /* init result object */
114
+ stw r0, SP_RESULT + 4(r1)
115
+ /* invoke callback handler */
116
+ mr r3, r11 /* arg 1: DCCallback* pcb (r11 is thunk pointer) */
117
+ addi r4, r1, SP_ARGS /* arg 2: DCArgs* args */
118
+ addi r5, r1, SP_RESULT /* arg 3: DCValue* result */
119
+ lwz r6, DCB_USERDATA(r11) /* arg 4: void* userdata */
120
+
121
+ /* branch-and-link to DCCallback.handler */
122
+ lwz r12, DCB_HANDLER(r11)
123
+ mtctr r12
124
+ bctrl
125
+ /* check result type */
126
+ cmpi cr0, r3, 'f
127
+ beq .f32
128
+ cmpi cr0, r3, 'd
129
+ beq .f64
130
+ .i64:
131
+ lwz r3, SP_RESULT (r1)
132
+ lwz r4, SP_RESULT + 4 (r1)
133
+ .end:
134
+ lwz r1, SP_PREV(r1) /* restore stack pointer */
135
+ lwz r0, SP_LR(r1) /* load link register with return address */
136
+ mtlr r0
137
+ blr /* branch back to link register */
138
+ .f32:
139
+ lfs f1, SP_RESULT(r1)
140
+ b .end
141
+ .f64:
142
+ lfd f1, SP_RESULT(r1)
143
+ b .end
144
+
@@ -3,10 +3,10 @@
3
3
  Package: dyncall
4
4
  Library: dyncallback
5
5
  File: dyncallback/dyncall_callback_ppc32.c
6
- Description: Callback - Implementation Header for ppc32 (TODO: not implemented yet)
6
+ Description: Callback - Implementation Header for ppc32
7
7
  License:
8
8
 
9
- Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
9
+ Copyright (c) 2007-2015 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
@@ -23,6 +23,7 @@
23
23
 
24
24
  */
25
25
 
26
+
26
27
  #include "dyncall_callback.h"
27
28
  #include "dyncall_callback_ppc32.h"
28
29
 
@@ -6,7 +6,7 @@
6
6
  Description: Callback - Header for ppc32
7
7
  License:
8
8
 
9
- Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
9
+ Copyright (c) 2007-2015 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
@@ -33,11 +33,11 @@
33
33
 
34
34
  struct DCCallback
35
35
  {
36
- DCThunk thunk; /* offset 0, size 40 */
37
- DCCallbackHandler* handler; /* offset 40, size 4 */
38
- size_t stack_cleanup; /* offset 44, size 4 */
39
- void* userdata; /* offset 48, size 4 */
40
- };
36
+ DCThunk thunk; /* offset 0, size 24 */
37
+ DCCallbackHandler* handler; /* offset 24, size 4 */
38
+ size_t stack_cleanup; /* offset 28, size 4 */
39
+ void* userdata; /* offset 32, size 4 */
40
+ }; /* total size 36 */
41
41
 
42
42
  #endif /* DYNCALL_CALLBACK_PPC32_H */
43
43
 
@@ -3,10 +3,10 @@
3
3
  Package: dyncall
4
4
  Library: dyncallback
5
5
  File: dyncallback/dyncall_callback_ppc32_apple.s
6
- Description: Callback Thunk - Implementation for PowerPC 32-bit on Darwin/Apple's as
6
+ Description: Callback Thunk - PowerPC 32-bit System V ABI
7
7
  License:
8
8
 
9
- Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
9
+ Copyright (c) 2007-2015 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
@@ -27,12 +27,13 @@
27
27
  .text
28
28
  .align 2
29
29
 
30
- /* Callback Thunk Entry code for Apple Mac OS X PowerPC 32-bit. */
30
+ /* Callback Thunk Entry code for PowerPC 32-bit Darwin/Apple Mac OS X. */
31
+
31
32
 
32
33
  /* Stack Frame Layout:
33
34
 
34
- 206 DCValue ( )
35
- 56 DCArgs (32+104+4+8 = 150)
35
+ 204 DCValue ( )
36
+ 56 DCArgs (32+104+4+8 = 148)
36
37
  24 Parameter area ( 4*8 = 32 )
37
38
  0 Linkage area ( 24 )
38
39
 
@@ -0,0 +1,170 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncallback
5
+ File: dyncallback/dyncall_callback_ppc64.S
6
+ Description: Callback Thunk - Implementation for PowerPC 64-bit
7
+ License:
8
+
9
+ Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
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
+ #include "../portasm/portasm-ppc64.S"
26
+
27
+ .text
28
+ .align 2
29
+
30
+ /* struct DCCallback */
31
+
32
+ #if DC__ABI_PPC64_ELF_V != 2
33
+ DCB_THUNK = 0 /* v1 */
34
+ DCB_HANDLER = 64
35
+ DCB_STACKCLEAN = 72
36
+ DCB_USERDATA = 80
37
+ #else
38
+ DCB_THUNK = 0 /* v2 */
39
+ DCB_HANDLER = 48
40
+ DCB_STACKCLEAN = 56
41
+ DCB_USERDATA = 64
42
+ #endif
43
+
44
+ /* struct DCArgs */
45
+
46
+ ARGS_IREGS = 0
47
+ ARGS_FREGS = ARGS_IREGS + 8*8
48
+ ARGS_SP = ARGS_FREGS + 8*13
49
+ ARGS_ICNT = ARGS_SP + 8
50
+ ARGS_FCNT = ARGS_ICNT + 4
51
+ ARGS_SIZE = ARGS_FCNT + 4
52
+
53
+ /* struct DCValue */
54
+
55
+ RESULT_SIZE = 8
56
+
57
+ /* Stack Offsets */
58
+
59
+ SP_PREV = 0
60
+ SP_CR = SP_PREV + 8
61
+ SP_LR = SP_CR + 8
62
+ #if DC__ABI_PPC64_ELF_V != 2
63
+ SP_TOC = 40
64
+ SP_PAR = 48
65
+ PAR_SZ = 64
66
+ #else
67
+ SP_TOC = 24
68
+ SP_PAR = 32
69
+ PAR_SZ = 0
70
+ #endif
71
+ SP_ARGS = SP_PAR + PAR_SZ
72
+ SP_IREGS = SP_ARGS + ARGS_IREGS
73
+ SP_FREGS = SP_ARGS + ARGS_FREGS
74
+ SP_SP = SP_ARGS + ARGS_SP
75
+ SP_ICNT = SP_ARGS + ARGS_ICNT
76
+ SP_FCNT = SP_ARGS + ARGS_FCNT
77
+ SP_RESULT = SP_ARGS + ARGS_SIZE
78
+ SP_LOCAL = SP_RESULT + RESULT_SIZE /* additional locals (reg 30/31) */
79
+ SP_SIZE = SP_LOCAL + 2*8
80
+
81
+ #define ALIGN(M,X) ( M+(X-1) & (-X) )
82
+
83
+ FRAMESIZE = ALIGN(SP_SIZE,16)
84
+
85
+ GLOBAL_C(dcCallbackThunkEntry)
86
+ ENTRY_C(dcCallbackThunkEntry)
87
+
88
+ /* --------------------------------------------------------------------------
89
+
90
+ Input:
91
+ r1 Stack Pointer
92
+ r3-r10 Integer Arguments
93
+ f1-f8 Floating-point Arguments
94
+ r11 Thunk Pointer
95
+
96
+ */
97
+
98
+ mflr r0
99
+ std r0, SP_LR(r1) /* store return address */
100
+ std r31, -8(r1) /* store preserved registers (r31) */
101
+ addi r12, r1, SP_PAR /* temporary r12 = parameter area on callers stack frame */
102
+ stdu r1, -FRAMESIZE(r1) /* save callers stack pointer and make new stack frame. */
103
+
104
+ std r3, SP_IREGS + 0*8(r1) /* spill 8 integer parameter registers */
105
+ std r4, SP_IREGS + 1*8(r1)
106
+ std r5, SP_IREGS + 2*8(r1)
107
+ std r6, SP_IREGS + 3*8(r1)
108
+ std r7, SP_IREGS + 4*8(r1)
109
+ std r8, SP_IREGS + 5*8(r1)
110
+ std r9, SP_IREGS + 6*8(r1)
111
+ std r10,SP_IREGS + 7*8(r1)
112
+ stfd f1, SP_FREGS + 0*8(r1) /* spill 13 float parameter registers */
113
+ stfd f2, SP_FREGS + 1*8(r1)
114
+ stfd f3, SP_FREGS + 2*8(r1)
115
+ stfd f4, SP_FREGS + 3*8(r1)
116
+ stfd f5, SP_FREGS + 4*8(r1)
117
+ stfd f6, SP_FREGS + 5*8(r1)
118
+ stfd f7, SP_FREGS + 6*8(r1)
119
+ stfd f8, SP_FREGS + 7*8(r1)
120
+ stfd f9, SP_FREGS + 8*8(r1)
121
+ stfd f10,SP_FREGS + 9*8(r1)
122
+ stfd f11,SP_FREGS +10*8(r1)
123
+ stfd f12,SP_FREGS +11*8(r1)
124
+ stfd f13,SP_FREGS +12*8(r1)
125
+ /* initialize struct DCCallback */
126
+ std r12,SP_SP(r1) /* init stack pointer */
127
+ xor r0, r0, r0 /* init register counters */
128
+ std r0, SP_ICNT(r1)
129
+ std r0, SP_FCNT(r1)
130
+ std r0, SP_RESULT(r1) /* init result object */
131
+ /* invoke callback handler */
132
+ mr r3, r11 /* arg 1: DCCallback* pcb (r11 is thunk pointer) */
133
+ addi r4, r1, SP_ARGS /* arg 2: DCArgs* args */
134
+ addi r5, r1, SP_RESULT /* arg 3: DCValue* result */
135
+ ld r6, DCB_USERDATA(r11) /* arg 4: void* userdata */
136
+
137
+ /* branch-and-link to DCCallback.handler */
138
+ ld r12, DCB_HANDLER(r11)
139
+ std r2, SP_TOC(r1)
140
+ #if DC__ABI_PPC64_ELF_V != 2
141
+ ld r2, 8(r12)
142
+ ld r0, 0(r12)
143
+ mtctr r0
144
+ #else
145
+ mtctr r12
146
+ #endif
147
+ bctrl
148
+
149
+ /* check result type */
150
+ cmpi cr0, r3, 'f
151
+ beq .f32
152
+ cmpi cr0, r3, 'd
153
+ beq .f64
154
+ .i64:
155
+ ld r3, SP_RESULT(r1)
156
+ b .end
157
+ .end:
158
+
159
+ ld r2, SP_TOC(r1)
160
+ ld r1, SP_PREV(r1) /* restore stack pointer */
161
+ ld r31, -8(r1) /* restore preserved registers */
162
+ ld r0, SP_LR(r1) /* load link register with return address */
163
+ mtlr r0
164
+ blr /* branch back to link register */
165
+ .f32:
166
+ lfs f1, SP_RESULT(r1)
167
+ b .end
168
+ .f64:
169
+ lfd f1, SP_RESULT(r1)
170
+ b .end
@@ -0,0 +1,60 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncallback
5
+ File: dyncallback/dyncall_callback_ppc64.c
6
+ Description: Callback - Implementation Header for ppc64
7
+ License:
8
+
9
+ Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
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
+ #include "dyncall_callback.h"
27
+ #include "dyncall_callback_ppc64.h"
28
+
29
+ void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
30
+ {
31
+ const char* ptr;
32
+ char ch;
33
+
34
+ pcb->handler = handler;
35
+ pcb->userdata = userdata;
36
+ }
37
+
38
+ extern void dcCallbackThunkEntry();
39
+
40
+ DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
41
+ {
42
+ DCCallback* pcb;
43
+ int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
44
+ if (err != 0) return 0;
45
+
46
+ dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
47
+ dcbInitCallback(pcb, signature, handler, userdata);
48
+
49
+ return pcb;
50
+ }
51
+
52
+ void dcbFreeCallback(DCCallback* pcb)
53
+ {
54
+ dcFreeWX(pcb, sizeof(DCCallback));
55
+ }
56
+
57
+ void* dcbGetUserData(DCCallback* pcb)
58
+ {
59
+ return pcb->userdata;
60
+ }