sysutilp.inc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2004 by Florian Klaempfl
  5. member of the Free Pascal development team
  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. { ---------------------------------------------------------------------
  13. This include contains cpu-specific routines
  14. ---------------------------------------------------------------------}
  15. function InterLockedDecrement (var Target: longint) : longint; assembler;
  16. asm
  17. movl $-1,%edx
  18. xchgl %edx,%eax
  19. lock
  20. xaddl %eax, (%rdx)
  21. decl %eax
  22. end;
  23. function InterLockedIncrement (var Target: longint) : longint; assembler;
  24. asm
  25. movl $1,%edx
  26. xchgl %edx,%eax
  27. lock
  28. xaddl %eax, (%rdx)
  29. incl %eax
  30. end;
  31. function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler;
  32. asm
  33. xchgl (%rax),%edx
  34. movl %edx,%eax
  35. end;
  36. function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler;
  37. asm
  38. xchgl %eax,%edx
  39. lock
  40. xaddl %eax, (%rdx)
  41. end;
  42. {
  43. $Log$
  44. Revision 1.2 2004-03-05 12:17:50 marco
  45. * interlocked* changed to longints, including winapi. (which was a bug)
  46. Revision 1.1 2004/02/20 22:15:16 florian
  47. + x86_64 dependend sysutils part added
  48. * some 64 bit adaptions
  49. }