setjump.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 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. Function SetJmp (Var S : Jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];
  13. asm
  14. movl 8(%ebp),%eax
  15. movl %ebx,(%eax)
  16. movl %esi,4(%eax)
  17. movl %edi,8(%eax)
  18. movl 4(%ebp),%edx
  19. movl %edx,20(%eax)
  20. movl (%ebp),%edx
  21. movl %edx,12(%eax)
  22. leal 12(%ebp),%edx
  23. movl %edx,16(%eax)
  24. xorl %eax,%eax
  25. end;
  26. Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;[Public, alias : 'FPC_LONGJMP'];
  27. asm
  28. movl 8(%ebp),%ecx
  29. movl 12(%ebp),%eax
  30. testl %eax,%eax
  31. jne .Ljnonzero
  32. movl $1,%eax
  33. .Ljnonzero:
  34. movl (%ecx),%ebx
  35. movl 4(%ecx),%esi
  36. movl 8(%ecx),%edi
  37. movl 12(%ecx),%ebp
  38. movl 16(%ecx),%esp
  39. jmp 20(%ecx)
  40. end;
  41. {
  42. $Log$
  43. Revision 1.7 2000-01-07 16:41:33 daniel
  44. * copyright 2000
  45. Revision 1.6 1999/08/18 10:42:13 pierre
  46. * loading of esp value corrected
  47. Revision 1.5 1999/03/01 15:41:00 peter
  48. * use external names
  49. * removed all direct assembler modes
  50. Revision 1.4 1998/09/14 10:48:13 peter
  51. * FPC_ names
  52. * Heap manager is now system independent
  53. Revision 1.3 1998/08/11 00:04:52 peter
  54. * $ifdef ver0_99_5 updates
  55. }