setjmp.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
  3. * This program and the accompanying materials are licensed and made
  4. available
  5. * under the terms and conditions of the BSD License which accompanies
  6. this
  7. * distribution. The full text of the license may be found at
  8. * http://opensource.org/licenses/bsd-license.php.
  9. *
  10. * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
  11. BASIS,
  12. * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
  13. * IMPLIED.
  14. */
  15. .text
  16. .globl setjmp
  17. #ifndef __MINGW32__
  18. .type setjmp, @function
  19. #else
  20. .def setjmp; .scl 2; .type 32; .endef
  21. #endif
  22. setjmp:
  23. pop %ecx
  24. movl (%esp), %edx
  25. movl %ebx, (%edx)
  26. movl %esi, 4(%edx)
  27. movl %edi, 8(%edx)
  28. movl %ebp, 12(%edx)
  29. movl %esp, 16(%edx)
  30. xorl %eax, %eax
  31. jmp *%ecx
  32. .globl longjmp
  33. #ifndef __MINGW32__
  34. .type longjmp, @function
  35. #else
  36. .def longjmp; .scl 2; .type 32; .endef
  37. #endif
  38. longjmp:
  39. pop %eax
  40. pop %edx
  41. pop %eax
  42. movl (%edx), %ebx
  43. movl 4(%edx), %esi
  44. movl 8(%edx), %edi
  45. #if defined(__ELF__) && defined(__linux__)
  46. .section .note.GNU-stack,"",%progbits
  47. #endif