setjmp.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 <jmpbuf-offsets.h>
  16. #include "NM_Macros.S"
  17. ;----------------------------------------
  18. ; Name: __sigsetjmp
  19. ; Description: Save the current context so
  20. ; a nr_longjmp works later.
  21. ; Input: %o0: jmp_buf: (ptr to) array to store context in
  22. ; Output: %o0 = 0 the first time we're called, or
  23. ; whatever longjmp returns later
  24. ; Side Effects: Uses %g0
  25. ; CWP Depth: 0
  26. ;
  27. .align 2
  28. .global _setjmp
  29. _setjmp:
  30. br __sigsetjmp
  31. movi %o1,0 ; (Delay slot) Set signal mask to zero
  32. .align 2
  33. .global setjmp
  34. setjmp:
  35. MOVIP %o1,1 ; Set signal mask to 1 to save mask
  36. .align 2
  37. .global __sigsetjmp
  38. __sigsetjmp:
  39. pfx jmpbuf_callersret ; present return address
  40. st [%o0],%i7
  41. pfx jmpbuf_jmpret ; where the longjmp will later execute from
  42. st [%o0],%o7
  43. pfx jmpbuf_sp ; Save stack pointer
  44. st [%o0],%o6
  45. pfx jmpbuf_l0 ; Save local register l0
  46. st [%o0],%l0
  47. pfx jmpbuf_l1 ; Save local register l1
  48. st [%o0],%l1
  49. pfx jmpbuf_l2 ; Save local register l2
  50. st [%o0],%l2
  51. pfx jmpbuf_l3 ; Save local register l3
  52. st [%o0],%l3
  53. pfx jmpbuf_l4 ; Save local register l4
  54. st [%o0],%l4
  55. pfx jmpbuf_l5 ; Save local register l5
  56. st [%o0],%l5
  57. pfx jmpbuf_l6 ; Save local register l6
  58. st [%o0],%l6
  59. pfx jmpbuf_l7 ; Save local register l7
  60. st [%o0],%l7
  61. pfx jmpbuf_i0 ; Save input register i0
  62. st [%o0],%i0
  63. pfx jmpbuf_i1 ; Save input register i1
  64. st [%o0],%i1
  65. pfx jmpbuf_i2 ; Save input register i2
  66. st [%o0],%i2
  67. pfx jmpbuf_i3 ; Save input register i3
  68. st [%o0],%i3
  69. pfx jmpbuf_i4 ; Save input register i4
  70. st [%o0],%i4
  71. pfx jmpbuf_i5 ; Save input register i5
  72. st [%o0],%i5
  73. pfx %hi(__sigjmp_save@h) ; Load up %g0 with address
  74. movi %g0,%lo(__sigjmp_save@h)
  75. pfx %xhi(__sigjmp_save@h)
  76. movhi %g0,%xlo(__sigjmp_save@h)
  77. jmp %g0
  78. nop ; (delay slot)