crtsavres.S 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. /*
  2. * Special support for eabi and SVR4
  3. *
  4. * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
  5. * Copyright 2008 Freescale Semiconductor, Inc.
  6. * Written By Michael Meissner
  7. *
  8. * Based on gcc/config/rs6000/crtsavres.asm from gcc
  9. * 64 bit additions from reading the PPC elf64abi document.
  10. *
  11. * This file is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2, or (at your option) any
  14. * later version.
  15. *
  16. * In addition to the permissions in the GNU General Public License, the
  17. * Free Software Foundation gives you unlimited permission to link the
  18. * compiled version of this file with other programs, and to distribute
  19. * those programs without any restriction coming from the use of this
  20. * file. (The General Public License restrictions do apply in other
  21. * respects; for example, they cover modification of the file, and
  22. * distribution when not linked into another program.)
  23. *
  24. * This file is distributed in the hope that it will be useful, but
  25. * WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  27. * General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU General Public License
  30. * along with this program; see the file COPYING. If not, write to
  31. * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  32. * Boston, MA 02110-1301, USA.
  33. *
  34. * As a special exception, if you link this library with files
  35. * compiled with GCC to produce an executable, this does not cause
  36. * the resulting executable to be covered by the GNU General Public License.
  37. * This exception does not however invalidate any other reasons why
  38. * the executable file might be covered by the GNU General Public License.
  39. */
  40. #include <asm/ppc_asm.h>
  41. .file "crtsavres.S"
  42. #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  43. #ifndef CONFIG_PPC64
  44. .section ".text"
  45. /* Routines for saving integer registers, called by the compiler. */
  46. /* Called with r11 pointing to the stack header word of the caller of the */
  47. /* function, just beyond the end of the integer save area. */
  48. _GLOBAL(_savegpr_14)
  49. _GLOBAL(_save32gpr_14)
  50. stw 14,-72(11) /* save gp registers */
  51. _GLOBAL(_savegpr_15)
  52. _GLOBAL(_save32gpr_15)
  53. stw 15,-68(11)
  54. _GLOBAL(_savegpr_16)
  55. _GLOBAL(_save32gpr_16)
  56. stw 16,-64(11)
  57. _GLOBAL(_savegpr_17)
  58. _GLOBAL(_save32gpr_17)
  59. stw 17,-60(11)
  60. _GLOBAL(_savegpr_18)
  61. _GLOBAL(_save32gpr_18)
  62. stw 18,-56(11)
  63. _GLOBAL(_savegpr_19)
  64. _GLOBAL(_save32gpr_19)
  65. stw 19,-52(11)
  66. _GLOBAL(_savegpr_20)
  67. _GLOBAL(_save32gpr_20)
  68. stw 20,-48(11)
  69. _GLOBAL(_savegpr_21)
  70. _GLOBAL(_save32gpr_21)
  71. stw 21,-44(11)
  72. _GLOBAL(_savegpr_22)
  73. _GLOBAL(_save32gpr_22)
  74. stw 22,-40(11)
  75. _GLOBAL(_savegpr_23)
  76. _GLOBAL(_save32gpr_23)
  77. stw 23,-36(11)
  78. _GLOBAL(_savegpr_24)
  79. _GLOBAL(_save32gpr_24)
  80. stw 24,-32(11)
  81. _GLOBAL(_savegpr_25)
  82. _GLOBAL(_save32gpr_25)
  83. stw 25,-28(11)
  84. _GLOBAL(_savegpr_26)
  85. _GLOBAL(_save32gpr_26)
  86. stw 26,-24(11)
  87. _GLOBAL(_savegpr_27)
  88. _GLOBAL(_save32gpr_27)
  89. stw 27,-20(11)
  90. _GLOBAL(_savegpr_28)
  91. _GLOBAL(_save32gpr_28)
  92. stw 28,-16(11)
  93. _GLOBAL(_savegpr_29)
  94. _GLOBAL(_save32gpr_29)
  95. stw 29,-12(11)
  96. _GLOBAL(_savegpr_30)
  97. _GLOBAL(_save32gpr_30)
  98. stw 30,-8(11)
  99. _GLOBAL(_savegpr_31)
  100. _GLOBAL(_save32gpr_31)
  101. stw 31,-4(11)
  102. blr
  103. /* Routines for restoring integer registers, called by the compiler. */
  104. /* Called with r11 pointing to the stack header word of the caller of the */
  105. /* function, just beyond the end of the integer restore area. */
  106. _GLOBAL(_restgpr_14)
  107. _GLOBAL(_rest32gpr_14)
  108. lwz 14,-72(11) /* restore gp registers */
  109. _GLOBAL(_restgpr_15)
  110. _GLOBAL(_rest32gpr_15)
  111. lwz 15,-68(11)
  112. _GLOBAL(_restgpr_16)
  113. _GLOBAL(_rest32gpr_16)
  114. lwz 16,-64(11)
  115. _GLOBAL(_restgpr_17)
  116. _GLOBAL(_rest32gpr_17)
  117. lwz 17,-60(11)
  118. _GLOBAL(_restgpr_18)
  119. _GLOBAL(_rest32gpr_18)
  120. lwz 18,-56(11)
  121. _GLOBAL(_restgpr_19)
  122. _GLOBAL(_rest32gpr_19)
  123. lwz 19,-52(11)
  124. _GLOBAL(_restgpr_20)
  125. _GLOBAL(_rest32gpr_20)
  126. lwz 20,-48(11)
  127. _GLOBAL(_restgpr_21)
  128. _GLOBAL(_rest32gpr_21)
  129. lwz 21,-44(11)
  130. _GLOBAL(_restgpr_22)
  131. _GLOBAL(_rest32gpr_22)
  132. lwz 22,-40(11)
  133. _GLOBAL(_restgpr_23)
  134. _GLOBAL(_rest32gpr_23)
  135. lwz 23,-36(11)
  136. _GLOBAL(_restgpr_24)
  137. _GLOBAL(_rest32gpr_24)
  138. lwz 24,-32(11)
  139. _GLOBAL(_restgpr_25)
  140. _GLOBAL(_rest32gpr_25)
  141. lwz 25,-28(11)
  142. _GLOBAL(_restgpr_26)
  143. _GLOBAL(_rest32gpr_26)
  144. lwz 26,-24(11)
  145. _GLOBAL(_restgpr_27)
  146. _GLOBAL(_rest32gpr_27)
  147. lwz 27,-20(11)
  148. _GLOBAL(_restgpr_28)
  149. _GLOBAL(_rest32gpr_28)
  150. lwz 28,-16(11)
  151. _GLOBAL(_restgpr_29)
  152. _GLOBAL(_rest32gpr_29)
  153. lwz 29,-12(11)
  154. _GLOBAL(_restgpr_30)
  155. _GLOBAL(_rest32gpr_30)
  156. lwz 30,-8(11)
  157. _GLOBAL(_restgpr_31)
  158. _GLOBAL(_rest32gpr_31)
  159. lwz 31,-4(11)
  160. blr
  161. /* Routines for restoring integer registers, called by the compiler. */
  162. /* Called with r11 pointing to the stack header word of the caller of the */
  163. /* function, just beyond the end of the integer restore area. */
  164. _GLOBAL(_restgpr_14_x)
  165. _GLOBAL(_rest32gpr_14_x)
  166. lwz 14,-72(11) /* restore gp registers */
  167. _GLOBAL(_restgpr_15_x)
  168. _GLOBAL(_rest32gpr_15_x)
  169. lwz 15,-68(11)
  170. _GLOBAL(_restgpr_16_x)
  171. _GLOBAL(_rest32gpr_16_x)
  172. lwz 16,-64(11)
  173. _GLOBAL(_restgpr_17_x)
  174. _GLOBAL(_rest32gpr_17_x)
  175. lwz 17,-60(11)
  176. _GLOBAL(_restgpr_18_x)
  177. _GLOBAL(_rest32gpr_18_x)
  178. lwz 18,-56(11)
  179. _GLOBAL(_restgpr_19_x)
  180. _GLOBAL(_rest32gpr_19_x)
  181. lwz 19,-52(11)
  182. _GLOBAL(_restgpr_20_x)
  183. _GLOBAL(_rest32gpr_20_x)
  184. lwz 20,-48(11)
  185. _GLOBAL(_restgpr_21_x)
  186. _GLOBAL(_rest32gpr_21_x)
  187. lwz 21,-44(11)
  188. _GLOBAL(_restgpr_22_x)
  189. _GLOBAL(_rest32gpr_22_x)
  190. lwz 22,-40(11)
  191. _GLOBAL(_restgpr_23_x)
  192. _GLOBAL(_rest32gpr_23_x)
  193. lwz 23,-36(11)
  194. _GLOBAL(_restgpr_24_x)
  195. _GLOBAL(_rest32gpr_24_x)
  196. lwz 24,-32(11)
  197. _GLOBAL(_restgpr_25_x)
  198. _GLOBAL(_rest32gpr_25_x)
  199. lwz 25,-28(11)
  200. _GLOBAL(_restgpr_26_x)
  201. _GLOBAL(_rest32gpr_26_x)
  202. lwz 26,-24(11)
  203. _GLOBAL(_restgpr_27_x)
  204. _GLOBAL(_rest32gpr_27_x)
  205. lwz 27,-20(11)
  206. _GLOBAL(_restgpr_28_x)
  207. _GLOBAL(_rest32gpr_28_x)
  208. lwz 28,-16(11)
  209. _GLOBAL(_restgpr_29_x)
  210. _GLOBAL(_rest32gpr_29_x)
  211. lwz 29,-12(11)
  212. _GLOBAL(_restgpr_30_x)
  213. _GLOBAL(_rest32gpr_30_x)
  214. lwz 30,-8(11)
  215. _GLOBAL(_restgpr_31_x)
  216. _GLOBAL(_rest32gpr_31_x)
  217. lwz 0,4(11)
  218. lwz 31,-4(11)
  219. mtlr 0
  220. mr 1,11
  221. blr
  222. #else /* CONFIG_PPC64 */
  223. .section ".text.save.restore","ax",@progbits
  224. .globl _savegpr0_14
  225. _savegpr0_14:
  226. std r14,-144(r1)
  227. .globl _savegpr0_15
  228. _savegpr0_15:
  229. std r15,-136(r1)
  230. .globl _savegpr0_16
  231. _savegpr0_16:
  232. std r16,-128(r1)
  233. .globl _savegpr0_17
  234. _savegpr0_17:
  235. std r17,-120(r1)
  236. .globl _savegpr0_18
  237. _savegpr0_18:
  238. std r18,-112(r1)
  239. .globl _savegpr0_19
  240. _savegpr0_19:
  241. std r19,-104(r1)
  242. .globl _savegpr0_20
  243. _savegpr0_20:
  244. std r20,-96(r1)
  245. .globl _savegpr0_21
  246. _savegpr0_21:
  247. std r21,-88(r1)
  248. .globl _savegpr0_22
  249. _savegpr0_22:
  250. std r22,-80(r1)
  251. .globl _savegpr0_23
  252. _savegpr0_23:
  253. std r23,-72(r1)
  254. .globl _savegpr0_24
  255. _savegpr0_24:
  256. std r24,-64(r1)
  257. .globl _savegpr0_25
  258. _savegpr0_25:
  259. std r25,-56(r1)
  260. .globl _savegpr0_26
  261. _savegpr0_26:
  262. std r26,-48(r1)
  263. .globl _savegpr0_27
  264. _savegpr0_27:
  265. std r27,-40(r1)
  266. .globl _savegpr0_28
  267. _savegpr0_28:
  268. std r28,-32(r1)
  269. .globl _savegpr0_29
  270. _savegpr0_29:
  271. std r29,-24(r1)
  272. .globl _savegpr0_30
  273. _savegpr0_30:
  274. std r30,-16(r1)
  275. .globl _savegpr0_31
  276. _savegpr0_31:
  277. std r31,-8(r1)
  278. std r0,16(r1)
  279. blr
  280. .globl _restgpr0_14
  281. _restgpr0_14:
  282. ld r14,-144(r1)
  283. .globl _restgpr0_15
  284. _restgpr0_15:
  285. ld r15,-136(r1)
  286. .globl _restgpr0_16
  287. _restgpr0_16:
  288. ld r16,-128(r1)
  289. .globl _restgpr0_17
  290. _restgpr0_17:
  291. ld r17,-120(r1)
  292. .globl _restgpr0_18
  293. _restgpr0_18:
  294. ld r18,-112(r1)
  295. .globl _restgpr0_19
  296. _restgpr0_19:
  297. ld r19,-104(r1)
  298. .globl _restgpr0_20
  299. _restgpr0_20:
  300. ld r20,-96(r1)
  301. .globl _restgpr0_21
  302. _restgpr0_21:
  303. ld r21,-88(r1)
  304. .globl _restgpr0_22
  305. _restgpr0_22:
  306. ld r22,-80(r1)
  307. .globl _restgpr0_23
  308. _restgpr0_23:
  309. ld r23,-72(r1)
  310. .globl _restgpr0_24
  311. _restgpr0_24:
  312. ld r24,-64(r1)
  313. .globl _restgpr0_25
  314. _restgpr0_25:
  315. ld r25,-56(r1)
  316. .globl _restgpr0_26
  317. _restgpr0_26:
  318. ld r26,-48(r1)
  319. .globl _restgpr0_27
  320. _restgpr0_27:
  321. ld r27,-40(r1)
  322. .globl _restgpr0_28
  323. _restgpr0_28:
  324. ld r28,-32(r1)
  325. .globl _restgpr0_29
  326. _restgpr0_29:
  327. ld r0,16(r1)
  328. ld r29,-24(r1)
  329. mtlr r0
  330. ld r30,-16(r1)
  331. ld r31,-8(r1)
  332. blr
  333. .globl _restgpr0_30
  334. _restgpr0_30:
  335. ld r30,-16(r1)
  336. .globl _restgpr0_31
  337. _restgpr0_31:
  338. ld r0,16(r1)
  339. ld r31,-8(r1)
  340. mtlr r0
  341. blr
  342. #endif /* CONFIG_PPC64 */
  343. #endif