setjmp.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /* Offsets into the jmp_buf structure. */
  18. #define O_mask_was_saved 512
  19. #define O_gregs 32
  20. #define O_g1 (O_gregs + 4*8)
  21. /* int _setjmp(jmp_buf) */
  22. ENTRY(_setjmp)
  23. ba __sigsetjmp_local
  24. set 0, %o1
  25. END(_setjmp)
  26. libc_hidden_def(_setjmp)
  27. /* int setjmp(jmp_buf) */
  28. ENTRY(setjmp)
  29. ba,pt %xcc, __sigsetjmp_local
  30. set 1, %o1
  31. END(setjmp)
  32. /* int __sigsetjmp(jmp_buf, savemask) */
  33. ENTRY(__sigsetjmp)
  34. __sigsetjmp_local:
  35. /* Record whether the user is intending to save the sigmask. */
  36. st %o1, [%o0 + O_mask_was_saved]
  37. /* Load up our return value, as longjmp is going to override
  38. the jmp_buf on its way back. */
  39. mov %g0, %g1
  40. /* And call getcontext! */
  41. ta 0x6e
  42. retl
  43. mov %g1, %o0
  44. END(__sigsetjmp)
  45. libc_hidden_def(__sigsetjmp)