;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.macro ENTRY
- .text
- .align 2
- .globl $0
+ .text
+ .align 2
+ .globl $0
$0:
.endmacro
/*
int OSCompareAndSwap( UInt32 oldVal, UInt32 newVal, UInt32 * addr )
+This is now an alias to hw_compare_and_store, see xnu/libkern/Makefile
*/
-
- ENTRY _OSCompareAndSwap
-.L_CASretry:
- lwarx r6, 0,r5
- cmpw r6, r3
- bne- .L_CASfail
- stwcx. r4, 0,r5
- bne- .L_CASretry
- isync
- li r3, 1
- blr
-.L_CASfail:
- li r3, 0
- blr
-
-
+/*
+Note: We can not use the hw_atomic routines provided by osfmk/ppc as
+the return the result of the addition not the original value.
+*/
/*
SInt32 OSDecrementAtomic(SInt32 * value)
*/
- ENTRY _OSDecrementAtomic
- mr r4, r3
- li r3, -1
- b _OSAddAtomic
+ ENTRY _OSDecrementAtomic
+ mr r4, r3
+ li r3, -1
+ b _OSAddAtomic
/*
SInt32 OSIncrementAtomic(SInt32 * value)
*/
- ENTRY _OSIncrementAtomic
- mr r4, r3
- li r3, 1
+ .align 5
+
+ ENTRY _OSIncrementAtomic
+ mr r4, r3
+ li r3, 1
/*
SInt32 OSAddAtomic(SInt32 amount, SInt32 * value)
*/
- ENTRY _OSAddAtomic
+ ENTRY _OSAddAtomic
- mr r5,r3 /* Save the increment */
+ mr r5,r3 /* Save the increment */
.L_AAretry:
- lwarx r3, 0, r4 /* Grab the area value */
- add r6, r3, r5 /* Add the value */
- stwcx. r6, 0, r4 /* Try to save the new value */
- bne- .L_AAretry /* Didn't get it, try again... */
- blr /* Return the original value */
+ lwarx r3, 0, r4 /* Grab the area value */
+ add r6, r3, r5 /* Add the value */
+ stwcx. r6, 0, r4 /* Try to save the new value */
+ bne- .L_AAretry /* Didn't get it, try again... */
+ blr /* Return the original value */