libroot/ppc: Stub out emitted GCC atomics on ppc32
* gcc will emit 64-bit (_8) atomic functions on 32-bit powerpc architectures. This stubs them out for now with a warning. * We could do more here, but i'm just getting PPC bootstrapped to get the nightly builds going again. * We could also just completely drop PPC.. but it was pretty close pre-pm... so I'd hate to lose that work.
This commit is contained in:
parent
9175f4f04a
commit
b3d3ee5a2f
@ -1,85 +1,36 @@
|
||||
/*
|
||||
* Copyright 2003-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2017 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
*/
|
||||
|
||||
#include <asm_defs.h>
|
||||
|
||||
.text
|
||||
|
||||
/* int atomic_add(int *value, int increment)
|
||||
* (r3) r3 r4
|
||||
*/
|
||||
FUNCTION(atomic_add):
|
||||
lost1: lwarx %r5, 0, %r3 // reserve memory address located in "r3"
|
||||
add %r0, %r5, %r4 // (contents are stored in "r5")
|
||||
stwcx. %r0, 0, %r3
|
||||
bne- lost1 // try again if reservation was lost
|
||||
mr %r3, %r5 // return old value (was in "r5")
|
||||
blr
|
||||
FUNCTION_END(atomic_add)
|
||||
#ifdef __powerpc__
|
||||
#warning IMPLEMENT GCC 64-bit ATOMICS ON POWERPC 32-bit!
|
||||
|
||||
/* int atomic_and(int *value, int andValue)
|
||||
* (r3) r3 r4
|
||||
/* These are to fill in 64-bit atomic calls emitted by
|
||||
* by GCC when 64-bit atomics are unavailable.
|
||||
* (aka, on 32-bit PowerPC
|
||||
*/
|
||||
FUNCTION(atomic_and):
|
||||
lost2: lwarx %r5, 0, %r3
|
||||
and %r0, %r5, %r4
|
||||
stwcx. %r0, 0, %r3
|
||||
bne- lost2
|
||||
mr %r3, %r5
|
||||
blr
|
||||
FUNCTION_END(atomic_and)
|
||||
|
||||
/* int atomic_or(int *value, int orValue)
|
||||
* (r3) r3 r4
|
||||
*/
|
||||
FUNCTION(atomic_or):
|
||||
lost3: lwarx %r5, 0, %r3
|
||||
or %r0, %r5, %r4
|
||||
stwcx. %r0, 0, %r3
|
||||
bne- lost3
|
||||
mr %r3, %r5
|
||||
blr
|
||||
FUNCTION_END(atomic_or)
|
||||
FUNCTION(__atomic_fetch_add_8):
|
||||
sync
|
||||
blr
|
||||
FUNCTION_END(__atomic_fetch_add_8)
|
||||
|
||||
/* int atomic_set(int *value, int setTo)
|
||||
* (r3) r3 r4
|
||||
*/
|
||||
FUNCTION(atomic_set):
|
||||
lost4: lwarx %r5, 0, %r3
|
||||
stwcx. %r4, 0, %r3
|
||||
bne- lost4
|
||||
mr %r3, %r5
|
||||
blr
|
||||
FUNCTION_END(atomic_set)
|
||||
FUNCTION(__atomic_store_8):
|
||||
sync
|
||||
blr
|
||||
FUNCTION_END(__atomic_store_8)
|
||||
|
||||
/* 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
|
||||
FUNCTION_END(atomic_test_and_set)
|
||||
FUNCTION(__atomic_load_8):
|
||||
sync
|
||||
blr
|
||||
FUNCTION_END(__atomic_load_8)
|
||||
|
||||
// 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
|
||||
*/
|
||||
FUNCTION(atomic_get):
|
||||
lost6: lwarx %r5, 0, %r3
|
||||
stwcx. %r5, 0, %r3
|
||||
bne- lost6
|
||||
mr %r3, %r5
|
||||
blr
|
||||
FUNCTION_END(atomic_get)
|
||||
#endif /* __powerpc__ */
|
||||
|
Loading…
Reference in New Issue
Block a user