You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setjmp.S 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* setjmp and longjmp. Use of these functions is deprecated. */
  2. FILE_LICENCE ( GPL2_OR_LATER )
  3. .text
  4. .arch i386
  5. .code32
  6. /**************************************************************************
  7. SETJMP - Save stack context for non-local goto
  8. **************************************************************************/
  9. .globl setjmp
  10. setjmp:
  11. movl 4(%esp),%ecx /* jmpbuf */
  12. movl 0(%esp),%edx /* return address */
  13. movl %edx,0(%ecx)
  14. movl %ebx,4(%ecx)
  15. movl %esp,8(%ecx)
  16. movl %ebp,12(%ecx)
  17. movl %esi,16(%ecx)
  18. movl %edi,20(%ecx)
  19. movl $0,%eax
  20. ret
  21. /**************************************************************************
  22. LONGJMP - Non-local jump to a saved stack context
  23. **************************************************************************/
  24. .globl longjmp
  25. longjmp:
  26. movl 4(%esp),%edx /* jumpbuf */
  27. movl 8(%esp),%eax /* result */
  28. movl 0(%edx),%ecx
  29. movl 4(%edx),%ebx
  30. movl 8(%edx),%esp
  31. movl 12(%edx),%ebp
  32. movl 16(%edx),%esi
  33. movl 20(%edx),%edi
  34. cmpl $0,%eax
  35. jne 1f
  36. movl $1,%eax
  37. 1: movl %ecx,0(%esp)
  38. ret