setjmp.S 2.6 KB

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