sysutilp.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 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. {$ASMMODE ATT}
  16. function InterLockedDecrement (var Target: integer) : Integer; assembler;
  17. asm
  18. movl Target, %ecx
  19. movl $-1, %eax
  20. lock
  21. xaddl %eax, (%ecx)
  22. decl %eax
  23. end;
  24. function InterLockedIncrement (var Target: integer) : Integer; assembler;
  25. asm
  26. movl Target, %ecx
  27. movl $1, %eax
  28. lock
  29. xaddl %eax, (%ecx)
  30. incl %eax
  31. end;
  32. function InterLockedExchange (var Target: integer;Source : integer) : Integer; assembler;
  33. asm
  34. movl Target,%ecx
  35. movl Source,%eax
  36. xchgl %eax, (%ecx)
  37. end;
  38. function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer; assembler;
  39. asm
  40. movl Target,%ecx
  41. movl Source,%eax
  42. lock
  43. xaddl %eax, (%ecx)
  44. end;
  45. {
  46. $Log$
  47. Revision 1.2 2002-09-07 16:01:19 peter
  48. * old logs removed and tabs fixed
  49. }