]> git.saurik.com Git - apple/libc.git/blobdiff - ppc/sys/OSAtomic.s
Libc-498.1.7.tar.gz
[apple/libc.git] / ppc / sys / OSAtomic.s
index 24858e901e314c389dfaa153470ef83c30da571b..8ce3cd11ab8c49ce14b2fc7d39ee4b5cb327edcf 100644 (file)
 
 /* int32_t     OSAtomicAdd32( int32_t theAmount, int32_t *theValue ); */
 
+#if defined(__ppc__)
 MI_ENTRY_POINT(_OSAtomicAdd32)
     ba      _COMM_PAGE_ATOMIC_ADD32
+#elif defined(__ppc64__)
+MI_ENTRY_POINT(_OSAtomicAdd32)
+    mflr    r12                        // save return address
+    bla            _COMM_PAGE_ATOMIC_ADD32
+    mtlr    r12
+    extsw   r3,r3              // sign extend return value
+    blr
+#else
+#error undefined architecture
+#endif
 
 
 /* int32_t     OSAtomicOr32( int32_t theMask, int32_t *theValue ); */
@@ -240,7 +251,13 @@ MI_ENTRY_POINT(_OSAtomicAdd32Barrier)
     cmpwi   r3,0                // did swap occur?
     beq--   1b                  // compare-and-swap failed, try again
     mtlr    r12                 // restore return adddress
+#if defined(__ppc__)
     mr      r3,r4               // return new value
+#elif defined(__ppc64__)
+    extsw   r3,r4              // sign extend return value
+#else
+#error undefined architecture
+#endif
     blr