* InterLocked routines added

This commit is contained in:
peter 2001-10-22 21:40:55 +00:00
parent 05aa164e57
commit 9aeb958a8e
3 changed files with 80 additions and 2 deletions

65
rtl/i386/sysutilp.inc Normal file
View File

@ -0,0 +1,65 @@
{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 2001 by Florian Klaempfl
member of the Free Pascal development team
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{ ---------------------------------------------------------------------
This include contains cpu-specific routines
---------------------------------------------------------------------}
{$ASMMODE ATT}
function InterLockedDecrement (var Target: integer) : Integer; assembler;
asm
movl Target, %ecx
movl $-1, %eax
lock
xaddl %eax, (%ecx)
decl %eax
end;
function InterLockedIncrement (var Target: integer) : Integer; assembler;
asm
movl Target, %ecx
movl $1, %eax
lock
xaddl %eax, (%ecx)
incl %eax
end;
function InterLockedExchange (var Target: integer;Source : integer) : Integer; assembler;
asm
movl Target,%ecx
movl Source,%eax
xchgl %eax, (%ecx)
end;
function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer; assembler;
asm
movl Target,%ecx
movl Source,%eax
lock
xaddl %eax, (%ecx)
end;
{
$Log$
Revision 1.1 2001-10-22 21:40:55 peter
* InterLocked routines added
}

View File

@ -24,9 +24,17 @@ type
{$endif HASINTF}
function InterLockedIncrement (var Target: integer) : Integer;
function InterLockedDecrement (var Target: integer) : Integer;
function InterLockedExchange (var Target: integer;Source : integer) : Integer;
function InterLockedExchangeAdd (var Target: integer;Source : integer) : Integer;
{
$Log$
Revision 1.1 2001-08-22 21:19:16 florian
Revision 1.2 2001-10-22 21:40:55 peter
* InterLocked routines added
Revision 1.1 2001/08/22 21:19:16 florian
+ some new stuff of D6/Kylix added
}

View File

@ -37,6 +37,8 @@
{ Read pchar handling functions implementation }
{$i syspch.inc}
{ CPU Specific code }
{$i sysutilp.inc}
procedure FreeAndNil(var obj);
var
@ -328,7 +330,10 @@ end;
{
$Log$
Revision 1.6 2001-08-19 21:02:02 florian
Revision 1.7 2001-10-22 21:40:55 peter
* InterLocked routines added
Revision 1.6 2001/08/19 21:02:02 florian
* fixed and added a lot of stuff to get the Jedi DX( headers
compiled