Kumar Gala | da3de6d | 2008-06-13 07:20:58 +1000 | [diff] [blame] | 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 |
Stephen Rothwell | 7fca5dc | 2010-06-29 20:08:42 +0000 | [diff] [blame] | 9 | * 64 bit additions from reading the PPC elf64abi document. |
Kumar Gala | da3de6d | 2008-06-13 07:20:58 +1000 | [diff] [blame] | 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 | |
| 41 | #include <asm/ppc_asm.h> |
| 42 | |
| 43 | .file "crtsavres.S" |
| 44 | .section ".text" |
| 45 | |
| 46 | #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
| 47 | |
Stephen Rothwell | 7fca5dc | 2010-06-29 20:08:42 +0000 | [diff] [blame] | 48 | #ifndef CONFIG_PPC64 |
| 49 | |
Kumar Gala | da3de6d | 2008-06-13 07:20:58 +1000 | [diff] [blame] | 50 | /* Routines for saving integer registers, called by the compiler. */ |
| 51 | /* Called with r11 pointing to the stack header word of the caller of the */ |
| 52 | /* function, just beyond the end of the integer save area. */ |
| 53 | |
| 54 | _GLOBAL(_savegpr_14) |
| 55 | _GLOBAL(_save32gpr_14) |
| 56 | stw 14,-72(11) /* save gp registers */ |
| 57 | _GLOBAL(_savegpr_15) |
| 58 | _GLOBAL(_save32gpr_15) |
| 59 | stw 15,-68(11) |
| 60 | _GLOBAL(_savegpr_16) |
| 61 | _GLOBAL(_save32gpr_16) |
| 62 | stw 16,-64(11) |
| 63 | _GLOBAL(_savegpr_17) |
| 64 | _GLOBAL(_save32gpr_17) |
| 65 | stw 17,-60(11) |
| 66 | _GLOBAL(_savegpr_18) |
| 67 | _GLOBAL(_save32gpr_18) |
| 68 | stw 18,-56(11) |
| 69 | _GLOBAL(_savegpr_19) |
| 70 | _GLOBAL(_save32gpr_19) |
| 71 | stw 19,-52(11) |
| 72 | _GLOBAL(_savegpr_20) |
| 73 | _GLOBAL(_save32gpr_20) |
| 74 | stw 20,-48(11) |
| 75 | _GLOBAL(_savegpr_21) |
| 76 | _GLOBAL(_save32gpr_21) |
| 77 | stw 21,-44(11) |
| 78 | _GLOBAL(_savegpr_22) |
| 79 | _GLOBAL(_save32gpr_22) |
| 80 | stw 22,-40(11) |
| 81 | _GLOBAL(_savegpr_23) |
| 82 | _GLOBAL(_save32gpr_23) |
| 83 | stw 23,-36(11) |
| 84 | _GLOBAL(_savegpr_24) |
| 85 | _GLOBAL(_save32gpr_24) |
| 86 | stw 24,-32(11) |
| 87 | _GLOBAL(_savegpr_25) |
| 88 | _GLOBAL(_save32gpr_25) |
| 89 | stw 25,-28(11) |
| 90 | _GLOBAL(_savegpr_26) |
| 91 | _GLOBAL(_save32gpr_26) |
| 92 | stw 26,-24(11) |
| 93 | _GLOBAL(_savegpr_27) |
| 94 | _GLOBAL(_save32gpr_27) |
| 95 | stw 27,-20(11) |
| 96 | _GLOBAL(_savegpr_28) |
| 97 | _GLOBAL(_save32gpr_28) |
| 98 | stw 28,-16(11) |
| 99 | _GLOBAL(_savegpr_29) |
| 100 | _GLOBAL(_save32gpr_29) |
| 101 | stw 29,-12(11) |
| 102 | _GLOBAL(_savegpr_30) |
| 103 | _GLOBAL(_save32gpr_30) |
| 104 | stw 30,-8(11) |
| 105 | _GLOBAL(_savegpr_31) |
| 106 | _GLOBAL(_save32gpr_31) |
| 107 | stw 31,-4(11) |
| 108 | blr |
| 109 | |
| 110 | /* Routines for restoring integer registers, called by the compiler. */ |
| 111 | /* Called with r11 pointing to the stack header word of the caller of the */ |
| 112 | /* function, just beyond the end of the integer restore area. */ |
| 113 | |
| 114 | _GLOBAL(_restgpr_14) |
| 115 | _GLOBAL(_rest32gpr_14) |
| 116 | lwz 14,-72(11) /* restore gp registers */ |
| 117 | _GLOBAL(_restgpr_15) |
| 118 | _GLOBAL(_rest32gpr_15) |
| 119 | lwz 15,-68(11) |
| 120 | _GLOBAL(_restgpr_16) |
| 121 | _GLOBAL(_rest32gpr_16) |
| 122 | lwz 16,-64(11) |
| 123 | _GLOBAL(_restgpr_17) |
| 124 | _GLOBAL(_rest32gpr_17) |
| 125 | lwz 17,-60(11) |
| 126 | _GLOBAL(_restgpr_18) |
| 127 | _GLOBAL(_rest32gpr_18) |
| 128 | lwz 18,-56(11) |
| 129 | _GLOBAL(_restgpr_19) |
| 130 | _GLOBAL(_rest32gpr_19) |
| 131 | lwz 19,-52(11) |
| 132 | _GLOBAL(_restgpr_20) |
| 133 | _GLOBAL(_rest32gpr_20) |
| 134 | lwz 20,-48(11) |
| 135 | _GLOBAL(_restgpr_21) |
| 136 | _GLOBAL(_rest32gpr_21) |
| 137 | lwz 21,-44(11) |
| 138 | _GLOBAL(_restgpr_22) |
| 139 | _GLOBAL(_rest32gpr_22) |
| 140 | lwz 22,-40(11) |
| 141 | _GLOBAL(_restgpr_23) |
| 142 | _GLOBAL(_rest32gpr_23) |
| 143 | lwz 23,-36(11) |
| 144 | _GLOBAL(_restgpr_24) |
| 145 | _GLOBAL(_rest32gpr_24) |
| 146 | lwz 24,-32(11) |
| 147 | _GLOBAL(_restgpr_25) |
| 148 | _GLOBAL(_rest32gpr_25) |
| 149 | lwz 25,-28(11) |
| 150 | _GLOBAL(_restgpr_26) |
| 151 | _GLOBAL(_rest32gpr_26) |
| 152 | lwz 26,-24(11) |
| 153 | _GLOBAL(_restgpr_27) |
| 154 | _GLOBAL(_rest32gpr_27) |
| 155 | lwz 27,-20(11) |
| 156 | _GLOBAL(_restgpr_28) |
| 157 | _GLOBAL(_rest32gpr_28) |
| 158 | lwz 28,-16(11) |
| 159 | _GLOBAL(_restgpr_29) |
| 160 | _GLOBAL(_rest32gpr_29) |
| 161 | lwz 29,-12(11) |
| 162 | _GLOBAL(_restgpr_30) |
| 163 | _GLOBAL(_rest32gpr_30) |
| 164 | lwz 30,-8(11) |
| 165 | _GLOBAL(_restgpr_31) |
| 166 | _GLOBAL(_rest32gpr_31) |
| 167 | lwz 31,-4(11) |
| 168 | blr |
| 169 | |
| 170 | /* Routines for restoring integer registers, called by the compiler. */ |
| 171 | /* Called with r11 pointing to the stack header word of the caller of the */ |
| 172 | /* function, just beyond the end of the integer restore area. */ |
| 173 | |
| 174 | _GLOBAL(_restgpr_14_x) |
| 175 | _GLOBAL(_rest32gpr_14_x) |
| 176 | lwz 14,-72(11) /* restore gp registers */ |
| 177 | _GLOBAL(_restgpr_15_x) |
| 178 | _GLOBAL(_rest32gpr_15_x) |
| 179 | lwz 15,-68(11) |
| 180 | _GLOBAL(_restgpr_16_x) |
| 181 | _GLOBAL(_rest32gpr_16_x) |
| 182 | lwz 16,-64(11) |
| 183 | _GLOBAL(_restgpr_17_x) |
| 184 | _GLOBAL(_rest32gpr_17_x) |
| 185 | lwz 17,-60(11) |
| 186 | _GLOBAL(_restgpr_18_x) |
| 187 | _GLOBAL(_rest32gpr_18_x) |
| 188 | lwz 18,-56(11) |
| 189 | _GLOBAL(_restgpr_19_x) |
| 190 | _GLOBAL(_rest32gpr_19_x) |
| 191 | lwz 19,-52(11) |
| 192 | _GLOBAL(_restgpr_20_x) |
| 193 | _GLOBAL(_rest32gpr_20_x) |
| 194 | lwz 20,-48(11) |
| 195 | _GLOBAL(_restgpr_21_x) |
| 196 | _GLOBAL(_rest32gpr_21_x) |
| 197 | lwz 21,-44(11) |
| 198 | _GLOBAL(_restgpr_22_x) |
| 199 | _GLOBAL(_rest32gpr_22_x) |
| 200 | lwz 22,-40(11) |
| 201 | _GLOBAL(_restgpr_23_x) |
| 202 | _GLOBAL(_rest32gpr_23_x) |
| 203 | lwz 23,-36(11) |
| 204 | _GLOBAL(_restgpr_24_x) |
| 205 | _GLOBAL(_rest32gpr_24_x) |
| 206 | lwz 24,-32(11) |
| 207 | _GLOBAL(_restgpr_25_x) |
| 208 | _GLOBAL(_rest32gpr_25_x) |
| 209 | lwz 25,-28(11) |
| 210 | _GLOBAL(_restgpr_26_x) |
| 211 | _GLOBAL(_rest32gpr_26_x) |
| 212 | lwz 26,-24(11) |
| 213 | _GLOBAL(_restgpr_27_x) |
| 214 | _GLOBAL(_rest32gpr_27_x) |
| 215 | lwz 27,-20(11) |
| 216 | _GLOBAL(_restgpr_28_x) |
| 217 | _GLOBAL(_rest32gpr_28_x) |
| 218 | lwz 28,-16(11) |
| 219 | _GLOBAL(_restgpr_29_x) |
| 220 | _GLOBAL(_rest32gpr_29_x) |
| 221 | lwz 29,-12(11) |
| 222 | _GLOBAL(_restgpr_30_x) |
| 223 | _GLOBAL(_rest32gpr_30_x) |
| 224 | lwz 30,-8(11) |
| 225 | _GLOBAL(_restgpr_31_x) |
| 226 | _GLOBAL(_rest32gpr_31_x) |
| 227 | lwz 0,4(11) |
| 228 | lwz 31,-4(11) |
| 229 | mtlr 0 |
| 230 | mr 1,11 |
| 231 | blr |
Stephen Rothwell | 7fca5dc | 2010-06-29 20:08:42 +0000 | [diff] [blame] | 232 | |
| 233 | #else /* CONFIG_PPC64 */ |
| 234 | |
| 235 | .globl _savegpr0_14 |
| 236 | _savegpr0_14: |
| 237 | std r14,-144(r1) |
| 238 | .globl _savegpr0_15 |
| 239 | _savegpr0_15: |
| 240 | std r15,-136(r1) |
| 241 | .globl _savegpr0_16 |
| 242 | _savegpr0_16: |
| 243 | std r16,-128(r1) |
| 244 | .globl _savegpr0_17 |
| 245 | _savegpr0_17: |
| 246 | std r17,-120(r1) |
| 247 | .globl _savegpr0_18 |
| 248 | _savegpr0_18: |
| 249 | std r18,-112(r1) |
| 250 | .globl _savegpr0_19 |
| 251 | _savegpr0_19: |
| 252 | std r19,-104(r1) |
| 253 | .globl _savegpr0_20 |
| 254 | _savegpr0_20: |
| 255 | std r20,-96(r1) |
| 256 | .globl _savegpr0_21 |
| 257 | _savegpr0_21: |
| 258 | std r21,-88(r1) |
| 259 | .globl _savegpr0_22 |
| 260 | _savegpr0_22: |
| 261 | std r22,-80(r1) |
| 262 | .globl _savegpr0_23 |
| 263 | _savegpr0_23: |
| 264 | std r23,-72(r1) |
| 265 | .globl _savegpr0_24 |
| 266 | _savegpr0_24: |
| 267 | std r24,-64(r1) |
| 268 | .globl _savegpr0_25 |
| 269 | _savegpr0_25: |
| 270 | std r25,-56(r1) |
| 271 | .globl _savegpr0_26 |
| 272 | _savegpr0_26: |
| 273 | std r26,-48(r1) |
| 274 | .globl _savegpr0_27 |
| 275 | _savegpr0_27: |
| 276 | std r27,-40(r1) |
| 277 | .globl _savegpr0_28 |
| 278 | _savegpr0_28: |
| 279 | std r28,-32(r1) |
| 280 | .globl _savegpr0_29 |
| 281 | _savegpr0_29: |
| 282 | std r29,-24(r1) |
| 283 | .globl _savegpr0_30 |
| 284 | _savegpr0_30: |
| 285 | std r30,-16(r1) |
| 286 | .globl _savegpr0_31 |
| 287 | _savegpr0_31: |
| 288 | std r31,-8(r1) |
| 289 | std r0,16(r1) |
| 290 | blr |
| 291 | |
| 292 | .globl _restgpr0_14 |
| 293 | _restgpr0_14: |
| 294 | ld r14,-144(r1) |
| 295 | .globl _restgpr0_15 |
| 296 | _restgpr0_15: |
| 297 | ld r15,-136(r1) |
| 298 | .globl _restgpr0_16 |
| 299 | _restgpr0_16: |
| 300 | ld r16,-128(r1) |
| 301 | .globl _restgpr0_17 |
| 302 | _restgpr0_17: |
| 303 | ld r17,-120(r1) |
| 304 | .globl _restgpr0_18 |
| 305 | _restgpr0_18: |
| 306 | ld r18,-112(r1) |
| 307 | .globl _restgpr0_19 |
| 308 | _restgpr0_19: |
| 309 | ld r19,-104(r1) |
| 310 | .globl _restgpr0_20 |
| 311 | _restgpr0_20: |
| 312 | ld r20,-96(r1) |
| 313 | .globl _restgpr0_21 |
| 314 | _restgpr0_21: |
| 315 | ld r21,-88(r1) |
| 316 | .globl _restgpr0_22 |
| 317 | _restgpr0_22: |
| 318 | ld r22,-80(r1) |
| 319 | .globl _restgpr0_23 |
| 320 | _restgpr0_23: |
| 321 | ld r23,-72(r1) |
| 322 | .globl _restgpr0_24 |
| 323 | _restgpr0_24: |
| 324 | ld r24,-64(r1) |
| 325 | .globl _restgpr0_25 |
| 326 | _restgpr0_25: |
| 327 | ld r25,-56(r1) |
| 328 | .globl _restgpr0_26 |
| 329 | _restgpr0_26: |
| 330 | ld r26,-48(r1) |
| 331 | .globl _restgpr0_27 |
| 332 | _restgpr0_27: |
| 333 | ld r27,-40(r1) |
| 334 | .globl _restgpr0_28 |
| 335 | _restgpr0_28: |
| 336 | ld r28,-32(r1) |
| 337 | .globl _restgpr0_29 |
| 338 | _restgpr0_29: |
| 339 | ld r0,16(r1) |
| 340 | ld r29,-24(r1) |
| 341 | mtlr r0 |
| 342 | ld r30,-16(r1) |
| 343 | ld r31,-8(r1) |
| 344 | blr |
| 345 | |
| 346 | .globl _restgpr0_30 |
| 347 | _restgpr0_30: |
| 348 | ld r30,-16(r1) |
| 349 | .globl _restgpr0_31 |
| 350 | _restgpr0_31: |
| 351 | ld r0,16(r1) |
| 352 | ld r31,-8(r1) |
| 353 | mtlr r0 |
| 354 | blr |
| 355 | |
| 356 | #endif /* CONFIG_PPC64 */ |
| 357 | |
Kumar Gala | da3de6d | 2008-06-13 07:20:58 +1000 | [diff] [blame] | 358 | #endif |