setjmp.S 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* setjmp for i386, ELF version.
  2. Copyright (C) 1995, 1996, 1997, 2000, 2001 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. .global __sigsetjmp
  16. .type __sigsetjmp,%function
  17. __sigsetjmp:
  18. movl 4 (%esp), %eax
  19. /* Save registers. */
  20. movl %ebx, (0 *4)(%eax)
  21. movl %esi, (1 *4)(%eax)
  22. movl %edi, (2 *4)(%eax)
  23. /* Save SP as it will be after we return. */
  24. leal 4(%esp), %ecx
  25. movl %ecx, (4 *4)(%eax)
  26. /* Save PC we are returning to now. */
  27. movl 0(%esp), %ecx
  28. movl %ecx, (5 *4)(%eax)
  29. /* Save caller's frame pointer. */
  30. movl %ebp, (3 *4)(%eax)
  31. /* Make a tail call to __sigjmp_save; it takes the same args. */
  32. #ifdef __PIC__
  33. /* We cannot use the PLT, because it requires that %ebx be set, but
  34. we can't save and restore our caller's value. Instead, we do an
  35. indirect jump through the GOT, using for the temporary register
  36. %ecx, which is call-clobbered. */
  37. call .Lhere
  38. .Lhere:
  39. popl %ecx
  40. addl $_GLOBAL_OFFSET_TABLE_+[.- .Lhere ], %ecx
  41. movl __sigjmp_save @GOT (%ecx), %ecx
  42. jmp *%ecx
  43. #else
  44. jmp __sigjmp_save
  45. #endif
  46. .size __sigsetjmp,.-__sigsetjmp