crtsavres.S 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. *
  10. * This file is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2, or (at your option) any
  13. * later version.
  14. *
  15. * In addition to the permissions in the GNU General Public License, the
  16. * Free Software Foundation gives you unlimited permission to link the
  17. * compiled version of this file with other programs, and to distribute
  18. * those programs without any restriction coming from the use of this
  19. * file. (The General Public License restrictions do apply in other
  20. * respects; for example, they cover modification of the file, and
  21. * distribution when not linked into another program.)
  22. *
  23. * This file is distributed in the hope that it will be useful, but
  24. * WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. * General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; see the file COPYING. If not, write to
  30. * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  31. * Boston, MA 02110-1301, USA.
  32. *
  33. * As a special exception, if you link this library with files
  34. * compiled with GCC to produce an executable, this does not cause
  35. * the resulting executable to be covered by the GNU General Public License.
  36. * This exception does not however invalidate any other reasons why
  37. * the executable file might be covered by the GNU General Public License.
  38. */
  39. .file "crtsavres.S"
  40. .section ".text"
  41. /* On PowerPC64 Linux, these functions are provided by the linker. */
  42. #ifndef __powerpc64__
  43. #define _GLOBAL(name) \
  44. .type name,@function; \
  45. .globl name; \
  46. name:
  47. /* Routines for saving integer registers, called by the compiler. */
  48. /* Called with r11 pointing to the stack header word of the caller of the */
  49. /* function, just beyond the end of the integer save area. */
  50. _GLOBAL(_savegpr_14)
  51. _GLOBAL(_save32gpr_14)
  52. stw 14,-72(11) /* save gp registers */
  53. _GLOBAL(_savegpr_15)
  54. _GLOBAL(_save32gpr_15)
  55. stw 15,-68(11)
  56. _GLOBAL(_savegpr_16)
  57. _GLOBAL(_save32gpr_16)
  58. stw 16,-64(11)
  59. _GLOBAL(_savegpr_17)
  60. _GLOBAL(_save32gpr_17)
  61. stw 17,-60(11)
  62. _GLOBAL(_savegpr_18)
  63. _GLOBAL(_save32gpr_18)
  64. stw 18,-56(11)
  65. _GLOBAL(_savegpr_19)
  66. _GLOBAL(_save32gpr_19)
  67. stw 19,-52(11)
  68. _GLOBAL(_savegpr_20)
  69. _GLOBAL(_save32gpr_20)
  70. stw 20,-48(11)
  71. _GLOBAL(_savegpr_21)
  72. _GLOBAL(_save32gpr_21)
  73. stw 21,-44(11)
  74. _GLOBAL(_savegpr_22)
  75. _GLOBAL(_save32gpr_22)
  76. stw 22,-40(11)
  77. _GLOBAL(_savegpr_23)
  78. _GLOBAL(_save32gpr_23)
  79. stw 23,-36(11)
  80. _GLOBAL(_savegpr_24)
  81. _GLOBAL(_save32gpr_24)
  82. stw 24,-32(11)
  83. _GLOBAL(_savegpr_25)
  84. _GLOBAL(_save32gpr_25)
  85. stw 25,-28(11)
  86. _GLOBAL(_savegpr_26)
  87. _GLOBAL(_save32gpr_26)
  88. stw 26,-24(11)
  89. _GLOBAL(_savegpr_27)
  90. _GLOBAL(_save32gpr_27)
  91. stw 27,-20(11)
  92. _GLOBAL(_savegpr_28)
  93. _GLOBAL(_save32gpr_28)
  94. stw 28,-16(11)
  95. _GLOBAL(_savegpr_29)
  96. _GLOBAL(_save32gpr_29)
  97. stw 29,-12(11)
  98. _GLOBAL(_savegpr_30)
  99. _GLOBAL(_save32gpr_30)
  100. stw 30,-8(11)
  101. _GLOBAL(_savegpr_31)
  102. _GLOBAL(_save32gpr_31)
  103. stw 31,-4(11)
  104. blr
  105. /* Routines for restoring integer registers, called by the compiler. */
  106. /* Called with r11 pointing to the stack header word of the caller of the */
  107. /* function, just beyond the end of the integer restore area. */
  108. _GLOBAL(_restgpr_14)
  109. _GLOBAL(_rest32gpr_14)
  110. lwz 14,-72(11) /* restore gp registers */
  111. _GLOBAL(_restgpr_15)
  112. _GLOBAL(_rest32gpr_15)
  113. lwz 15,-68(11)
  114. _GLOBAL(_restgpr_16)
  115. _GLOBAL(_rest32gpr_16)
  116. lwz 16,-64(11)
  117. _GLOBAL(_restgpr_17)
  118. _GLOBAL(_rest32gpr_17)
  119. lwz 17,-60(11)
  120. _GLOBAL(_restgpr_18)
  121. _GLOBAL(_rest32gpr_18)
  122. lwz 18,-56(11)
  123. _GLOBAL(_restgpr_19)
  124. _GLOBAL(_rest32gpr_19)
  125. lwz 19,-52(11)
  126. _GLOBAL(_restgpr_20)
  127. _GLOBAL(_rest32gpr_20)
  128. lwz 20,-48(11)
  129. _GLOBAL(_restgpr_21)
  130. _GLOBAL(_rest32gpr_21)
  131. lwz 21,-44(11)
  132. _GLOBAL(_restgpr_22)
  133. _GLOBAL(_rest32gpr_22)
  134. lwz 22,-40(11)
  135. _GLOBAL(_restgpr_23)
  136. _GLOBAL(_rest32gpr_23)
  137. lwz 23,-36(11)
  138. _GLOBAL(_restgpr_24)
  139. _GLOBAL(_rest32gpr_24)
  140. lwz 24,-32(11)
  141. _GLOBAL(_restgpr_25)
  142. _GLOBAL(_rest32gpr_25)
  143. lwz 25,-28(11)
  144. _GLOBAL(_restgpr_26)
  145. _GLOBAL(_rest32gpr_26)
  146. lwz 26,-24(11)
  147. _GLOBAL(_restgpr_27)
  148. _GLOBAL(_rest32gpr_27)
  149. lwz 27,-20(11)
  150. _GLOBAL(_restgpr_28)
  151. _GLOBAL(_rest32gpr_28)
  152. lwz 28,-16(11)
  153. _GLOBAL(_restgpr_29)
  154. _GLOBAL(_rest32gpr_29)
  155. lwz 29,-12(11)
  156. _GLOBAL(_restgpr_30)
  157. _GLOBAL(_rest32gpr_30)
  158. lwz 30,-8(11)
  159. _GLOBAL(_restgpr_31)
  160. _GLOBAL(_rest32gpr_31)
  161. lwz 31,-4(11)
  162. blr
  163. /* Routines for restoring integer registers, called by the compiler. */
  164. /* Called with r11 pointing to the stack header word of the caller of the */
  165. /* function, just beyond the end of the integer restore area. */
  166. _GLOBAL(_restgpr_14_x)
  167. _GLOBAL(_rest32gpr_14_x)
  168. lwz 14,-72(11) /* restore gp registers */
  169. _GLOBAL(_restgpr_15_x)
  170. _GLOBAL(_rest32gpr_15_x)
  171. lwz 15,-68(11)
  172. _GLOBAL(_restgpr_16_x)
  173. _GLOBAL(_rest32gpr_16_x)
  174. lwz 16,-64(11)
  175. _GLOBAL(_restgpr_17_x)
  176. _GLOBAL(_rest32gpr_17_x)
  177. lwz 17,-60(11)
  178. _GLOBAL(_restgpr_18_x)
  179. _GLOBAL(_rest32gpr_18_x)
  180. lwz 18,-56(11)
  181. _GLOBAL(_restgpr_19_x)
  182. _GLOBAL(_rest32gpr_19_x)
  183. lwz 19,-52(11)
  184. _GLOBAL(_restgpr_20_x)
  185. _GLOBAL(_rest32gpr_20_x)
  186. lwz 20,-48(11)
  187. _GLOBAL(_restgpr_21_x)
  188. _GLOBAL(_rest32gpr_21_x)
  189. lwz 21,-44(11)
  190. _GLOBAL(_restgpr_22_x)
  191. _GLOBAL(_rest32gpr_22_x)
  192. lwz 22,-40(11)
  193. _GLOBAL(_restgpr_23_x)
  194. _GLOBAL(_rest32gpr_23_x)
  195. lwz 23,-36(11)
  196. _GLOBAL(_restgpr_24_x)
  197. _GLOBAL(_rest32gpr_24_x)
  198. lwz 24,-32(11)
  199. _GLOBAL(_restgpr_25_x)
  200. _GLOBAL(_rest32gpr_25_x)
  201. lwz 25,-28(11)
  202. _GLOBAL(_restgpr_26_x)
  203. _GLOBAL(_rest32gpr_26_x)
  204. lwz 26,-24(11)
  205. _GLOBAL(_restgpr_27_x)
  206. _GLOBAL(_rest32gpr_27_x)
  207. lwz 27,-20(11)
  208. _GLOBAL(_restgpr_28_x)
  209. _GLOBAL(_rest32gpr_28_x)
  210. lwz 28,-16(11)
  211. _GLOBAL(_restgpr_29_x)
  212. _GLOBAL(_rest32gpr_29_x)
  213. lwz 29,-12(11)
  214. _GLOBAL(_restgpr_30_x)
  215. _GLOBAL(_rest32gpr_30_x)
  216. lwz 30,-8(11)
  217. _GLOBAL(_restgpr_31_x)
  218. _GLOBAL(_rest32gpr_31_x)
  219. lwz 0,4(11)
  220. lwz 31,-4(11)
  221. mtlr 0
  222. mr 1,11
  223. blr
  224. #endif