crtsavres.S 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. .section ".text"
  43. #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  44. #ifndef CONFIG_PPC64
  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. .globl _savegpr0_14
  224. _savegpr0_14:
  225. std r14,-144(r1)
  226. .globl _savegpr0_15
  227. _savegpr0_15:
  228. std r15,-136(r1)
  229. .globl _savegpr0_16
  230. _savegpr0_16:
  231. std r16,-128(r1)
  232. .globl _savegpr0_17
  233. _savegpr0_17:
  234. std r17,-120(r1)
  235. .globl _savegpr0_18
  236. _savegpr0_18:
  237. std r18,-112(r1)
  238. .globl _savegpr0_19
  239. _savegpr0_19:
  240. std r19,-104(r1)
  241. .globl _savegpr0_20
  242. _savegpr0_20:
  243. std r20,-96(r1)
  244. .globl _savegpr0_21
  245. _savegpr0_21:
  246. std r21,-88(r1)
  247. .globl _savegpr0_22
  248. _savegpr0_22:
  249. std r22,-80(r1)
  250. .globl _savegpr0_23
  251. _savegpr0_23:
  252. std r23,-72(r1)
  253. .globl _savegpr0_24
  254. _savegpr0_24:
  255. std r24,-64(r1)
  256. .globl _savegpr0_25
  257. _savegpr0_25:
  258. std r25,-56(r1)
  259. .globl _savegpr0_26
  260. _savegpr0_26:
  261. std r26,-48(r1)
  262. .globl _savegpr0_27
  263. _savegpr0_27:
  264. std r27,-40(r1)
  265. .globl _savegpr0_28
  266. _savegpr0_28:
  267. std r28,-32(r1)
  268. .globl _savegpr0_29
  269. _savegpr0_29:
  270. std r29,-24(r1)
  271. .globl _savegpr0_30
  272. _savegpr0_30:
  273. std r30,-16(r1)
  274. .globl _savegpr0_31
  275. _savegpr0_31:
  276. std r31,-8(r1)
  277. std r0,16(r1)
  278. blr
  279. .globl _restgpr0_14
  280. _restgpr0_14:
  281. ld r14,-144(r1)
  282. .globl _restgpr0_15
  283. _restgpr0_15:
  284. ld r15,-136(r1)
  285. .globl _restgpr0_16
  286. _restgpr0_16:
  287. ld r16,-128(r1)
  288. .globl _restgpr0_17
  289. _restgpr0_17:
  290. ld r17,-120(r1)
  291. .globl _restgpr0_18
  292. _restgpr0_18:
  293. ld r18,-112(r1)
  294. .globl _restgpr0_19
  295. _restgpr0_19:
  296. ld r19,-104(r1)
  297. .globl _restgpr0_20
  298. _restgpr0_20:
  299. ld r20,-96(r1)
  300. .globl _restgpr0_21
  301. _restgpr0_21:
  302. ld r21,-88(r1)
  303. .globl _restgpr0_22
  304. _restgpr0_22:
  305. ld r22,-80(r1)
  306. .globl _restgpr0_23
  307. _restgpr0_23:
  308. ld r23,-72(r1)
  309. .globl _restgpr0_24
  310. _restgpr0_24:
  311. ld r24,-64(r1)
  312. .globl _restgpr0_25
  313. _restgpr0_25:
  314. ld r25,-56(r1)
  315. .globl _restgpr0_26
  316. _restgpr0_26:
  317. ld r26,-48(r1)
  318. .globl _restgpr0_27
  319. _restgpr0_27:
  320. ld r27,-40(r1)
  321. .globl _restgpr0_28
  322. _restgpr0_28:
  323. ld r28,-32(r1)
  324. .globl _restgpr0_29
  325. _restgpr0_29:
  326. ld r0,16(r1)
  327. ld r29,-24(r1)
  328. mtlr r0
  329. ld r30,-16(r1)
  330. ld r31,-8(r1)
  331. blr
  332. .globl _restgpr0_30
  333. _restgpr0_30:
  334. ld r30,-16(r1)
  335. .globl _restgpr0_31
  336. _restgpr0_31:
  337. ld r0,16(r1)
  338. ld r31,-8(r1)
  339. mtlr r0
  340. blr
  341. #endif /* CONFIG_PPC64 */
  342. #endif