sysutilp.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. {$ifdef REGCALL}
  19. movl $-1,%edx
  20. xchgl %edx,%eax
  21. {$else}
  22. movl Target, %edx
  23. movl $-1, %eax
  24. {$endif}
  25. lock
  26. xaddl %eax, (%edx)
  27. decl %eax
  28. end;
  29. function InterLockedIncrement (var Target: integer) : Integer; assembler;
  30. asm
  31. {$ifdef REGCALL}
  32. movl $1,%edx
  33. xchgl %edx,%eax
  34. {$else}
  35. movl Target, %edx
  36. movl $1, %eax
  37. {$endif}
  38. lock
  39. xaddl %eax, (%edx)
  40. incl %eax
  41. end;
  42. function InterLockedExchange (var Target: integer;Source : integer) : Integer; assembler;
  43. asm
  44. {$ifdef REGCALL}
  45. xchgl (%eax),%edx
  46. movl %edx,%eax
  47. {$else}
  48. movl Target,%ecx
  49. movl Source,%eax
  50. xchgl (%ecx),%eax
  51. {$endif}
  52. end;
  53. function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer; assembler;
  54. asm
  55. {$ifdef REGCALL}
  56. xchgl %eax,%edx
  57. {$else}
  58. movl Target,%edx
  59. movl Source,%eax
  60. {$endif}
  61. lock
  62. xaddl %eax, (%edx)
  63. end;
  64. {
  65. $Log$
  66. Revision 1.4 2003-12-23 22:23:34 peter
  67. * increment should use ofcourse use 1 instead of -1
  68. Revision 1.3 2003/11/11 21:08:17 peter
  69. * REGCALL define added
  70. Revision 1.2 2002/09/07 16:01:19 peter
  71. * old logs removed and tabs fixed
  72. }