setjmp.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright (C) 1997-2017 Free Software Foundation, Inc.
  2. Contributed by Richard Henderson (rth@tamu.edu).
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the 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. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. /* __sigsetjmp is implemented in terms of the getcontext trap on
  15. Linux/Sparc64. */
  16. #include <sysdep.h>
  17. #include <jmpbuf-offsets.h>
  18. /* int _setjmp(jmp_buf) */
  19. ENTRY(_setjmp)
  20. ba __sigsetjmp_local
  21. set 0, %o1
  22. END(_setjmp)
  23. libc_hidden_def(_setjmp)
  24. /* int setjmp(jmp_buf) */
  25. ENTRY(setjmp)
  26. ba,pt %xcc, __sigsetjmp_local
  27. set 1, %o1
  28. END(setjmp)
  29. /* int __sigsetjmp(jmp_buf, savemask) */
  30. ENTRY(__sigsetjmp)
  31. __sigsetjmp_local:
  32. /* Record whether the user is intending to save the sigmask. */
  33. st %o1, [%o0 + O_mask_was_saved]
  34. /* Load up our return value, as longjmp is going to override
  35. the jmp_buf on its way back. */
  36. mov %g0, %g1
  37. /* And call getcontext! */
  38. ta 0x6e
  39. retl
  40. mov %g1, %o0
  41. END(__sigsetjmp)
  42. libc_hidden_def(__sigsetjmp)