Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/include Clear the reservation in __cpu_simp...



details:   https://anonhg.NetBSD.org/src/rev/18ae22467452
branches:  trunk
changeset: 494554:18ae22467452
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Sat Jul 08 04:36:56 2000 +0000

description:
Clear the reservation in __cpu_simple_lock_try even if it failed to lock.
(From ws%tools.de@localhost)

diffstat:

 sys/arch/powerpc/include/lock.h |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 7a7de770403f -r 18ae22467452 sys/arch/powerpc/include/lock.h
--- a/sys/arch/powerpc/include/lock.h   Sat Jul 08 03:28:01 2000 +0000
+++ b/sys/arch/powerpc/include/lock.h   Sat Jul 08 04:36:56 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.3 2000/07/06 03:52:25 tsubai Exp $  */
+/*     $NetBSD: lock.h,v 1.4 2000/07/08 04:36:56 tsubai Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -60,12 +60,12 @@
 {
        int old;
 
-       __asm __volatile ("     \n\
+       __asm __volatile ("     \
                                \n\
 1:     lwarx   %0,0,%1         \n\
        cmpwi   %0,%2           \n\
        beq+    3f              \n\
-2:     lwz     %0,0(%1)        \n\
+2:     lwzx    %0,0,%1         \n\
        cmpwi   %0,%2           \n\
        beq+    1b              \n\
        b       2b              \n\
@@ -81,19 +81,21 @@
 static __inline int
 __cpu_simple_lock_try(__cpu_simple_lock_t *alp)
 {
-       int old;
+       int old, dummy;
 
-       __asm __volatile ("     \n\
+       __asm __volatile ("     \
                                \n\
 1:     lwarx   %0,0,%1         \n\
        cmpwi   %0,%2           \n\
        bne     2f              \n\
        stwcx.  %3,0,%1         \n\
        bne-    1b              \n\
+2:     stwcx.  %3,0,%4         \n\
        isync                   \n\
-2:                             \n"
+                               \n"
        : "=&r"(old)
-       : "r"(alp), "I"(__SIMPLELOCK_UNLOCKED), "r"(__SIMPLELOCK_LOCKED)
+       : "r"(alp), "I"(__SIMPLELOCK_UNLOCKED), "r"(__SIMPLELOCK_LOCKED),
+         "r"(&dummy)
        : "memory");
 
        return (old == __SIMPLELOCK_UNLOCKED);



Home | Main Index | Thread Index | Old Index