ppc: Modernize atomic.S.

* Stub out atomic_get_and_set. This needs completed.
This commit is contained in:
Alexander von Gluck IV
2014-01-19 23:39:19 -06:00
parent 24f0b1e29e
commit fd78b6df3f
+13 -1
View File
@@ -3,7 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#define FUNCTION(x) .global x; .type x,@function; x
#include <asm_defs.h>
.text
@@ -17,6 +17,7 @@ lost1: lwarx %r5, 0, %r3 // reserve memory address located in "r3"
bne- lost1 // try again if reservation was lost
mr %r3, %r5 // return old value (was in "r5")
blr
FUNCTION_END(atomic_add)
/* int atomic_and(int *value, int andValue)
* (r3) r3 r4
@@ -28,6 +29,7 @@ lost2: lwarx %r5, 0, %r3
bne- lost2
mr %r3, %r5
blr
FUNCTION_END(atomic_and)
/* int atomic_or(int *value, int orValue)
* (r3) r3 r4
@@ -39,6 +41,7 @@ lost3: lwarx %r5, 0, %r3
bne- lost3
mr %r3, %r5
blr
FUNCTION_END(atomic_or)
/* int atomic_set(int *value, int setTo)
* (r3) r3 r4
@@ -49,6 +52,7 @@ lost4: lwarx %r5, 0, %r3
bne- lost4
mr %r3, %r5
blr
FUNCTION_END(atomic_set)
/* int atomic_test_and_set(int *value, int setTo, int testValue)
* (r3) r3 r4 r5
@@ -61,6 +65,13 @@ lost5: lwarx %r6, 0, %r3
bne- lost5
out5: mr %r3, %r6
blr
FUNCTION_END(atomic_test_and_set)
// TODO: PowerPC atomic_get_and_set
FUNCTION(atomic_get_and_set):
sync
blr
FUNCTION_END(atomic_get_and_set)
/* int atomic_get(int *value)
* (r3) r3
@@ -71,3 +82,4 @@ lost6: lwarx %r5, 0, %r3
bne- lost6
mr %r3, %r5
blr
FUNCTION_END(atomic_get)