637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
|
|
|
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&d"(r) /* use d instead of r due to gcc bug */
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
|
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
|
|
|
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&d"(r) /* use d instead of r due to gcc bug */
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
|
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&r"(r)
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}
|
|
|
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
|
__asm__ (
"xorl %0, %0\n\t"
"lock\n\t"
"cmpxchg %2, %3\n\t"
"sete %b0\n\t"
"movzbl %b0, %0"
: "=&d"(r) /* use d instead of r due to gcc bug */
: "a"(o), "r"(n), "m"(*p)
);
return r;
#elif defined(OF_HAVE_GCC_ATOMIC_OPS)
return __sync_bool_compare_and_swap(p, o, n);
#elif defined(OF_HAVE_OSATOMIC)
return OSAtomicCompareAndSwapPtrBarrier(o, n, p);
#endif
}
|