setjmp.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* setjmp for SH3.
  2. Copyright (C) 1999, 2000 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 Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. 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. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with the GNU C Library; see the file COPYING.LIB. If not,
  14. see <http://www.gnu.org/licenses/>. */
  15. #include <features.h>
  16. #include <jmpbuf-offsets.h>
  17. .text
  18. /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
  19. We cannot do it in C because it must be a tail-call, so frame-unwinding
  20. in setjmp doesn't clobber the state restored by longjmp. */
  21. .align 4
  22. .type _setjmp,@function
  23. .globl _setjmp;
  24. _setjmp:
  25. bra __sigsetjmp_intern
  26. mov #0, r1
  27. .size _setjmp,.-_setjmp;
  28. /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
  29. We cannot do it in C because it must be a tail-call, so frame-unwinding
  30. in setjmp doesn't clobber the state restored by longjmp. */
  31. .align 4
  32. .type setjmp,@function
  33. .globl setjmp;
  34. setjmp:
  35. bra __sigsetjmp_intern
  36. mov #1, r1
  37. .size setjmp,.-setjmp;
  38. .align 4
  39. .type __sigsetjmp,@function
  40. .globl __sigsetjmp;
  41. __sigsetjmp:
  42. mov r0, r1
  43. nop /* align this guy */
  44. __sigsetjmp_intern:
  45. /* Save registers */
  46. #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
  47. add #(JB_SIZE), r4
  48. fmov.s fr15, @-r4
  49. fmov.s fr14, @-r4
  50. fmov.s fr13, @-r4
  51. fmov.s fr12, @-r4
  52. sts.l fpscr, @-r4
  53. #else
  54. add #(JB_SIZE-(5*4)), r4 /* this code doesn't do FP yet */
  55. #endif
  56. stc.l gbr, @-r4
  57. sts.l pr, @-r4
  58. mov.l r15, @-r4
  59. mov.l r14, @-r4
  60. mov.l r13, @-r4
  61. mov.l r12, @-r4
  62. mov.l r11, @-r4
  63. mov.l r10, @-r4
  64. mov.l r9, @-r4
  65. mov.l r8, @-r4
  66. #ifdef __HAVE_SHARED__
  67. mov.l .LG, r2
  68. mova .LG, r0
  69. add r0, r2
  70. /* Make a tail call to __sigjmp_save; it takes the same args. */
  71. mov.l .L1, r0
  72. mov.l @(r0,r2),r0
  73. jmp @r0
  74. mov r1, r0
  75. .align 2
  76. .LG: .long _GLOBAL_OFFSET_TABLE_
  77. .L1: .long __sigjmp_save@GOT
  78. #else
  79. /* Make a tail call to __sigjmp_save; it takes the same args. */
  80. mov.l .L1, r0
  81. braf r0
  82. mov r1, r0
  83. .jmp_loc:
  84. .align 2
  85. .L1: .long __sigjmp_save - .jmp_loc
  86. #endif
  87. .size __sigsetjmp,.-__sigsetjmp;