setjmp.S 2.6 KB

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