Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\atomic64_test.c Create Date:2022-07-28 07:17:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:test_atomic64

Proto:static __init void test_atomic64(void)

Type:void

Parameter:Nothing

149  v0 = 0xaaa31337c001d00dLL
150  v1 = 0xdeadbeefdeafcafeLL
151  v2 = 0xfaceabadf00df001LL
152  v3 = 0x8000000000000000LL
153  onestwos = 0x1111111122222222LL
154  one = 1LL
157  v = ATOMIC64_INIT(v0)
158  r = v0
159  BUG_ON(counter != r)
161  atomic64_set( & v, v1)
162  r = v1
163  BUG_ON(counter != r)
164  BUG_ON(atomic64_read( & v) != r)
166  TEST(64, add, += , onestwos)
167  TEST(64, add, += , - one)
168  TEST(64, sub, -= , onestwos)
169  TEST(64, sub, -= , - one)
170  TEST(64, or, |= , v1)
171  TEST(64, and, &= , v1)
172  TEST(64, xor, ^= , v1)
173  TEST(64, andnot, &= ~, v1)
175  RETURN_FAMILY_TEST(64, add_return, += , onestwos)
176  RETURN_FAMILY_TEST(64, add_return, += , - one)
177  RETURN_FAMILY_TEST(64, sub_return, -= , onestwos)
178  RETURN_FAMILY_TEST(64, sub_return, -= , - one)
180  FETCH_FAMILY_TEST(64, fetch_add, += , onestwos)
181  FETCH_FAMILY_TEST(64, fetch_add, += , - one)
182  FETCH_FAMILY_TEST(64, fetch_sub, -= , onestwos)
183  FETCH_FAMILY_TEST(64, fetch_sub, -= , - one)
185  FETCH_FAMILY_TEST(64, fetch_or, |= , v1)
186  FETCH_FAMILY_TEST(64, fetch_and, &= , v1)
187  FETCH_FAMILY_TEST(64, fetch_andnot, &= ~, v1)
188  FETCH_FAMILY_TEST(64, fetch_xor, ^= , v1)
190  INIT(v0)
191  atomic64_inc( & v)
192  r += one
193  BUG_ON(counter != r)
195  INIT(v0)
196  atomic64_dec( & v)
197  r -= one
198  BUG_ON(counter != r)
200  INC_RETURN_FAMILY_TEST(64, v0)
201  DEC_RETURN_FAMILY_TEST(64, v0)
203  XCHG_FAMILY_TEST(64, v0, v1)
204  CMPXCHG_FAMILY_TEST(64, v0, v1, v2)
206  INIT(v0)
207  BUG_ON(atomic64_add_unless - add unless the number is already a given value*@v: pointer of type atomic64_t*@a: the amount to add to v...*@u: ...unless v is equal to u.* Atomically adds @a to @v, if @v was not already @u.* Returns true if the addition was done.)
208  BUG_ON(counter != r)
210  INIT(v0)
211  BUG_ON(!atomic64_add_unless - add unless the number is already a given value*@v: pointer of type atomic64_t*@a: the amount to add to v...*@u: ...unless v is equal to u.* Atomically adds @a to @v, if @v was not already @u.* Returns true if the addition was done.)
212  r += one
213  BUG_ON(counter != r)
215  INIT(onestwos)
216  BUG_ON(atomic64_dec_if_positive( & v) != (onestwos - 1))
217  r -= one
218  BUG_ON(counter != r)
220  INIT(0)
221  BUG_ON(atomic64_dec_if_positive( & v) != - one)
222  BUG_ON(counter != r)
224  INIT( - one)
225  BUG_ON(atomic64_dec_if_positive( & v) != ( - one - one))
226  BUG_ON(counter != r)
228  INIT(onestwos)
229  BUG_ON(!atomic64_inc_not_zero( & v))
230  r += one
231  BUG_ON(counter != r)
233  INIT(0)
234  BUG_ON(atomic64_inc_not_zero( & v))
235  BUG_ON(counter != r)
237  INIT( - one)
238  BUG_ON(!atomic64_inc_not_zero( & v))
239  r += one
240  BUG_ON(counter != r)
243  INIT(v3)
244  r_int = atomic64_inc_not_zero( & v)
245  BUG_ON(!r_int)
Caller
NameDescribe
test_atomics_init