setjmp.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #include <features.h>
  17. #include <bits/arm_asm.h>
  18. .global __sigsetjmp
  19. .type __sigsetjmp,%function
  20. .align 2
  21. #if defined(THUMB1_ONLY)
  22. .thumb_func
  23. __sigsetjmp:
  24. push {r3, r4, r5, r6, r7, lr}
  25. mov ip, r0
  26. stmia r0!, {r4, r5, r6, r7}
  27. mov r2, r8
  28. mov r3, r9
  29. mov r4, sl
  30. mov r5, fp
  31. add r6, sp, #(6 * 4)
  32. mov r7, lr
  33. stmia r0!, {r2, r3, r4, r5, r6, r7}
  34. mov r0, ip
  35. bl __sigjmp_save
  36. pop {r3, r4, r5, r6, r7, pc}
  37. #else
  38. __sigsetjmp:
  39. /* Save registers */
  40. mov ip, r0
  41. #if defined(__thumb2__)
  42. stmia ip!, {v1-v6, sl, fp}
  43. movs r2, sp
  44. stmia ip!, {r2, lr}
  45. #else
  46. /* Save registers */
  47. stmia ip!, {v1-v6, sl, fp, sp, lr}
  48. #endif
  49. #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
  50. # ifdef __VFP_FP__
  51. /* Store the VFP registers. */
  52. /* Following instruction is fstmiax ip!, {d8-d15}. */
  53. stc p11, cr8, [r12], #68
  54. /* Store the floating-point status register. */
  55. /* Following instruction is fmrx r2, fpscr. */
  56. mrc p10, 7, r2, cr1, cr0, 0
  57. str r2, [ip], #4
  58. # elif defined __MAVERICK__
  59. cfstrd mvd4, [ip], #8 ; nop
  60. cfstrd mvd5, [ip], #8 ; nop
  61. cfstrd mvd6, [ip], #8 ; nop
  62. cfstrd mvd7, [ip], #8 ; nop
  63. cfstrd mvd8, [ip], #8 ; nop
  64. cfstrd mvd9, [ip], #8 ; nop
  65. cfstrd mvd10, [ip], #8 ; nop
  66. cfstrd mvd11, [ip], #8 ; nop
  67. cfstrd mvd12, [ip], #8 ; nop
  68. cfstrd mvd13, [ip], #8 ; nop
  69. cfstrd mvd14, [ip], #8 ; nop
  70. cfstrd mvd15, [ip], #8
  71. # else
  72. sfmea f4, 4, [ip]!
  73. # endif
  74. #endif
  75. #ifdef __IWMMXT__
  76. /* Save the call-preserved iWMMXt registers. */
  77. /* Following instructions are wstrd wr10, [ip], #8 (etc.) */
  78. stcl p1, cr10, [r12], #8
  79. stcl p1, cr11, [r12], #8
  80. stcl p1, cr12, [r12], #8
  81. stcl p1, cr13, [r12], #8
  82. stcl p1, cr14, [r12], #8
  83. stcl p1, cr15, [r12], #8
  84. #endif
  85. /* Make a tail call to __sigjmp_save; it takes the same args. */
  86. #ifdef __PIC__
  87. B __sigjmp_save(PLT)
  88. #else
  89. B __sigjmp_save
  90. #endif
  91. #endif
  92. .size __sigsetjmp,.-__sigsetjmp