setjmp.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #include <features.h>
  16. #define _ASM
  17. #define _SETJMP_H
  18. #include <bits/setjmp.h>
  19. #include "NM_Macros.S"
  20. ;----------------------------------------
  21. ; Name: __sigsetjmp
  22. ; Description: Save the current context so
  23. ; a nr_longjmp works later.
  24. ; Input: %o0: jmp_buf: (ptr to) array to store context in
  25. ; Output: %o0 = 0 the first time we're called, or
  26. ; whatever longjmp returns later
  27. ; Side Effects: Uses %g0
  28. ; CWP Depth: 0
  29. ;
  30. .align 2
  31. .global _setjmp
  32. _setjmp:
  33. br __sigsetjmp
  34. movi %o1,0 ; (Delay slot) Set signal mask to zero
  35. .align 2
  36. .global setjmp
  37. setjmp:
  38. MOVIP %o1,1 ; Set signal mask to 1 to save mask
  39. .align 2
  40. .global __sigsetjmp
  41. __sigsetjmp:
  42. pfx jmpbuf_callersret ; present return address
  43. st [%o0],%i7
  44. pfx jmpbuf_jmpret ; where the longjmp will later execute from
  45. st [%o0],%o7
  46. pfx jmpbuf_sp ; Save stack pointer
  47. st [%o0],%o6
  48. pfx jmpbuf_l0 ; Save local register l0
  49. st [%o0],%l0
  50. pfx jmpbuf_l1 ; Save local register l1
  51. st [%o0],%l1
  52. pfx jmpbuf_l2 ; Save local register l2
  53. st [%o0],%l2
  54. pfx jmpbuf_l3 ; Save local register l3
  55. st [%o0],%l3
  56. pfx jmpbuf_l4 ; Save local register l4
  57. st [%o0],%l4
  58. pfx jmpbuf_l5 ; Save local register l5
  59. st [%o0],%l5
  60. pfx jmpbuf_l6 ; Save local register l6
  61. st [%o0],%l6
  62. pfx jmpbuf_l7 ; Save local register l7
  63. st [%o0],%l7
  64. pfx jmpbuf_i0 ; Save input register i0
  65. st [%o0],%i0
  66. pfx jmpbuf_i1 ; Save input register i1
  67. st [%o0],%i1
  68. pfx jmpbuf_i2 ; Save input register i2
  69. st [%o0],%i2
  70. pfx jmpbuf_i3 ; Save input register i3
  71. st [%o0],%i3
  72. pfx jmpbuf_i4 ; Save input register i4
  73. st [%o0],%i4
  74. pfx jmpbuf_i5 ; Save input register i5
  75. st [%o0],%i5
  76. pfx %hi(__sigjmp_save@h) ; Load up %g0 with address
  77. movi %g0,%lo(__sigjmp_save@h)
  78. pfx %xhi(__sigjmp_save@h)
  79. movhi %g0,%xlo(__sigjmp_save@h)
  80. jmp %g0
  81. nop ; (delay slot)