setjmp.S 2.6 KB

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