__longjmp.S 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* longjmp for i386.
  2. Copyright (C) 1995, 1996, 1997, 1998 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 Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. 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. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with the GNU C Library; see the file COPYING.LIB. If not,
  14. see <http://www.gnu.org/licenses/>. */
  15. #include <jmpbuf-offsets.h>
  16. .global __longjmp
  17. .type __longjmp,%function
  18. __longjmp:
  19. movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */
  20. movl 8(%esp), %eax /* Second argument is return value. */
  21. /* Save the return address now. */
  22. movl (JB_PC*4)(%ecx), %edx
  23. /* Restore registers. */
  24. movl (JB_BX*4)(%ecx), %ebx
  25. movl (JB_SI*4)(%ecx), %esi
  26. movl (JB_DI*4)(%ecx), %edi
  27. movl (JB_BP*4)(%ecx), %ebp
  28. movl (JB_SP*4)(%ecx), %esp
  29. /* Jump to saved PC. */
  30. jmp *%edx
  31. .size __longjmp,.-__longjmp
  32. libc_hidden_def(__longjmp)