setjmp.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* setjmp for ARM.
  2. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <features.h>
  16. #include <bits/arm_asm.h>
  17. .global __sigsetjmp
  18. .type __sigsetjmp,%function
  19. .align 2
  20. #if defined(THUMB1_ONLY)
  21. .thumb_func
  22. __sigsetjmp:
  23. push {r3, r4, r5, r6, r7, lr}
  24. mov ip, r0
  25. stmia r0!, {r4, r5, r6, r7}
  26. mov r2, r8
  27. mov r3, r9
  28. mov r4, sl
  29. mov r5, fp
  30. add r6, sp, #(6 * 4)
  31. mov r7, lr
  32. stmia r0!, {r2, r3, r4, r5, r6, r7}
  33. mov r0, ip
  34. bl __sigjmp_save
  35. pop {r3, r4, r5, r6, r7, pc}
  36. #else
  37. __sigsetjmp:
  38. /* Save registers */
  39. mov ip, r0
  40. #if defined(__thumb2__)
  41. stmia ip!, {v1-v6, sl, fp}
  42. mov r2, sp
  43. stmia ip!, {r2, lr}
  44. #else
  45. /* Save registers */
  46. stmia ip!, {v1-v6, sl, fp, sp, lr}
  47. #endif
  48. #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
  49. # ifdef __VFP_FP__
  50. /* Store the VFP registers. */
  51. /* Following instruction is fstmiax ip!, {d8-d15}. */
  52. stc p11, cr8, [r12], #68
  53. /* Store the floating-point status register. */
  54. /* Following instruction is fmrx r2, fpscr. */
  55. mrc p10, 7, r2, cr1, cr0, 0
  56. str r2, [ip], #4
  57. # elif defined __MAVERICK__
  58. cfstrd mvd4, [ip], #8 ; nop
  59. cfstrd mvd5, [ip], #8 ; nop
  60. cfstrd mvd6, [ip], #8 ; nop
  61. cfstrd mvd7, [ip], #8 ; nop
  62. cfstrd mvd8, [ip], #8 ; nop
  63. cfstrd mvd9, [ip], #8 ; nop
  64. cfstrd mvd10, [ip], #8 ; nop
  65. cfstrd mvd11, [ip], #8 ; nop
  66. cfstrd mvd12, [ip], #8 ; nop
  67. cfstrd mvd13, [ip], #8 ; nop
  68. cfstrd mvd14, [ip], #8 ; nop
  69. cfstrd mvd15, [ip], #8
  70. # else
  71. sfmea f4, 4, [ip]!
  72. # endif
  73. #endif
  74. #ifdef __IWMMXT__
  75. /* Save the call-preserved iWMMXt registers. */
  76. /* Following instructions are wstrd wr10, [ip], #8 (etc.) */
  77. stcl p1, cr10, [r12], #8
  78. stcl p1, cr11, [r12], #8
  79. stcl p1, cr12, [r12], #8
  80. stcl p1, cr13, [r12], #8
  81. stcl p1, cr14, [r12], #8
  82. stcl p1, cr15, [r12], #8
  83. #endif
  84. /* Make a tail call to __sigjmp_save; it takes the same args. */
  85. #ifdef __PIC__
  86. B __sigjmp_save(PLT)
  87. #else
  88. B __sigjmp_save
  89. #endif
  90. #endif
  91. .size __sigsetjmp,.-__sigsetjmp