getcontext.S 1.8 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. #include <sysdep.h>
  15. #include "ucontext_i.h"
  16. /* int getcontext(ucontext_t *); */
  17. ENTRY(__getcontext)
  18. ldx [%o0 + UC_LINK], %o1 /* Preserve uc_link field, the
  19. trap clears it. */
  20. ta 0x6e
  21. 1:
  22. ldx [%o0 + UC_M_PC], %o2
  23. ldx [%o0 + UC_M_NPC], %o3
  24. ldx [%o0 + __UC_SIGMASK], %o4
  25. stx %o1, [%o0 + UC_LINK]
  26. add %o2, 2f - 1b, %o2
  27. stx %o2, [%o0 + UC_M_PC]
  28. add %o3, 2f - 1b, %o3
  29. stx %o3, [%o0 + UC_M_NPC]
  30. #if SIGMASK_WORDS == 16
  31. stx %o4, [%o0 + UC_SIGMASK]
  32. stx %g0, [%o0 + UC_SIGMASK + 8]
  33. stx %g0, [%o0 + UC_SIGMASK + 16]
  34. stx %g0, [%o0 + UC_SIGMASK + 24]
  35. stx %g0, [%o0 + UC_SIGMASK + 32]
  36. stx %g0, [%o0 + UC_SIGMASK + 40]
  37. stx %g0, [%o0 + UC_SIGMASK + 48]
  38. stx %g0, [%o0 + UC_SIGMASK + 56]
  39. stx %g0, [%o0 + UC_SIGMASK + 64]
  40. stx %g0, [%o0 + UC_SIGMASK + 72]
  41. stx %g0, [%o0 + UC_SIGMASK + 80]
  42. stx %g0, [%o0 + UC_SIGMASK + 88]
  43. stx %g0, [%o0 + UC_SIGMASK + 96]
  44. stx %g0, [%o0 + UC_SIGMASK + 104]
  45. stx %g0, [%o0 + UC_SIGMASK + 112]
  46. stx %g0, [%o0 + UC_SIGMASK + 120]
  47. #else
  48. # error Adjust __getcontext
  49. #endif
  50. 2:
  51. retl
  52. clr %o0
  53. END(__getcontext)
  54. weak_alias (__getcontext, getcontext)