setjump.inc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1998 by the Free Pascal development team
  5. SetJmp and LongJmp implementation for exception handling
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program 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.
  11. **********************************************************************}
  12. {$ASMMODE DIRECT}
  13. Function SetJmp (Var S : Jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
  14. asm
  15. movl 8(%ebp),%eax
  16. movl %ebx,(%eax)
  17. movl %esi,4(%eax)
  18. movl %edi,8(%eax)
  19. movl 4(%ebp),%edx
  20. movl %edx,20(%eax)
  21. movl (%ebp),%edx
  22. movl %edx,12(%eax)
  23. leal 8(%ebp),%edx
  24. movl %edx,16(%eax)
  25. xorl %eax,%eax
  26. end;
  27. Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;[Public, alias : 'FPC_LONGJMP'];
  28. asm
  29. movl 8(%ebp),%ecx
  30. movl 12(%ebp),%eax
  31. testl %eax,%eax
  32. jne .Ljnonzero
  33. movl $1,%eax
  34. .Ljnonzero:
  35. movl (%ecx),%ebx
  36. movl 4(%ecx),%esi
  37. movl 8(%ecx),%edi
  38. movl 12(%ecx),%ebp
  39. movl 16(%ecx),%esp
  40. jmp *20(%ecx)
  41. end;
  42. {$ASMMODE ATT}
  43. {
  44. $Log$
  45. Revision 1.4 1998-09-14 10:48:13 peter
  46. * FPC_ names
  47. * Heap manager is now system independent
  48. Revision 1.3 1998/08/11 00:04:52 peter
  49. * $ifdef ver0_99_5 updates
  50. }