1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/stlport/src/sparc_atomic64.s Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 + .section ".text",#alloc,#execinstr 1.5 + .align 8 1.6 + .skip 16 1.7 + 1.8 +! int _STLP_atomic_exchange (void *pvalue, int value) 1.9 +! 1.10 + 1.11 + .type _STLP_atomic_exchange,#function 1.12 + .global _STLP_atomic_exchange 1.13 + .align 8 1.14 + 1.15 +_STLP_atomic_exchange: 1.16 +1: 1.17 + ldx [%o0], %o2 ! Set the current value 1.18 + mov %o1, %o3 ! Set the new value 1.19 + casx [%o0], %o2, %o3 ! Do the compare and swap 1.20 + cmp %o2, %o3 ! Check whether successful 1.21 + bne 1b ! Retry upon failure 1.22 + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before 1.23 + ! returning 1.24 + retl ! return 1.25 + mov %o2, %o0 ! Set the new value 1.26 + .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange) 1.27 + 1.28 + 1.29 +! int _STLP_atomic_increment (void *pvalue) 1.30 + 1.31 + .type _STLP_atomic_increment,#function 1.32 + .global _STLP_atomic_increment 1.33 + .align 8 1.34 +_STLP_atomic_increment: 1.35 +0: 1.36 + ldx [%o0], %o2 ! set the current 1.37 + addx %o2, 0x1, %o3 ! Increment and store current 1.38 + casx [%o0], %o2, %o3 ! Do the compare and swap 1.39 + cmp %o3, %o2 ! Check whether successful 1.40 + bne 0b 1.41 + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before 1.42 + ! returning 1.43 + retl ! return 1.44 + mov %o1, %o0 ! Set the return value 1.45 + 1.46 + .size _STLP_atomic_increment,(.-_STLP_atomic_increment) 1.47 + 1.48 + 1.49 +! /* int _STLP_atomic_decrement (void *pvalue) */ 1.50 + .type _STLP_atomic_decrement,#function 1.51 + .global _STLP_atomic_decrement 1.52 + .align 8 1.53 + 1.54 +_STLP_atomic_decrement: 1.55 +0: 1.56 + ldx [%o0], %o2 ! set the current 1.57 + subx %o2, 0x1, %o3 ! decrement and store current 1.58 + casx [%o0], %o2, %o3 ! Do the compare and swap 1.59 + cmp %o3, %o2 ! Check whether successful 1.60 + bne 0b 1.61 + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before 1.62 + ! returning 1.63 + retl ! return 1.64 + nop 1.65 + .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement) 1.66 + 1.67 + 1.68 +