Переглянути джерело

+ sparc InterlockedCompareExchange

git-svn-id: trunk@4334 -
Jonas Maebe 19 роки тому
батько
коміт
800742939b
3 змінених файлів з 29 додано та 125 видалено
  1. 0 1
      .gitattributes
  2. 29 0
      rtl/sparc/sparc.inc
  3. 0 124
      rtl/sparc/sysutilp.inc

+ 0 - 1
.gitattributes

@@ -4820,7 +4820,6 @@ rtl/sparc/setjumph.inc svneol=native#text/plain
 rtl/sparc/sparc.inc svneol=native#text/plain
 rtl/sparc/strings.inc svneol=native#text/plain
 rtl/sparc/stringss.inc svneol=native#text/plain
-rtl/sparc/sysutilp.inc svneol=native#text/plain
 rtl/ucmaps/8859-1.txt svneol=native#text/plain
 rtl/ucmaps/8859-10.txt svneol=native#text/plain
 rtl/ucmaps/8859-13.txt svneol=native#text/plain

+ 29 - 0
rtl/sparc/sparc.inc

@@ -461,3 +461,32 @@ asm
 end;
 
 
+function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comperand: longint): longint; assembler; nostackframe;
+asm
+  { usually, we shouldn't lock here so saving the stack frame for these extra intructions is
+    worse the effort, especially while waiting :)
+  }
+{ input:  address of target in o0, newvalue in o1, comparand in o2 }
+{ output: value stored in target before entry of the function      }
+{ side-effect: NewValue stored in target if (target = comparand)   }
+.LInterlockedCompareExchange1:
+  sethi %hi(fpc_system_lock), %g1
+  or %g1,%lo(fpc_system_lock), %g1
+  ldstub [%g1],%g1
+  cmp %g1,0
+  bne .LInterlockedCompareExchange1
+  nop
+
+  ld [%o0],%g1
+  cmp %g1,%o2
+  bne  .LInterlockedCompareExchange2
+  nop
+  st %o1,[%o0]
+.LInterlockedCompareExchange2:
+  mov %g1,%o0
+
+  { unlock }
+  sethi %hi(fpc_system_lock), %g1
+  or %g1,%lo(fpc_system_lock), %g1
+  stb %g0,[%g1]
+end;

+ 0 - 124
rtl/sparc/sysutilp.inc

@@ -1,124 +0,0 @@
-{
-    This file is part of the Free Pascal run time library.
-
-    Copyright (c) 2003 by Peter Vreman,
-    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
-  ---------------------------------------------------------------------}
-
-var
-  fpc_system_lock : byte;external name 'fpc_system_lock';
-
-function InterLockedDecrement (var Target: longint) : longint; assembler; nostackframe;
-asm
-  { usually, we shouldn't lock here so saving the stack frame for these extra intructions is
-    worse the effort, especially while waiting :)
-  }
-.LInterLockedDecrement1:
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  ldstub [%g1],%g1
-  cmp %g1,0
-  bne .LInterLockedDecrement1
-  nop
-
-  ld [%o0],%g1
-  sub %g1,1,%g1
-  st %g1,[%o0]
-
-  mov %g1,%o0
-
-  { unlock }
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  stb %g0,[%g1]
-end;
-
-function InterLockedIncrement (var Target: longint) : longint; assembler; nostackframe;
-asm
-  { usually, we shouldn't lock here so saving the stack frame for these extra intructions is
-    worse the effort, especially while waiting :)
-  }
-.LInterLockedIncrement1:
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  ldstub [%g1],%g1
-  cmp %g1,0
-  bne .LInterLockedIncrement1
-  nop
-
-  ld [%o0],%g1
-  add %g1,1,%g1
-  st %g1,[%o0]
-
-  mov %g1,%o0
-
-  { unlock }
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  stb %g0,[%g1]
-end;
-
-
-function InterLockedExchange (var Target: longint;Source : longint) : longint; assembler; nostackframe;
-asm
-  { usually, we shouldn't lock here so saving the stack frame for these extra intructions is
-    worse the effort, especially while waiting :)
-  }
-.LInterLockedExchange1:
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  ldstub [%g1],%g1
-  cmp %g1,0
-  bne .LInterLockedExchange1
-  nop
-
-  ld [%o0],%g1
-  st %o1,[%o0]
-
-  mov %g1,%o0
-
-  { unlock }
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  stb %g0,[%g1]
-end;
-
-
-function InterLockedExchangeAdd (var Target: longint;Source : longint) : longint; assembler; nostackframe;
-asm
-  { usually, we shouldn't lock here so saving the stack frame for these extra intructions is
-    worse the effort, especially while waiting :)
-  }
-.LInterLockedExchangeAdd1:
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  ldstub [%g1],%g1
-  cmp %g1,0
-  bne .LInterLockedExchangeAdd1
-  nop
-
-  ld [%o0],%g1
-  add %g1,%o1,%o1
-  st %o1,[%o0]
-
-  mov %g1,%o0
-
-  { unlock }
-  sethi %hi(fpc_system_lock), %g1
-  or %g1,%lo(fpc_system_lock), %g1
-  stb %g0,[%g1]
-end;
-
-