You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

782 lines
37 KiB

  1. === modified file 'libs/context/build/Jamfile.v2'
  2. --- libs/context/build/Jamfile.v2 2013-12-30 19:16:18 +0000
  3. +++ libs/context/build/Jamfile.v2 2014-01-03 18:10:41 +0000
  4. @@ -188,6 +188,15 @@
  5. <binary-format>elf
  6. ;
  7. +alias asm_context_sources
  8. + : [ make asm/make_ppc32_sysv_macho_gas.o : asm/make_ppc32_sysv_macho_gas.S : @gas ]
  9. + [ make asm/jump_ppc32_sysv_macho_gas.o : asm/jump_ppc32_sysv_macho_gas.S : @gas ]
  10. + : <address-model>32
  11. + <architecture>power
  12. + <binary-format>mach-o
  13. + <target-os>darwin
  14. + ;
  15. +
  16. # POWERPC_64
  17. alias asm_context_sources
  18. : asm/make_ppc64_sysv_elf_gas.S
  19. @@ -215,6 +224,15 @@
  20. <binary-format>elf
  21. ;
  22. +alias asm_context_sources
  23. + : [ make asm/make_ppc64_sysv_macho_gas.o : asm/make_ppc64_sysv_macho_gas.S : @gas ]
  24. + [ make asm/jump_ppc64_sysv_macho_gas.o : asm/jump_ppc64_sysv_macho_gas.S : @gas ]
  25. + : <address-model>64
  26. + <architecture>power
  27. + <binary-format>mach-o
  28. + <target-os>darwin
  29. + ;
  30. +
  31. # SPARC
  32. alias asm_context_sources
  33. : asm/make_sparc_sysv_elf_gas.S
  34. @@ -414,6 +432,25 @@
  35. ;
  36. alias asm_context_sources
  37. + : asm/make_i386_x86_64_sysv_macho_gas.S
  38. + asm/jump_i386_x86_64_sysv_macho_gas.S
  39. + : <address-model>32_64
  40. + <architecture>x86
  41. + <binary-format>mach-o
  42. + <target-os>darwin
  43. + <toolset>darwin
  44. + ;
  45. +
  46. +alias asm_context_sources
  47. + : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ]
  48. + [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ]
  49. + : <address-model>32_64
  50. + <architecture>x86
  51. + <binary-format>mach-o
  52. + <target-os>darwin
  53. + ;
  54. +
  55. +alias asm_context_sources
  56. : asm/make_x86_64_ms_pe_masm.asm
  57. asm/jump_x86_64_ms_pe_masm.asm
  58. dummy.cpp
  59. @@ -424,6 +461,25 @@
  60. <toolset>intel
  61. ;
  62. +#COMBINED
  63. +
  64. +alias asm_context_sources
  65. + : asm/make_combined_sysv_macho_gas.S
  66. + asm/jump_combined_sysv_macho_gas.S
  67. + : <architecture>combined
  68. + <binary-format>mach-o
  69. + <target-os>darwin
  70. + <toolset>darwin
  71. + ;
  72. +
  73. +alias asm_context_sources
  74. + : [ make asm/make_combined_sysv_macho_gas.o : asm/make_combined_sysv_macho_gas.S : @gas ]
  75. + [ make asm/jump_combined_sysv_macho_gas.o : asm/jump_combined_sysv_macho_gas.S : @gas ]
  76. + : <architecture>combined
  77. + <binary-format>mach-o
  78. + <target-os>darwin
  79. + ;
  80. +
  81. alias asm_context_sources
  82. : asm/make_x86_64_ms_pe_masm.asm
  83. asm/jump_x86_64_ms_pe_masm.asm
  84. === modified file 'libs/context/build/architecture.jam'
  85. --- libs/context/build/architecture.jam 2013-12-30 19:16:18 +0000
  86. +++ libs/context/build/architecture.jam 2014-01-02 10:47:09 +0000
  87. @@ -71,6 +71,14 @@
  88. {
  89. return <architecture>x86 ;
  90. }
  91. + else if [ configure.builds /boost/architecture//ppc : $(properties) : ppc ]
  92. + {
  93. + return <architecture>ppc ;
  94. + }
  95. + else if [ configure.builds /boost/architecture//combined : $(properties) : combined ]
  96. + {
  97. + return <architecture>combined ;
  98. + }
  99. }
  100. }
  101. === added file 'libs/context/src/asm/jump_combined_sysv_macho_gas.S'
  102. --- libs/context/src/asm/jump_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  103. +++ libs/context/src/asm/jump_combined_sysv_macho_gas.S 2014-01-03 17:46:02 +0000
  104. @@ -0,0 +1,20 @@
  105. +/*
  106. + Copyright Sergue E. Leontiev 2013.
  107. + Distributed under the Boost Software License, Version 1.0.
  108. + (See accompanying file LICENSE_1_0.txt or copy at
  109. + http://www.boost.org/LICENSE_1_0.txt)
  110. +*/
  111. +
  112. +// Stub file for universal binary
  113. +
  114. +#if defined(__i386__)
  115. + #include "jump_i386_sysv_macho_gas.S"
  116. +#elif defined(__x86_64__)
  117. + #include "jump_x86_64_sysv_macho_gas.S"
  118. +#elif defined(__ppc__)
  119. + #include "jump_ppc32_sysv_macho_gas.S"
  120. +#elif defined(__ppc64__)
  121. + #include "jump_ppc64_sysv_macho_gas.S"
  122. +#else
  123. + #error "No arch's"
  124. +#endif
  125. === added file 'libs/context/src/asm/jump_ppc32_sysv_macho_gas.S'
  126. --- libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  127. +++ libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 2014-01-03 15:18:19 +0000
  128. @@ -0,0 +1,180 @@
  129. +/*
  130. + Copyright Oliver Kowalke 2009.
  131. + Distributed under the Boost Software License, Version 1.0.
  132. + (See accompanying file LICENSE_1_0.txt or copy at
  133. + http://www.boost.org/LICENSE_1_0.txt)
  134. +*/
  135. +
  136. +/*******************************************************************
  137. + * *
  138. + * ------------------------------------------------------------- *
  139. + * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
  140. + * ------------------------------------------------------------- *
  141. + * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
  142. + * ------------------------------------------------------------- *
  143. + * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
  144. + * ------------------------------------------------------------- *
  145. + * ------------------------------------------------------------- *
  146. + * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
  147. + * ------------------------------------------------------------- *
  148. + * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
  149. + * ------------------------------------------------------------- *
  150. + * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
  151. + * ------------------------------------------------------------- *
  152. + * ------------------------------------------------------------- *
  153. + * | 20 | 21 | 22 | | *
  154. + * ------------------------------------------------------------- *
  155. + * | 80 | 84 | 88 | | *
  156. + * ------------------------------------------------------------- *
  157. + * | CR | LR | PC | | *
  158. + * ------------------------------------------------------------- *
  159. + * ------------------------------------------------------------- *
  160. + * | 23 | 24 | 25 | | *
  161. + * ------------------------------------------------------------- *
  162. + * | 92 | 96 | 100 | | *
  163. + * ------------------------------------------------------------- *
  164. + * | sp | size|<pad>| | *
  165. + * ------------------------------------------------------------- *
  166. + * ------------------------------------------------------------- *
  167. + * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
  168. + * ------------------------------------------------------------- *
  169. + * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
  170. + * ------------------------------------------------------------- *
  171. + * | F14 | F15 | F16 | F17 | F18 | *
  172. + * ------------------------------------------------------------- *
  173. + * ------------------------------------------------------------- *
  174. + * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
  175. + * ------------------------------------------------------------- *
  176. + * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
  177. + * ------------------------------------------------------------- *
  178. + * | F19 | F20 | F21 | F22 | F23 | *
  179. + * ------------------------------------------------------------- *
  180. + * ------------------------------------------------------------- *
  181. + * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
  182. + * ------------------------------------------------------------- *
  183. + * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
  184. + * ------------------------------------------------------------- *
  185. + * | F24 | F25 | F26 | F27 | F28 | *
  186. + * ------------------------------------------------------------- *
  187. + * ------------------------------------------------------------- *
  188. + * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
  189. + * ------------------------------------------------------------- *
  190. + * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
  191. + * ------------------------------------------------------------- *
  192. + * | F29 | F30 | F31 | fpscr | | *
  193. + * ------------------------------------------------------------- *
  194. + * *
  195. + * *****************************************************************/
  196. +
  197. +.machine ppc
  198. +
  199. +.text
  200. +.globl _jump_fcontext
  201. +.align 2
  202. +_jump_fcontext:
  203. + stw r13, 0(r3) ; save R13
  204. + stw r14, 4(r3) ; save R14
  205. + stw r15, 8(r3) ; save R15
  206. + stw r16, 12(r3) ; save R16
  207. + stw r17, 16(r3) ; save R17
  208. + stw r18, 20(r3) ; save R18
  209. + stw r19, 24(r3) ; save R19
  210. + stw r20, 28(r3) ; save R20
  211. + stw r21, 32(r3) ; save R21
  212. + stw r22, 36(r3) ; save R22
  213. + stw r23, 40(r3) ; save R23
  214. + stw r24, 44(r3) ; save R24
  215. + stw r25, 48(r3) ; save R25
  216. + stw r26, 52(r3) ; save R26
  217. + stw r27, 56(r3) ; save R27
  218. + stw r28, 60(r3) ; save R28
  219. + stw r29, 64(r3) ; save R29
  220. + stw r30, 68(r3) ; save R30
  221. + stw r31, 72(r3) ; save R31
  222. + stw r1, 76(r3) ; save SP
  223. +
  224. + mfcr r0 ; load CR
  225. + stw r0, 80(r3) ; save CR
  226. + mflr r0 ; load LR
  227. + stw r0, 84(r3) ; save LR
  228. + stw r0, 88(r3) ; save LR as PC
  229. +
  230. + cmpwi cr7, r6, 0 ; test if fpu env should be preserved
  231. + beq cr7, l1
  232. +
  233. + stfd f14, 104(r3) ; save F14
  234. + stfd f15, 112(r3) ; save F15
  235. + stfd f16, 120(r3) ; save F16
  236. + stfd f17, 128(r3) ; save F17
  237. + stfd f18, 136(r3) ; save F18
  238. + stfd f19, 144(r3) ; save F19
  239. + stfd f20, 152(r3) ; save F20
  240. + stfd f21, 160(r3) ; save F21
  241. + stfd f22, 168(r3) ; save F22
  242. + stfd f23, 176(r3) ; save F23
  243. + stfd f24, 184(r3) ; save F24
  244. + stfd f25, 192(r3) ; save F25
  245. + stfd f26, 200(r3) ; save F26
  246. + stfd f27, 208(r3) ; save F27
  247. + stfd f28, 216(r3) ; save F28
  248. + stfd f29, 224(r3) ; save F29
  249. + stfd f30, 232(r3) ; save F30
  250. + stfd f31, 240(r3) ; save F31
  251. + mffs f0 ; load FPSCR
  252. + stfd f0, 248(r3) ; save FPSCR
  253. +
  254. + lfd f14, 104(r4) ; restore F14
  255. + lfd f15, 112(r4) ; restore F15
  256. + lfd f16, 120(r4) ; restore F16
  257. + lfd f17, 128(r4) ; restore F17
  258. + lfd f18, 136(r4) ; restore F18
  259. + lfd f19, 144(r4) ; restore F19
  260. + lfd f20, 152(r4) ; restore F20
  261. + lfd f21, 160(r4) ; restore F21
  262. + lfd f22, 168(r4) ; restore F22
  263. + lfd f23, 176(r4) ; restore F23
  264. + lfd f24, 184(r4) ; restore F24
  265. + lfd f25, 192(r4) ; restore F25
  266. + lfd f26, 200(r4) ; restore F26
  267. + lfd f27, 208(r4) ; restore F27
  268. + lfd f28, 216(r4) ; restore F28
  269. + lfd f29, 224(r4) ; restore F29
  270. + lfd f30, 232(r4) ; restore F30
  271. + lfd f31, 240(r4) ; restore F31
  272. + lfd f0, 248(r4) ; load FPSCR
  273. + mtfsf 0xff, f0 ; restore FPSCR
  274. +l1:
  275. +
  276. + lwz r13, 0(r4) ; restore R13
  277. + lwz r14, 4(r4) ; restore R14
  278. + lwz r15, 8(r4) ; restore R15
  279. + lwz r16, 12(r4) ; restore R16
  280. + lwz r17, 16(r4) ; restore R17
  281. + lwz r18, 20(r4) ; restore R18
  282. + lwz r19, 24(r4) ; restore R19
  283. + lwz r20, 28(r4) ; restore R20
  284. + lwz r21, 32(r4) ; restore R21
  285. + lwz r22, 36(r4) ; restore R22
  286. + lwz r23, 40(r4) ; restore R23
  287. + lwz r24, 44(r4) ; restore R24
  288. + lwz r25, 48(r4) ; restore R25
  289. + lwz r26, 52(r4) ; restore R26
  290. + lwz r27, 56(r4) ; restore R27
  291. + lwz r28, 60(r4) ; restore R28
  292. + lwz r29, 64(r4) ; restore R29
  293. + lwz r30, 68(r4) ; restore R30
  294. + lwz r31, 72(r4) ; restore R31
  295. + lwz r1, 76(r4) ; restore SP
  296. +
  297. + lwz r0, 80(r4) ; load CR
  298. + mtcr r0 ; restore CR
  299. + lwz r0, 84(r4) ; load LR
  300. + mtlr r0 ; restore LR
  301. +
  302. + mr r3, r5 ; use third arg as return value after jump
  303. + ; and as first arg in context function
  304. +
  305. + lwz r0, 88(r4) ; load PC
  306. + mtctr r0 ; restore CTR
  307. +
  308. + bctr ; jump to context
  309. === added file 'libs/context/src/asm/jump_ppc64_sysv_macho_gas.S'
  310. --- libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  311. +++ libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 2014-01-03 17:54:53 +0000
  312. @@ -0,0 +1,193 @@
  313. +/*
  314. + Copyright Oliver Kowalke 2009.
  315. + Distributed under the Boost Software License, Version 1.0.
  316. + (See accompanying file LICENSE_1_0.txt or copy at
  317. + http://www.boost.org/LICENSE_1_0.txt)
  318. +*/
  319. +
  320. +/*******************************************************************
  321. + * *
  322. + * ------------------------------------------------------------- *
  323. + * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
  324. + * ------------------------------------------------------------- *
  325. + * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
  326. + * ------------------------------------------------------------- *
  327. + * | R13 | R14 | R15 | R16 | R17 | *
  328. + * ------------------------------------------------------------- *
  329. + * ------------------------------------------------------------- *
  330. + * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
  331. + * ------------------------------------------------------------- *
  332. + * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
  333. + * ------------------------------------------------------------- *
  334. + * | R18 | R19 | R20 | R21 | R22 | *
  335. + * ------------------------------------------------------------- *
  336. + * ------------------------------------------------------------- *
  337. + * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
  338. + * ------------------------------------------------------------- *
  339. + * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
  340. + * ------------------------------------------------------------- *
  341. + * | R23 | R24 | R25 | R26 | R27 | *
  342. + * ------------------------------------------------------------- *
  343. + * ------------------------------------------------------------- *
  344. + * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
  345. + * ------------------------------------------------------------- *
  346. + * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
  347. + * ------------------------------------------------------------- *
  348. + * | R28 | R29 | R30 | R31 | SP | *
  349. + * ------------------------------------------------------------- *
  350. + * ------------------------------------------------------------- *
  351. + * | 40 | 41 | 42 | 43 | 44 | 45 | | *
  352. + * ------------------------------------------------------------- *
  353. + * | 160 | 164 | 168 | 172 | 176 | 180 | | *
  354. + * ------------------------------------------------------------- *
  355. + * | CR | LR | PC | | *
  356. + * ------------------------------------------------------------- *
  357. + * ------------------------------------------------------------- *
  358. + * | 46 | 47 | 48 | 49 | | *
  359. + * ------------------------------------------------------------- *
  360. + * | 184 | 188 | 192 | 196 | | *
  361. + * ------------------------------------------------------------- *
  362. + * | sp | size | | *
  363. + * ------------------------------------------------------------- *
  364. + * ------------------------------------------------------------- *
  365. + * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
  366. + * ------------------------------------------------------------- *
  367. + * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
  368. + * ------------------------------------------------------------- *
  369. + * | F14 | F15 | F16 | F17 | F18 | *
  370. + * ------------------------------------------------------------- *
  371. + * ------------------------------------------------------------- *
  372. + * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
  373. + * ------------------------------------------------------------- *
  374. + * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
  375. + * ------------------------------------------------------------- *
  376. + * | F19 | F20 | F21 | F22 | F23 | *
  377. + * ------------------------------------------------------------- *
  378. + * ------------------------------------------------------------- *
  379. + * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
  380. + * ------------------------------------------------------------- *
  381. + * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
  382. + * ------------------------------------------------------------- *
  383. + * | F24 | F25 | F26 | F27 | F28 | *
  384. + * ------------------------------------------------------------- *
  385. + * ------------------------------------------------------------- *
  386. + * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
  387. + * ------------------------------------------------------------- *
  388. + * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
  389. + * ------------------------------------------------------------- *
  390. + * | F29 | F30 | F31 | fpscr | | *
  391. + * ------------------------------------------------------------- *
  392. + * *
  393. + * *****************************************************************/
  394. +
  395. +.text
  396. +.align 2
  397. +.globl jump_fcontext
  398. +
  399. +_jump_fcontext:
  400. + std r13, 0(r3) ; save R13
  401. + std r14, 8(r3) ; save R14
  402. + std r15, 16(r3) ; save R15
  403. + std r16, 24(r3) ; save R16
  404. + std r17, 32(r3) ; save R17
  405. + std r18, 40(r3) ; save R18
  406. + std r19, 48(r3) ; save R19
  407. + std r20, 56(r3) ; save R20
  408. + std r21, 64(r3) ; save R21
  409. + std r22, 72(r3) ; save R22
  410. + std r23, 80(r3) ; save R23
  411. + std r24, 88(r3) ; save R24
  412. + std r25, 96(r3) ; save R25
  413. + std r26, 104(r3) ; save R26
  414. + std r27, 112(r3) ; save R27
  415. + std r28, 120(r3) ; save R28
  416. + std r29, 128(r3) ; save R29
  417. + std r30, 136(r3) ; save R30
  418. + std r31, 144(r3) ; save R31
  419. + std r1, 152(r3) ; save SP
  420. +
  421. + mfcr r0 ; load CR
  422. + std r0, 160(r3) ; save CR
  423. + mflr r0 ; load LR
  424. + std r0, 168(r3) ; save LR
  425. + std r0, 176(r3) ; save LR as PC
  426. +
  427. + cmpwi cr7, r6, 0 ; test if fpu env should be preserved
  428. + beq cr7, l1
  429. +
  430. + stfd f14, 200(r3) ; save F14
  431. + stfd f15, 208(r3) ; save F15
  432. + stfd f16, 216(r3) ; save F16
  433. + stfd f17, 224(r3) ; save F17
  434. + stfd f18, 232(r3) ; save F18
  435. + stfd f19, 240(r3) ; save F19
  436. + stfd f20, 248(r3) ; save F20
  437. + stfd f21, 256(r3) ; save F21
  438. + stfd f22, 264(r3) ; save F22
  439. + stfd f23, 272(r3) ; save F23
  440. + stfd f24, 280(r3) ; save F24
  441. + stfd f25, 288(r3) ; save F25
  442. + stfd f26, 296(r3) ; save F26
  443. + stfd f27, 304(r3) ; save F27
  444. + stfd f28, 312(r3) ; save F28
  445. + stfd f29, 320(r3) ; save F29
  446. + stfd f30, 328(r3) ; save F30
  447. + stfd f31, 336(r3) ; save F31
  448. + mffs f0 ; load FPSCR
  449. + stfd f0, 344(r3) ; save FPSCR
  450. +
  451. + lfd f14, 200(r4) ; restore F14
  452. + lfd f15, 208(r4) ; restore F15
  453. + lfd f16, 216(r4) ; restore F16
  454. + lfd f17, 224(r4) ; restore F17
  455. + lfd f18, 232(r4) ; restore F18
  456. + lfd f19, 240(r4) ; restore F19
  457. + lfd f20, 248(r4) ; restore F20
  458. + lfd f21, 256(r4) ; restore F21
  459. + lfd f22, 264(r4) ; restore F22
  460. + lfd f23, 272(r4) ; restore F23
  461. + lfd f24, 280(r4) ; restore F24
  462. + lfd f25, 288(r4) ; restore F25
  463. + lfd f26, 296(r4) ; restore F26
  464. + lfd f27, 304(r4) ; restore F27
  465. + lfd f28, 312(r4) ; restore F28
  466. + lfd f29, 320(r4) ; restore F29
  467. + lfd f30, 328(r4) ; restore F30
  468. + lfd f31, 336(r4) ; restore F31
  469. + lfd f0, 344(r4) ; load FPSCR
  470. + mtfsf 0xff, f0 ; restore FPSCR
  471. +l1:
  472. +
  473. + ld r13, 0(r4) ; restore R13
  474. + ld r14, 8(r4) ; restore R14
  475. + ld r15, 16(r4) ; restore R15
  476. + ld r16, 24(r4) ; restore R16
  477. + ld r17, 32(r4) ; restore R17
  478. + ld r18, 40(r4) ; restore R18
  479. + ld r19, 48(r4) ; restore R19
  480. + ld r20, 56(r4) ; restore R20
  481. + ld r21, 64(r4) ; restore R21
  482. + ld r22, 72(r4) ; restore R22
  483. + ld r23, 80(r4) ; restore R23
  484. + ld r24, 88(r4) ; restore R24
  485. + ld r25, 96(r4) ; restore R25
  486. + ld r26, 104(r4) ; restore R26
  487. + ld r27, 112(r4) ; restore R27
  488. + ld r28, 120(r4) ; restore R28
  489. + ld r29, 128(r4) ; restore R29
  490. + ld r30, 136(r4) ; restore r30
  491. + ld r31, 144(r4) ; restore r31
  492. + ld r1, 152(r4) ; restore SP
  493. +
  494. + ld r0, 160(r4) ; load CR
  495. + mtcr r0 ; restore CR
  496. + ld r0, 168(r4) ; load LR
  497. + mtlr r0 ; restore LR
  498. +
  499. + mr r3, r5 ; use third arg as return value after jump
  500. + ; and as first arg in context function
  501. +
  502. + ld r0, 176(r4) ; load PC
  503. + mtctr r0 ; restore CTR
  504. +
  505. + bctr ; jump to context
  506. === added file 'libs/context/src/asm/make_combined_sysv_macho_gas.S'
  507. --- libs/context/src/asm/make_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  508. +++ libs/context/src/asm/make_combined_sysv_macho_gas.S 2014-01-03 17:50:32 +0000
  509. @@ -0,0 +1,20 @@
  510. +/*
  511. + Copyright Sergue E. Leontiev 2013.
  512. + Distributed under the Boost Software License, Version 1.0.
  513. + (See accompanying file LICENSE_1_0.txt or copy at
  514. + http://www.boost.org/LICENSE_1_0.txt)
  515. +*/
  516. +
  517. +// Stub file for universal binary
  518. +
  519. +#if defined(__i386__)
  520. + #include "make_i386_sysv_macho_gas.S"
  521. +#elif defined(__x86_64__)
  522. + #include "make_x86_64_sysv_macho_gas.S"
  523. +#elif defined(__ppc__)
  524. + #include "make_ppc32_sysv_macho_gas.S"
  525. +#elif defined(__ppc64__)
  526. + #include "make_ppc64_sysv_macho_gas.S"
  527. +#else
  528. + #error "No arch's"
  529. +#endif
  530. === added file 'libs/context/src/asm/make_ppc32_sysv_macho_gas.S'
  531. --- libs/context/src/asm/make_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  532. +++ libs/context/src/asm/make_ppc32_sysv_macho_gas.S 2014-01-02 21:27:23 +0000
  533. @@ -0,0 +1,109 @@
  534. +/*
  535. + Copyright Oliver Kowalke 2009.
  536. + Distributed under the Boost Software License, Version 1.0.
  537. + (See accompanying file LICENSE_1_0.txt or copy at
  538. + http://www.boost.org/LICENSE_1_0.txt)
  539. +*/
  540. +
  541. +/*******************************************************************
  542. + * *
  543. + * ------------------------------------------------------------- *
  544. + * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
  545. + * ------------------------------------------------------------- *
  546. + * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
  547. + * ------------------------------------------------------------- *
  548. + * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
  549. + * ------------------------------------------------------------- *
  550. + * ------------------------------------------------------------- *
  551. + * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
  552. + * ------------------------------------------------------------- *
  553. + * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
  554. + * ------------------------------------------------------------- *
  555. + * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
  556. + * ------------------------------------------------------------- *
  557. + * ------------------------------------------------------------- *
  558. + * | 20 | 21 | 22 | | *
  559. + * ------------------------------------------------------------- *
  560. + * | 80 | 84 | 88 | | *
  561. + * ------------------------------------------------------------- *
  562. + * | CR | LR | PC | | *
  563. + * ------------------------------------------------------------- *
  564. + * ------------------------------------------------------------- *
  565. + * | 23 | 24 | 25 | | *
  566. + * ------------------------------------------------------------- *
  567. + * | 92 | 96 | 100 | | *
  568. + * ------------------------------------------------------------- *
  569. + * | sp | size|<pad>| | *
  570. + * ------------------------------------------------------------- *
  571. + * ------------------------------------------------------------- *
  572. + * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
  573. + * ------------------------------------------------------------- *
  574. + * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
  575. + * ------------------------------------------------------------- *
  576. + * | F14 | F15 | F16 | F17 | F18 | *
  577. + * ------------------------------------------------------------- *
  578. + * ------------------------------------------------------------- *
  579. + * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
  580. + * ------------------------------------------------------------- *
  581. + * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
  582. + * ------------------------------------------------------------- *
  583. + * | F19 | F20 | F21 | F22 | F23 | *
  584. + * ------------------------------------------------------------- *
  585. + * ------------------------------------------------------------- *
  586. + * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
  587. + * ------------------------------------------------------------- *
  588. + * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
  589. + * ------------------------------------------------------------- *
  590. + * | F24 | F25 | F26 | F27 | F28 | *
  591. + * ------------------------------------------------------------- *
  592. + * ------------------------------------------------------------- *
  593. + * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
  594. + * ------------------------------------------------------------- *
  595. + * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
  596. + * ------------------------------------------------------------- *
  597. + * | F29 | F30 | F31 | fpscr | | *
  598. + * ------------------------------------------------------------- *
  599. + * *
  600. + * *****************************************************************/
  601. +
  602. +.text
  603. +.globl _make_fcontext
  604. +.align 2
  605. +_make_fcontext:
  606. + mflr r6 ; save return address into R6
  607. +
  608. + mr r0, r3
  609. + subi r3, r3, 256 ; reserve space for fcontext_t at top of context stack
  610. +
  611. + ; call align_stack, R3 contains address at 16 byte boundary after return
  612. + ; == pointer to fcontext_t and address of context stack
  613. + clrrwi r3, r3, 4
  614. +
  615. + stw r0, 92(r3) ; save address of context stack (base) in fcontext_t
  616. + stw r4, 96(r3) ; save context stack size in fcontext_t
  617. + stw r5, 88(r3) ; save address of context function in fcontext_t
  618. +
  619. + subi r0, r3, 64 ; reserve 64 bytes (linkage + parameter area), R4 % 16 == 0
  620. + stw r0, 76(r3) ; save address in R3 as stack pointer for context function
  621. +
  622. + mflr r0 ; load LR
  623. + bl l1 ; jump to label 1
  624. +l1:
  625. + mflr r4 ; load LR into R4
  626. + addi r4, r4, lo16((finish - .)+4) ; compute abs address of label finish
  627. + mtlr r0 ; restore LR
  628. + stw r4, 84(r3) ; save address of finish as return address for context function
  629. + ; entered after context function returns
  630. +
  631. + mtlr r6 ; restore return address from R6
  632. +
  633. + blr
  634. +
  635. +finish:
  636. + ; SP points to same address as SP on entry of context function
  637. + mflr r0 ; save return address into R0
  638. + stw r0, 4(r1) ; save return address on stack, set up stack frame
  639. + stwu r1, -16(r1) ; allocate stack space, SP % 16 == 0
  640. +
  641. + li r3, 0 ; exit code is zero
  642. + bl __exit ; exit application
  643. === added file 'libs/context/src/asm/make_ppc64_sysv_macho_gas.S'
  644. --- libs/context/src/asm/make_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
  645. +++ libs/context/src/asm/make_ppc64_sysv_macho_gas.S 2014-01-03 18:04:45 +0000
  646. @@ -0,0 +1,123 @@
  647. +/*
  648. + Copyright Oliver Kowalke 2009.
  649. + Distributed under the Boost Software License, Version 1.0.
  650. + (See accompanying file LICENSE_1_0.txt or copy at
  651. + http://www.boost.org/LICENSE_1_0.txt)
  652. +*/
  653. +
  654. +/*******************************************************************
  655. + * *
  656. + * ------------------------------------------------------------- *
  657. + * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
  658. + * ------------------------------------------------------------- *
  659. + * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
  660. + * ------------------------------------------------------------- *
  661. + * | R13 | R14 | R15 | R16 | R17 | *
  662. + * ------------------------------------------------------------- *
  663. + * ------------------------------------------------------------- *
  664. + * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
  665. + * ------------------------------------------------------------- *
  666. + * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
  667. + * ------------------------------------------------------------- *
  668. + * | R18 | R19 | R20 | R21 | R22 | *
  669. + * ------------------------------------------------------------- *
  670. + * ------------------------------------------------------------- *
  671. + * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
  672. + * ------------------------------------------------------------- *
  673. + * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
  674. + * ------------------------------------------------------------- *
  675. + * | R23 | R24 | R25 | R26 | R27 | *
  676. + * ------------------------------------------------------------- *
  677. + * ------------------------------------------------------------- *
  678. + * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
  679. + * ------------------------------------------------------------- *
  680. + * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
  681. + * ------------------------------------------------------------- *
  682. + * | R28 | R29 | R30 | R31 | SP | *
  683. + * ------------------------------------------------------------- *
  684. + * ------------------------------------------------------------- *
  685. + * | 40 | 41 | 42 | 43 | 44 | 45 | | *
  686. + * ------------------------------------------------------------- *
  687. + * | 160 | 164 | 168 | 172 | 176 | 180 | | *
  688. + * ------------------------------------------------------------- *
  689. + * | CR | LR | PC | | *
  690. + * ------------------------------------------------------------- *
  691. + * ------------------------------------------------------------- *
  692. + * | 46 | 47 | 48 | 49 | | *
  693. + * ------------------------------------------------------------- *
  694. + * | 184 | 188 | 192 | 196 | | *
  695. + * ------------------------------------------------------------- *
  696. + * | sp | size | | *
  697. + * ------------------------------------------------------------- *
  698. + * ------------------------------------------------------------- *
  699. + * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
  700. + * ------------------------------------------------------------- *
  701. + * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
  702. + * ------------------------------------------------------------- *
  703. + * | F14 | F15 | F16 | F17 | F18 | *
  704. + * ------------------------------------------------------------- *
  705. + * ------------------------------------------------------------- *
  706. + * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
  707. + * ------------------------------------------------------------- *
  708. + * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
  709. + * ------------------------------------------------------------- *
  710. + * | F19 | F20 | F21 | F22 | F23 | *
  711. + * ------------------------------------------------------------- *
  712. + * ------------------------------------------------------------- *
  713. + * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
  714. + * ------------------------------------------------------------- *
  715. + * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
  716. + * ------------------------------------------------------------- *
  717. + * | F24 | F25 | F26 | F27 | F28 | *
  718. + * ------------------------------------------------------------- *
  719. + * ------------------------------------------------------------- *
  720. + * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
  721. + * ------------------------------------------------------------- *
  722. + * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
  723. + * ------------------------------------------------------------- *
  724. + * | F29 | F30 | F31 | fpscr | | *
  725. + * ------------------------------------------------------------- *
  726. + * *
  727. + * *****************************************************************/
  728. +
  729. +.text
  730. +.globl _make_fcontext
  731. +_make_fcontext:
  732. + mflr r6 ; save return address into R6
  733. +
  734. + mr r0, r3
  735. + subi r3, r3, 352 ; reserve space for fcontext_t at top of context stack
  736. +
  737. + ; call align_stack, R3 contains address at 16 byte boundary after return
  738. + ; == pointer to fcontext_t and address of context stack
  739. + clrrdi r3, r3, 4
  740. +
  741. + std r0, 184(r3) ; save address of context stack (base) in fcontext_t
  742. + std r4, 192(r3) ; save context stack size in fcontext_t
  743. + std r5, 176(r3) ; save address of context function in fcontext_t
  744. +
  745. + subi r0, r3, 64 ; 64 bytes on stack for parameter area (== 8 registers)
  746. + std r0, 152(r3) ; save the stack base
  747. +
  748. + mflr r0 ; load LR
  749. + bl l1 ; jump to label 1
  750. +l1:
  751. + mflr r4 ; load LR into R4
  752. + addi r4, r4, lo16((finish - .) + 4) ; compute abs address of label finish
  753. + mtlr r0 ; restore LR
  754. + std r4, 168(r3) ; save address of finish as return address for context function
  755. + ; entered after context function returns
  756. +
  757. + mtlr r6 ; restore return address from R6
  758. +
  759. + blr
  760. +
  761. +finish:
  762. + ; SP points to same address as SP on entry of context function
  763. + mflr r0 ; save return address into R0
  764. + stw r0, 8(r1) ; save return address on stack, set up stack frame
  765. + stwu r1, -32(r1) ; allocate stack space, SP % 16 == 0
  766. +
  767. + li r3, 0 ; set return value to zero
  768. + bl __exit ; exit application
  769. + nop