Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Special support for eabi and SVR4
0003  *
0004  *   Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc.
0005  *   Copyright 2008 Freescale Semiconductor, Inc.
0006  *   Written By Michael Meissner
0007  *
0008  * Based on gcc/config/rs6000/crtsavres.asm from gcc
0009  * 64 bit additions from reading the PPC elf64abi document.
0010  *
0011  * This file is free software; you can redistribute it and/or modify it
0012  * under the terms of the GNU General Public License as published by the
0013  * Free Software Foundation; either version 2, or (at your option) any
0014  * later version.
0015  *
0016  * In addition to the permissions in the GNU General Public License, the
0017  * Free Software Foundation gives you unlimited permission to link the
0018  * compiled version of this file with other programs, and to distribute
0019  * those programs without any restriction coming from the use of this
0020  * file.  (The General Public License restrictions do apply in other
0021  * respects; for example, they cover modification of the file, and
0022  * distribution when not linked into another program.)
0023  *
0024  * This file is distributed in the hope that it will be useful, but
0025  * WITHOUT ANY WARRANTY; without even the implied warranty of
0026  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0027  * General Public License for more details.
0028  *
0029  * You should have received a copy of the GNU General Public License
0030  * along with this program; see the file COPYING.  If not, write to
0031  * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
0032  * Boston, MA 02110-1301, USA.
0033  *
0034  *    As a special exception, if you link this library with files
0035  *    compiled with GCC to produce an executable, this does not cause
0036  *    the resulting executable to be covered by the GNU General Public License.
0037  *    This exception does not however invalidate any other reasons why
0038  *    the executable file might be covered by the GNU General Public License.
0039  */
0040 
0041 #include <asm/ppc_asm.h>
0042 
0043     .file   "crtsavres.S"
0044 
0045 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
0046 
0047     .section ".text"
0048 
0049 #ifndef CONFIG_PPC64
0050 
0051 /* Routines for saving integer registers, called by the compiler.  */
0052 /* Called with r11 pointing to the stack header word of the caller of the */
0053 /* function, just beyond the end of the integer save area.  */
0054 
0055 _GLOBAL(_savegpr_14)
0056 _GLOBAL(_save32gpr_14)
0057     stw 14,-72(11)  /* save gp registers */
0058 _GLOBAL(_savegpr_15)
0059 _GLOBAL(_save32gpr_15)
0060     stw 15,-68(11)
0061 _GLOBAL(_savegpr_16)
0062 _GLOBAL(_save32gpr_16)
0063     stw 16,-64(11)
0064 _GLOBAL(_savegpr_17)
0065 _GLOBAL(_save32gpr_17)
0066     stw 17,-60(11)
0067 _GLOBAL(_savegpr_18)
0068 _GLOBAL(_save32gpr_18)
0069     stw 18,-56(11)
0070 _GLOBAL(_savegpr_19)
0071 _GLOBAL(_save32gpr_19)
0072     stw 19,-52(11)
0073 _GLOBAL(_savegpr_20)
0074 _GLOBAL(_save32gpr_20)
0075     stw 20,-48(11)
0076 _GLOBAL(_savegpr_21)
0077 _GLOBAL(_save32gpr_21)
0078     stw 21,-44(11)
0079 _GLOBAL(_savegpr_22)
0080 _GLOBAL(_save32gpr_22)
0081     stw 22,-40(11)
0082 _GLOBAL(_savegpr_23)
0083 _GLOBAL(_save32gpr_23)
0084     stw 23,-36(11)
0085 _GLOBAL(_savegpr_24)
0086 _GLOBAL(_save32gpr_24)
0087     stw 24,-32(11)
0088 _GLOBAL(_savegpr_25)
0089 _GLOBAL(_save32gpr_25)
0090     stw 25,-28(11)
0091 _GLOBAL(_savegpr_26)
0092 _GLOBAL(_save32gpr_26)
0093     stw 26,-24(11)
0094 _GLOBAL(_savegpr_27)
0095 _GLOBAL(_save32gpr_27)
0096     stw 27,-20(11)
0097 _GLOBAL(_savegpr_28)
0098 _GLOBAL(_save32gpr_28)
0099     stw 28,-16(11)
0100 _GLOBAL(_savegpr_29)
0101 _GLOBAL(_save32gpr_29)
0102     stw 29,-12(11)
0103 _GLOBAL(_savegpr_30)
0104 _GLOBAL(_save32gpr_30)
0105     stw 30,-8(11)
0106 _GLOBAL(_savegpr_31)
0107 _GLOBAL(_save32gpr_31)
0108     stw 31,-4(11)
0109     blr
0110 
0111 /* Routines for restoring integer registers, called by the compiler.  */
0112 /* Called with r11 pointing to the stack header word of the caller of the */
0113 /* function, just beyond the end of the integer restore area.  */
0114 
0115 _GLOBAL(_restgpr_14)
0116 _GLOBAL(_rest32gpr_14)
0117     lwz 14,-72(11)  /* restore gp registers */
0118 _GLOBAL(_restgpr_15)
0119 _GLOBAL(_rest32gpr_15)
0120     lwz 15,-68(11)
0121 _GLOBAL(_restgpr_16)
0122 _GLOBAL(_rest32gpr_16)
0123     lwz 16,-64(11)
0124 _GLOBAL(_restgpr_17)
0125 _GLOBAL(_rest32gpr_17)
0126     lwz 17,-60(11)
0127 _GLOBAL(_restgpr_18)
0128 _GLOBAL(_rest32gpr_18)
0129     lwz 18,-56(11)
0130 _GLOBAL(_restgpr_19)
0131 _GLOBAL(_rest32gpr_19)
0132     lwz 19,-52(11)
0133 _GLOBAL(_restgpr_20)
0134 _GLOBAL(_rest32gpr_20)
0135     lwz 20,-48(11)
0136 _GLOBAL(_restgpr_21)
0137 _GLOBAL(_rest32gpr_21)
0138     lwz 21,-44(11)
0139 _GLOBAL(_restgpr_22)
0140 _GLOBAL(_rest32gpr_22)
0141     lwz 22,-40(11)
0142 _GLOBAL(_restgpr_23)
0143 _GLOBAL(_rest32gpr_23)
0144     lwz 23,-36(11)
0145 _GLOBAL(_restgpr_24)
0146 _GLOBAL(_rest32gpr_24)
0147     lwz 24,-32(11)
0148 _GLOBAL(_restgpr_25)
0149 _GLOBAL(_rest32gpr_25)
0150     lwz 25,-28(11)
0151 _GLOBAL(_restgpr_26)
0152 _GLOBAL(_rest32gpr_26)
0153     lwz 26,-24(11)
0154 _GLOBAL(_restgpr_27)
0155 _GLOBAL(_rest32gpr_27)
0156     lwz 27,-20(11)
0157 _GLOBAL(_restgpr_28)
0158 _GLOBAL(_rest32gpr_28)
0159     lwz 28,-16(11)
0160 _GLOBAL(_restgpr_29)
0161 _GLOBAL(_rest32gpr_29)
0162     lwz 29,-12(11)
0163 _GLOBAL(_restgpr_30)
0164 _GLOBAL(_rest32gpr_30)
0165     lwz 30,-8(11)
0166 _GLOBAL(_restgpr_31)
0167 _GLOBAL(_rest32gpr_31)
0168     lwz 31,-4(11)
0169     blr
0170 
0171 /* Routines for restoring integer registers, called by the compiler.  */
0172 /* Called with r11 pointing to the stack header word of the caller of the */
0173 /* function, just beyond the end of the integer restore area.  */
0174 
0175 _GLOBAL(_restgpr_14_x)
0176 _GLOBAL(_rest32gpr_14_x)
0177     lwz 14,-72(11)  /* restore gp registers */
0178 _GLOBAL(_restgpr_15_x)
0179 _GLOBAL(_rest32gpr_15_x)
0180     lwz 15,-68(11)
0181 _GLOBAL(_restgpr_16_x)
0182 _GLOBAL(_rest32gpr_16_x)
0183     lwz 16,-64(11)
0184 _GLOBAL(_restgpr_17_x)
0185 _GLOBAL(_rest32gpr_17_x)
0186     lwz 17,-60(11)
0187 _GLOBAL(_restgpr_18_x)
0188 _GLOBAL(_rest32gpr_18_x)
0189     lwz 18,-56(11)
0190 _GLOBAL(_restgpr_19_x)
0191 _GLOBAL(_rest32gpr_19_x)
0192     lwz 19,-52(11)
0193 _GLOBAL(_restgpr_20_x)
0194 _GLOBAL(_rest32gpr_20_x)
0195     lwz 20,-48(11)
0196 _GLOBAL(_restgpr_21_x)
0197 _GLOBAL(_rest32gpr_21_x)
0198     lwz 21,-44(11)
0199 _GLOBAL(_restgpr_22_x)
0200 _GLOBAL(_rest32gpr_22_x)
0201     lwz 22,-40(11)
0202 _GLOBAL(_restgpr_23_x)
0203 _GLOBAL(_rest32gpr_23_x)
0204     lwz 23,-36(11)
0205 _GLOBAL(_restgpr_24_x)
0206 _GLOBAL(_rest32gpr_24_x)
0207     lwz 24,-32(11)
0208 _GLOBAL(_restgpr_25_x)
0209 _GLOBAL(_rest32gpr_25_x)
0210     lwz 25,-28(11)
0211 _GLOBAL(_restgpr_26_x)
0212 _GLOBAL(_rest32gpr_26_x)
0213     lwz 26,-24(11)
0214 _GLOBAL(_restgpr_27_x)
0215 _GLOBAL(_rest32gpr_27_x)
0216     lwz 27,-20(11)
0217 _GLOBAL(_restgpr_28_x)
0218 _GLOBAL(_rest32gpr_28_x)
0219     lwz 28,-16(11)
0220 _GLOBAL(_restgpr_29_x)
0221 _GLOBAL(_rest32gpr_29_x)
0222     lwz 29,-12(11)
0223 _GLOBAL(_restgpr_30_x)
0224 _GLOBAL(_rest32gpr_30_x)
0225     lwz 30,-8(11)
0226 _GLOBAL(_restgpr_31_x)
0227 _GLOBAL(_rest32gpr_31_x)
0228     lwz 0,4(11)
0229     lwz 31,-4(11)
0230     mtlr    0
0231     mr  1,11
0232     blr
0233 
0234 #ifdef CONFIG_ALTIVEC
0235 /* Called with r0 pointing just beyond the end of the vector save area.  */
0236 
0237 _GLOBAL(_savevr_20)
0238     li  r11,-192
0239     stvx    v20,r11,r0
0240 _GLOBAL(_savevr_21)
0241     li  r11,-176
0242     stvx    v21,r11,r0
0243 _GLOBAL(_savevr_22)
0244     li  r11,-160
0245     stvx    v22,r11,r0
0246 _GLOBAL(_savevr_23)
0247     li  r11,-144
0248     stvx    v23,r11,r0
0249 _GLOBAL(_savevr_24)
0250     li  r11,-128
0251     stvx    v24,r11,r0
0252 _GLOBAL(_savevr_25)
0253     li  r11,-112
0254     stvx    v25,r11,r0
0255 _GLOBAL(_savevr_26)
0256     li  r11,-96
0257     stvx    v26,r11,r0
0258 _GLOBAL(_savevr_27)
0259     li  r11,-80
0260     stvx    v27,r11,r0
0261 _GLOBAL(_savevr_28)
0262     li  r11,-64
0263     stvx    v28,r11,r0
0264 _GLOBAL(_savevr_29)
0265     li  r11,-48
0266     stvx    v29,r11,r0
0267 _GLOBAL(_savevr_30)
0268     li  r11,-32
0269     stvx    v30,r11,r0
0270 _GLOBAL(_savevr_31)
0271     li  r11,-16
0272     stvx    v31,r11,r0
0273     blr
0274 
0275 _GLOBAL(_restvr_20)
0276     li  r11,-192
0277     lvx v20,r11,r0
0278 _GLOBAL(_restvr_21)
0279     li  r11,-176
0280     lvx v21,r11,r0
0281 _GLOBAL(_restvr_22)
0282     li  r11,-160
0283     lvx v22,r11,r0
0284 _GLOBAL(_restvr_23)
0285     li  r11,-144
0286     lvx v23,r11,r0
0287 _GLOBAL(_restvr_24)
0288     li  r11,-128
0289     lvx v24,r11,r0
0290 _GLOBAL(_restvr_25)
0291     li  r11,-112
0292     lvx v25,r11,r0
0293 _GLOBAL(_restvr_26)
0294     li  r11,-96
0295     lvx v26,r11,r0
0296 _GLOBAL(_restvr_27)
0297     li  r11,-80
0298     lvx v27,r11,r0
0299 _GLOBAL(_restvr_28)
0300     li  r11,-64
0301     lvx v28,r11,r0
0302 _GLOBAL(_restvr_29)
0303     li  r11,-48
0304     lvx v29,r11,r0
0305 _GLOBAL(_restvr_30)
0306     li  r11,-32
0307     lvx v30,r11,r0
0308 _GLOBAL(_restvr_31)
0309     li  r11,-16
0310     lvx v31,r11,r0
0311     blr
0312 
0313 #endif /* CONFIG_ALTIVEC */
0314 
0315 #else /* CONFIG_PPC64 */
0316 
0317 .globl  _savegpr0_14
0318 _savegpr0_14:
0319     std r14,-144(r1)
0320 .globl  _savegpr0_15
0321 _savegpr0_15:
0322     std r15,-136(r1)
0323 .globl  _savegpr0_16
0324 _savegpr0_16:
0325     std r16,-128(r1)
0326 .globl  _savegpr0_17
0327 _savegpr0_17:
0328     std r17,-120(r1)
0329 .globl  _savegpr0_18
0330 _savegpr0_18:
0331     std r18,-112(r1)
0332 .globl  _savegpr0_19
0333 _savegpr0_19:
0334     std r19,-104(r1)
0335 .globl  _savegpr0_20
0336 _savegpr0_20:
0337     std r20,-96(r1)
0338 .globl  _savegpr0_21
0339 _savegpr0_21:
0340     std r21,-88(r1)
0341 .globl  _savegpr0_22
0342 _savegpr0_22:
0343     std r22,-80(r1)
0344 .globl  _savegpr0_23
0345 _savegpr0_23:
0346     std r23,-72(r1)
0347 .globl  _savegpr0_24
0348 _savegpr0_24:
0349     std r24,-64(r1)
0350 .globl  _savegpr0_25
0351 _savegpr0_25:
0352     std r25,-56(r1)
0353 .globl  _savegpr0_26
0354 _savegpr0_26:
0355     std r26,-48(r1)
0356 .globl  _savegpr0_27
0357 _savegpr0_27:
0358     std r27,-40(r1)
0359 .globl  _savegpr0_28
0360 _savegpr0_28:
0361     std r28,-32(r1)
0362 .globl  _savegpr0_29
0363 _savegpr0_29:
0364     std r29,-24(r1)
0365 .globl  _savegpr0_30
0366 _savegpr0_30:
0367     std r30,-16(r1)
0368 .globl  _savegpr0_31
0369 _savegpr0_31:
0370     std r31,-8(r1)
0371     std r0,16(r1)
0372     blr
0373 
0374 .globl  _restgpr0_14
0375 _restgpr0_14:
0376     ld  r14,-144(r1)
0377 .globl  _restgpr0_15
0378 _restgpr0_15:
0379     ld  r15,-136(r1)
0380 .globl  _restgpr0_16
0381 _restgpr0_16:
0382     ld  r16,-128(r1)
0383 .globl  _restgpr0_17
0384 _restgpr0_17:
0385     ld  r17,-120(r1)
0386 .globl  _restgpr0_18
0387 _restgpr0_18:
0388     ld  r18,-112(r1)
0389 .globl  _restgpr0_19
0390 _restgpr0_19:
0391     ld  r19,-104(r1)
0392 .globl  _restgpr0_20
0393 _restgpr0_20:
0394     ld  r20,-96(r1)
0395 .globl  _restgpr0_21
0396 _restgpr0_21:
0397     ld  r21,-88(r1)
0398 .globl  _restgpr0_22
0399 _restgpr0_22:
0400     ld  r22,-80(r1)
0401 .globl  _restgpr0_23
0402 _restgpr0_23:
0403     ld  r23,-72(r1)
0404 .globl  _restgpr0_24
0405 _restgpr0_24:
0406     ld  r24,-64(r1)
0407 .globl  _restgpr0_25
0408 _restgpr0_25:
0409     ld  r25,-56(r1)
0410 .globl  _restgpr0_26
0411 _restgpr0_26:
0412     ld  r26,-48(r1)
0413 .globl  _restgpr0_27
0414 _restgpr0_27:
0415     ld  r27,-40(r1)
0416 .globl  _restgpr0_28
0417 _restgpr0_28:
0418     ld  r28,-32(r1)
0419 .globl  _restgpr0_29
0420 _restgpr0_29:
0421     ld  r0,16(r1)
0422     ld  r29,-24(r1)
0423     mtlr    r0
0424     ld  r30,-16(r1)
0425     ld  r31,-8(r1)
0426     blr
0427 
0428 .globl  _restgpr0_30
0429 _restgpr0_30:
0430     ld  r30,-16(r1)
0431 .globl  _restgpr0_31
0432 _restgpr0_31:
0433     ld  r0,16(r1)
0434     ld  r31,-8(r1)
0435     mtlr    r0
0436     blr
0437 
0438 #ifdef CONFIG_ALTIVEC
0439 /* Called with r0 pointing just beyond the end of the vector save area.  */
0440 
0441 .globl  _savevr_20
0442 _savevr_20:
0443     li  r12,-192
0444     stvx    v20,r12,r0
0445 .globl  _savevr_21
0446 _savevr_21:
0447     li  r12,-176
0448     stvx    v21,r12,r0
0449 .globl  _savevr_22
0450 _savevr_22:
0451     li  r12,-160
0452     stvx    v22,r12,r0
0453 .globl  _savevr_23
0454 _savevr_23:
0455     li  r12,-144
0456     stvx    v23,r12,r0
0457 .globl  _savevr_24
0458 _savevr_24:
0459     li  r12,-128
0460     stvx    v24,r12,r0
0461 .globl  _savevr_25
0462 _savevr_25:
0463     li  r12,-112
0464     stvx    v25,r12,r0
0465 .globl  _savevr_26
0466 _savevr_26:
0467     li  r12,-96
0468     stvx    v26,r12,r0
0469 .globl  _savevr_27
0470 _savevr_27:
0471     li  r12,-80
0472     stvx    v27,r12,r0
0473 .globl  _savevr_28
0474 _savevr_28:
0475     li  r12,-64
0476     stvx    v28,r12,r0
0477 .globl  _savevr_29
0478 _savevr_29:
0479     li  r12,-48
0480     stvx    v29,r12,r0
0481 .globl  _savevr_30
0482 _savevr_30:
0483     li  r12,-32
0484     stvx    v30,r12,r0
0485 .globl  _savevr_31
0486 _savevr_31:
0487     li  r12,-16
0488     stvx    v31,r12,r0
0489     blr
0490 
0491 .globl  _restvr_20
0492 _restvr_20:
0493     li  r12,-192
0494     lvx v20,r12,r0
0495 .globl  _restvr_21
0496 _restvr_21:
0497     li  r12,-176
0498     lvx v21,r12,r0
0499 .globl  _restvr_22
0500 _restvr_22:
0501     li  r12,-160
0502     lvx v22,r12,r0
0503 .globl  _restvr_23
0504 _restvr_23:
0505     li  r12,-144
0506     lvx v23,r12,r0
0507 .globl  _restvr_24
0508 _restvr_24:
0509     li  r12,-128
0510     lvx v24,r12,r0
0511 .globl  _restvr_25
0512 _restvr_25:
0513     li  r12,-112
0514     lvx v25,r12,r0
0515 .globl  _restvr_26
0516 _restvr_26:
0517     li  r12,-96
0518     lvx v26,r12,r0
0519 .globl  _restvr_27
0520 _restvr_27:
0521     li  r12,-80
0522     lvx v27,r12,r0
0523 .globl  _restvr_28
0524 _restvr_28:
0525     li  r12,-64
0526     lvx v28,r12,r0
0527 .globl  _restvr_29
0528 _restvr_29:
0529     li  r12,-48
0530     lvx v29,r12,r0
0531 .globl  _restvr_30
0532 _restvr_30:
0533     li  r12,-32
0534     lvx v30,r12,r0
0535 .globl  _restvr_31
0536 _restvr_31:
0537     li  r12,-16
0538     lvx v31,r12,r0
0539     blr
0540 
0541 #endif /* CONFIG_ALTIVEC */
0542 
0543 #endif /* CONFIG_PPC64 */
0544 
0545 #endif