summaryrefslogtreecommitdiff
path: root/sal/osl/unx/interlck.c
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2001-03-13 18:01:54 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2001-03-13 18:01:54 +0000
commit49d7c0970bb9d39fe47a0d2f8d4602038e0bccc4 (patch)
tree90152807a15da6e8b64430f9494139ce6200fbef /sal/osl/unx/interlck.c
parente901c03712a380898ed28b2962914443079c7138 (diff)
reworked atomic updates for reference counters (PowerPC version)
Diffstat (limited to 'sal/osl/unx/interlck.c')
-rw-r--r--sal/osl/unx/interlck.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c
index 973cf8e41562..c0247851de06 100644
--- a/sal/osl/unx/interlck.c
+++ b/sal/osl/unx/interlck.c
@@ -2,9 +2,9 @@
*
* $RCSfile: interlck.c,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: hr $ $Date: 2001-03-13 14:55:08 $
+ * last change: $Author: hr $ $Date: 2001-03-13 19:01:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,17 +112,15 @@ oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount*
oslInterlockedCount nCount;
__asm__ __volatile__ (
- " li 4,1\n\t"
- "loop: lwarx 5,0,%1\n\t"
- " add 6,4,5\n\t"
- " stwcx. 6,0,%1\n\t"
- " bne- loop\n\t"
- " mr %0,6\n\t"
- : "=r" (nCount)
- : "r" (pCount)
- : "memory", "4", "5","6" );
-
- return nCount;
+ "1: lwarx %0,0,%2\n\t"
+ " addic %0,%0,1\n\t"
+ " stwcx. %0,0,%2\n\t"
+ " bne- 1b"
+ : "=r" (nCount), "=m" (*pCount)
+ : "r" (pCount)
+ : "cc", "memory");
+
+ return nCount;
}
oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount)
@@ -130,15 +128,13 @@ oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount*
oslInterlockedCount nCount;
__asm__ __volatile__ (
- " li 4,1\n\t"
- "loop1: lwarx 5,0,%1\n\t"
- " subf 6,4,5\n\t"
- " stwcx. 6,0,%1\n\t"
- " bne- loop1\n\t"
- " mr %0,6\n\t"
- : "=r" (nCount)
- : "r" (pCount)
- : "memory", "4", "5","6" );
+ "1: lwarx %0,0,%2\n\t"
+ " subic %0,%0,1\n\t"
+ " stwcx. %0,0,%2\n\t"
+ " bne- 1b"
+ : "=r" (nCount), "=m" (*pCount)
+ : "r" (pCount)
+ : "cc", "memory");
return nCount;
}