mirror of
https://review.haiku-os.org/haiku
synced 2025-01-20 21:41:28 +01:00
* 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
This commit is contained in:
parent
cb744e5c22
commit
78e1849576
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user