1 /* atomic.S: These things are too big to do inline.
3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
7 #include <asm/backoff.h>
11 /* Two versions of the atomic routines, one that
12 * does not return a value and does not perform
13 * memory barriers, and a second which returns
14 * a value and does the barriers.
17 .type atomic_add,#function
18 atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
24 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
28 2: BACKOFF_SPIN(%o2, %o3, 1b)
29 .size atomic_add, .-atomic_add
32 .type atomic_sub,#function
33 atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
39 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
43 2: BACKOFF_SPIN(%o2, %o3, 1b)
44 .size atomic_sub, .-atomic_sub
47 .type atomic_add_ret,#function
48 atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
54 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
58 2: BACKOFF_SPIN(%o2, %o3, 1b)
59 .size atomic_add_ret, .-atomic_add_ret
62 .type atomic_sub_ret,#function
63 atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
69 bne,pn %icc, BACKOFF_LABEL(2f, 1b)
73 2: BACKOFF_SPIN(%o2, %o3, 1b)
74 .size atomic_sub_ret, .-atomic_sub_ret
77 .type atomic64_add,#function
78 atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
84 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
88 2: BACKOFF_SPIN(%o2, %o3, 1b)
89 .size atomic64_add, .-atomic64_add
92 .type atomic64_sub,#function
93 atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
99 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
103 2: BACKOFF_SPIN(%o2, %o3, 1b)
104 .size atomic64_sub, .-atomic64_sub
106 .globl atomic64_add_ret
107 .type atomic64_add_ret,#function
108 atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
114 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
118 2: BACKOFF_SPIN(%o2, %o3, 1b)
119 .size atomic64_add_ret, .-atomic64_add_ret
121 .globl atomic64_sub_ret
122 .type atomic64_sub_ret,#function
123 atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
129 bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
133 2: BACKOFF_SPIN(%o2, %o3, 1b)
134 .size atomic64_sub_ret, .-atomic64_sub_ret