Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | .section ".text",#alloc,#execinstr |
michael@0 | 2 | .align 8 |
michael@0 | 3 | .skip 16 |
michael@0 | 4 | |
michael@0 | 5 | ! int _STLP_atomic_exchange (void *pvalue, int value) |
michael@0 | 6 | ! |
michael@0 | 7 | |
michael@0 | 8 | .type _STLP_atomic_exchange,#function |
michael@0 | 9 | .global _STLP_atomic_exchange |
michael@0 | 10 | .align 8 |
michael@0 | 11 | |
michael@0 | 12 | _STLP_atomic_exchange: |
michael@0 | 13 | 1: |
michael@0 | 14 | ldx [%o0], %o2 ! Set the current value |
michael@0 | 15 | mov %o1, %o3 ! Set the new value |
michael@0 | 16 | casx [%o0], %o2, %o3 ! Do the compare and swap |
michael@0 | 17 | cmp %o2, %o3 ! Check whether successful |
michael@0 | 18 | bne 1b ! Retry upon failure |
michael@0 | 19 | membar #LoadLoad | #LoadStore ! Ensure the cas finishes before |
michael@0 | 20 | ! returning |
michael@0 | 21 | retl ! return |
michael@0 | 22 | mov %o2, %o0 ! Set the new value |
michael@0 | 23 | .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange) |
michael@0 | 24 | |
michael@0 | 25 | |
michael@0 | 26 | ! int _STLP_atomic_increment (void *pvalue) |
michael@0 | 27 | |
michael@0 | 28 | .type _STLP_atomic_increment,#function |
michael@0 | 29 | .global _STLP_atomic_increment |
michael@0 | 30 | .align 8 |
michael@0 | 31 | _STLP_atomic_increment: |
michael@0 | 32 | 0: |
michael@0 | 33 | ldx [%o0], %o2 ! set the current |
michael@0 | 34 | addx %o2, 0x1, %o3 ! Increment and store current |
michael@0 | 35 | casx [%o0], %o2, %o3 ! Do the compare and swap |
michael@0 | 36 | cmp %o3, %o2 ! Check whether successful |
michael@0 | 37 | bne 0b |
michael@0 | 38 | membar #LoadLoad | #LoadStore ! Ensure the cas finishes before |
michael@0 | 39 | ! returning |
michael@0 | 40 | retl ! return |
michael@0 | 41 | mov %o1, %o0 ! Set the return value |
michael@0 | 42 | |
michael@0 | 43 | .size _STLP_atomic_increment,(.-_STLP_atomic_increment) |
michael@0 | 44 | |
michael@0 | 45 | |
michael@0 | 46 | ! /* int _STLP_atomic_decrement (void *pvalue) */ |
michael@0 | 47 | .type _STLP_atomic_decrement,#function |
michael@0 | 48 | .global _STLP_atomic_decrement |
michael@0 | 49 | .align 8 |
michael@0 | 50 | |
michael@0 | 51 | _STLP_atomic_decrement: |
michael@0 | 52 | 0: |
michael@0 | 53 | ldx [%o0], %o2 ! set the current |
michael@0 | 54 | subx %o2, 0x1, %o3 ! decrement and store current |
michael@0 | 55 | casx [%o0], %o2, %o3 ! Do the compare and swap |
michael@0 | 56 | cmp %o3, %o2 ! Check whether successful |
michael@0 | 57 | bne 0b |
michael@0 | 58 | membar #LoadLoad | #LoadStore ! Ensure the cas finishes before |
michael@0 | 59 | ! returning |
michael@0 | 60 | retl ! return |
michael@0 | 61 | nop |
michael@0 | 62 | .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement) |
michael@0 | 63 | |
michael@0 | 64 | |
michael@0 | 65 |