X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..440d4c6cfad24426bfddca7518f16c17f4e443f7:/libkern/gen/OSAtomicOperations.c diff --git a/libkern/gen/OSAtomicOperations.c b/libkern/gen/OSAtomicOperations.c index aeeb09364..cfb15c5c1 100644 --- a/libkern/gen/OSAtomicOperations.c +++ b/libkern/gen/OSAtomicOperations.c @@ -54,51 +54,11 @@ enum { * Like standards, there are a lot of atomic ops to choose from! */ -#if !defined(__ppc__) && !defined(__i386__) && !defined(__x86_64__) -/* Implemented in assembly for ppc and i386 and x86_64 */ -#undef OSAddAtomic -SInt32 -OSAddAtomic(SInt32 amount, volatile SInt32 * value) -{ - SInt32 oldValue; - SInt32 newValue; - - do { - oldValue = *value; - newValue = oldValue + amount; - } while (!OSCompareAndSwap((UInt32)oldValue, - (UInt32)newValue, - (volatile UInt32 *) value)); - return oldValue; -} - -long -OSAddAtomicLong(long theAmount, volatile long *address) -{ -#if __LP64__ -#error Unimplemented +#if defined(__i386__) || defined(__x86_64__) +/* Implemented in assembly for i386 and x86_64 */ #else - return (long)OSAddAtomic((SInt32)theAmount, address); +#error Unsupported arch #endif -} - -/* Implemented as an assembly alias for i386 and linker alias for ppc */ -#undef OSCompareAndSwapPtr -Boolean OSCompareAndSwapPtr(void *oldValue, void *newValue, - void * volatile *address) -{ -#if __LP64__ - return OSCompareAndSwap64((UInt64)oldValue, (UInt64)newValue, - (volatile UInt64 *)address); -#else - return OSCompareAndSwap((UInt32)oldValue, (UInt32)newValue, - (volatile UInt32 *)address); -#endif -} -#endif - -#ifndef __ppc__ -/* Implemented as assembly for ppc */ #undef OSIncrementAtomic SInt32 OSIncrementAtomic(volatile SInt32 * value) @@ -111,7 +71,6 @@ SInt32 OSDecrementAtomic(volatile SInt32 * value) { return OSAddAtomic(-1, value); } -#endif /* !__ppc__ */ static UInt32 OSBitwiseAtomic(UInt32 and_mask, UInt32 or_mask, UInt32 xor_mask, volatile UInt32 * value) {