4
* int ATL_ResetAtomicCount(void *vp, int cnt)
6
* RETURNS: acnt before the reset
9
.global ATL_asmdecor(ATL_ResetAtomicCount)
10
ATL_asmdecor(ATL_ResetAtomicCount):
13
sub $-128, %edx /* skip false sharing guard zone */
15
movl (%edx), %eax /* read acnt from memory */
16
lock /* make cmpxchg atomic */
17
cmpxchg %ecx, (%edx) /* put cnt in mem if mem still == acnt in eax */
18
je DONE /* ZF set if cmpxchg wrote to mem */
19
jmp ATOMIC_LOOP /* ZF=0 means cmpxch failed, try again */