setjmp.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* setjmp for x86-64.
  2. Copyright (C) 2001, 2003 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <jmpbuf-offsets.h>
  16. .global __sigsetjmp
  17. .type __sigsetjmp,%function
  18. __sigsetjmp:
  19. /* Save registers. */
  20. movq %rbx, (JB_RBX*8)(%rdi)
  21. movq %rbp, (JB_RBP*8)(%rdi)
  22. movq %r12, (JB_R12*8)(%rdi)
  23. movq %r13, (JB_R13*8)(%rdi)
  24. movq %r14, (JB_R14*8)(%rdi)
  25. movq %r15, (JB_R15*8)(%rdi)
  26. leaq 8(%rsp), %rdx /* Save SP as it will be after we return. */
  27. movq %rdx, (JB_RSP*8)(%rdi)
  28. movq (%rsp), %rax /* Save PC we are returning to now. */
  29. movq %rax, (JB_PC*8)(%rdi)
  30. /* Make a tail call to __sigjmp_save; it takes the same args. */
  31. #ifdef __PIC__
  32. jmp __sigjmp_save@PLT
  33. #else
  34. jmp __sigjmp_save
  35. #endif
  36. .size __sigsetjmp,.-__sigsetjmp
  37. libc_hidden_def(__sigsetjmp)