From 78e18495767367754a48e80c81769172f232acbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 21 Jan 2009 11:28:50 +0000 Subject: [PATCH] * atomic_test_and_set() did actually not test if the lock was lost, and would therefore not always work correctly. * Minor cleanup, added return register for completeness. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28977 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/os/arch/ppc/atomic.S | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/system/libroot/os/arch/ppc/atomic.S b/src/system/libroot/os/arch/ppc/atomic.S index 29b9cf2bb2..cde60fd752 100644 --- a/src/system/libroot/os/arch/ppc/atomic.S +++ b/src/system/libroot/os/arch/ppc/atomic.S @@ -1,14 +1,14 @@ /* -** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ #define FUNCTION(x) .global x; .type x,@function; x .text /* int atomic_add(int *value, int increment) - * r3 r4 + * (r3) r3 r4 */ FUNCTION(atomic_add): lost1: lwarx %r5, 0, %r3 // reserve memory address located in "r3" @@ -19,7 +19,7 @@ lost1: lwarx %r5, 0, %r3 // reserve memory address located in "r3" blr /* int atomic_and(int *value, int andValue) - * r3 r4 + * (r3) r3 r4 */ FUNCTION(atomic_and): lost2: lwarx %r5, 0, %r3 @@ -30,7 +30,7 @@ lost2: lwarx %r5, 0, %r3 blr /* int atomic_or(int *value, int orValue) - * r3 r4 + * (r3) r3 r4 */ FUNCTION(atomic_or): lost3: lwarx %r5, 0, %r3 @@ -41,7 +41,7 @@ lost3: lwarx %r5, 0, %r3 blr /* int atomic_set(int *value, int setTo) - * r3 r4 + * (r3) r3 r4 */ FUNCTION(atomic_set): lost4: lwarx %r5, 0, %r3 @@ -50,19 +50,20 @@ lost4: lwarx %r5, 0, %r3 mr %r3, %r5 blr -/* int atomic_test_and_set(int *value, int setTo, int testValue) - * r3 r4 r5 +/* int atomic_test_and_set(int *value, int setTo, int testValue) + * (r3) r3 r4 r5 */ FUNCTION(atomic_test_and_set): lost5: lwarx %r6, 0, %r3 cmpw %r6, %r5 bne out5 stwcx. %r4, 0, %r3 + bne- lost5 out5: mr %r3, %r6 blr -/* int atomic_get(int *value) - * r3 +/* int atomic_get(int *value) + * (r3) r3 */ FUNCTION(atomic_get): lost6: lwarx %r5, 0, %r3