setjmp.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA. */
  16. #include <features.h>
  17. #define _SETJMP_H
  18. #define _ASM
  19. #include <bits/setjmp.h>
  20. .text
  21. /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
  22. We cannot do it in C because it must be a tail-call, so frame-unwinding
  23. in setjmp doesn't clobber the state restored by longjmp. */
  24. .align 4
  25. .type _setjmp,@function
  26. .globl _setjmp;
  27. _setjmp:
  28. bra __sigsetjmp_intern
  29. mov #0, r1
  30. .size _setjmp,.-_setjmp;
  31. /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
  32. We cannot do it in C because it must be a tail-call, so frame-unwinding
  33. in setjmp doesn't clobber the state restored by longjmp. */
  34. .align 4
  35. .type setjmp,@function
  36. .globl setjmp;
  37. setjmp:
  38. bra __sigsetjmp_intern
  39. mov #1, r1
  40. .size setjmp,.-setjmp;
  41. .align 4
  42. .type __sigsetjmp,@function
  43. .globl __sigsetjmp;
  44. __sigsetjmp:
  45. mov r0, r1
  46. __sigsetjmp_intern:
  47. /* Save registers */
  48. #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
  49. add #(JB_SIZE*4), r4
  50. fmov.s fr15, @-r4
  51. fmov.s fr14, @-r4
  52. fmov.s fr13, @-r4
  53. fmov.s fr12, @-r4
  54. sts.l fpscr, @-r4
  55. #else
  56. add #(JB_SIZE-5*4), r4 /* this code doesn't do FP yet */
  57. #endif
  58. stc.l gbr, @-r4
  59. sts.l pr, @-r4
  60. mov.l r15, @-r4
  61. mov.l r14, @-r4
  62. mov.l r13, @-r4
  63. mov.l r12, @-r4
  64. mov.l r11, @-r4
  65. mov.l r10, @-r4
  66. mov.l r9, @-r4
  67. mov.l r8, @-r4
  68. #if defined __HAVE_ELF__ && defined __HAVE_SHARED__
  69. mov.l .LG, r12
  70. mova .LG, r0
  71. add r0, r12
  72. /* Make a tail call to __sigjmp_save; it takes the same args. */
  73. mov.l .L1, r0
  74. mov.l @(r0,r12),r0
  75. jmp @r0
  76. mov r1, r0
  77. .align 2
  78. .LG: .long _GLOBAL_OFFSET_TABLE_
  79. .L1: .long __sigjmp_save@GOT
  80. #else
  81. /* Make a tail call to __sigjmp_save; it takes the same args. */
  82. mov.l .L1, r0
  83. braf r0
  84. mov r1, r0
  85. .jmp_loc:
  86. .align 2
  87. .L1: .long __sigjmp_save - .jmp_loc
  88. #endif
  89. .size __sigsetjmp,.-__sigsetjmp;