From fd78b6df3f3c63259fdb4f541eb68068801e57a7 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 19 Jan 2014 23:39:19 -0600 Subject: [PATCH] ppc: Modernize atomic.S. * Stub out atomic_get_and_set. This needs completed. --- src/system/libroot/os/arch/ppc/atomic.S | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/system/libroot/os/arch/ppc/atomic.S b/src/system/libroot/os/arch/ppc/atomic.S index cde60fd752..d0c2a27379 100644 --- a/src/system/libroot/os/arch/ppc/atomic.S +++ b/src/system/libroot/os/arch/ppc/atomic.S @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. */ -#define FUNCTION(x) .global x; .type x,@function; x +#include .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)