diff options
-rw-r--r-- | sys/i386/i386/simplelock.s | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sys/i386/i386/simplelock.s b/sys/i386/i386/simplelock.s index 0cf8a5c..4442500 100644 --- a/sys/i386/i386/simplelock.s +++ b/sys/i386/i386/simplelock.s @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: simplelock.s,v 1.8 1998/01/19 17:33:08 tegge Exp $ + * $Id: simplelock.s,v 1.9 1998/05/17 23:08:03 tegge Exp $ */ /* @@ -143,6 +143,8 @@ bsl1: .asciz "rslock: cpu: %d, addr: 0x%08x, lock: 0x%08x" * return (!test_and_set(&lkp->lock_data)); * } */ +#ifndef SL_DEBUG + ENTRY(s_lock_try) movl 4(%esp), %eax /* get the address of the lock */ movl $1, %ecx @@ -154,6 +156,23 @@ ENTRY(s_lock_try) ret +#else /* SL_DEBUG */ + +ENTRY(s_lock_try) + movl 4(%esp), %edx /* get the address of the lock */ + movl _cpu_lockid, %ecx /* add cpu id portion */ + incl %ecx /* add lock portion */ + + xorl %eax, %eax + lock + cmpxchgl %ecx, (%edx) + setz %al /* 1 if previous value was 0 */ + movzbl %al, %eax /* convert to an int */ + + ret + +#endif /* SL_DEBUG */ + /* * void @@ -168,25 +187,6 @@ ENTRY(s_unlock) ret -#ifdef needed - -/* - * int test_and_set(struct simplelock *lkp); - */ -ENTRY(test_and_set) - movl 4(%esp), %eax /* get the address of the lock */ - movl $1, %ecx - - xchgl %ecx, (%eax) - testl %ecx, %ecx - setz %al /* 1 if previous value was 0 */ - movzbl %al, %eax /* convert to an int */ - - ret - -#endif /* needed */ - - /* * These versions of simple_lock block interrupts, * making it suitable for regions accessed by both top and bottom levels. |