setjmp.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. nop /* align this guy */
  47. __sigsetjmp_intern:
  48. /* Save registers */
  49. #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__
  50. add #(JB_SIZE), r4
  51. fmov.s fr15, @-r4
  52. fmov.s fr14, @-r4
  53. fmov.s fr13, @-r4
  54. fmov.s fr12, @-r4
  55. sts.l fpscr, @-r4
  56. #else
  57. add #(JB_SIZE-(5*4)), r4 /* this code doesn't do FP yet */
  58. #endif
  59. stc.l gbr, @-r4
  60. sts.l pr, @-r4
  61. mov.l r15, @-r4
  62. mov.l r14, @-r4
  63. mov.l r13, @-r4
  64. mov.l r12, @-r4
  65. mov.l r11, @-r4
  66. mov.l r10, @-r4
  67. mov.l r9, @-r4
  68. mov.l r8, @-r4
  69. #ifdef __HAVE_SHARED__
  70. mov.l .LG, r2
  71. mova .LG, r0
  72. add r0, r2
  73. /* Make a tail call to __sigjmp_save; it takes the same args. */
  74. mov.l .L1, r0
  75. mov.l @(r0,r2),r0
  76. jmp @r0
  77. mov r1, r0
  78. .align 2
  79. .LG: .long _GLOBAL_OFFSET_TABLE_
  80. .L1: .long __sigjmp_save@GOT
  81. #else
  82. /* Make a tail call to __sigjmp_save; it takes the same args. */
  83. mov.l .L1, r0
  84. braf r0
  85. mov r1, r0
  86. .jmp_loc:
  87. .align 2
  88. .L1: .long __sigjmp_save - .jmp_loc
  89. #endif
  90. .size __sigsetjmp,.-__sigsetjmp;