1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Copyright © 2010 Luca Barbieri
8 #include <linux/linkage.h>
9 #include <asm/alternative.h>
14 /* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */
19 SYM_FUNC_START(atomic64_read_cx8)
22 SYM_FUNC_END(atomic64_read_cx8)
24 SYM_FUNC_START(atomic64_set_cx8)
26 /* we don't need LOCK_PREFIX since aligned 64-bit writes
27 * are atomic on 586 and newer */
32 SYM_FUNC_END(atomic64_set_cx8)
34 SYM_FUNC_START(atomic64_xchg_cx8)
41 SYM_FUNC_END(atomic64_xchg_cx8)
43 .macro addsub_return func ins insc
44 SYM_FUNC_START(atomic64_\func\()_return_cx8)
72 SYM_FUNC_END(atomic64_\func\()_return_cx8)
75 addsub_return add add adc
76 addsub_return sub sub sbb
78 .macro incdec_return func ins insc
79 SYM_FUNC_START(atomic64_\func\()_return_cx8)
97 SYM_FUNC_END(atomic64_\func\()_return_cx8)
100 incdec_return inc add adc
101 incdec_return dec sub sbb
103 SYM_FUNC_START(atomic64_dec_if_positive_cx8)
122 SYM_FUNC_END(atomic64_dec_if_positive_cx8)
124 SYM_FUNC_START(atomic64_add_unless_cx8)
127 /* these just push these two parameters on the stack */
158 SYM_FUNC_END(atomic64_add_unless_cx8)
160 SYM_FUNC_START(atomic64_inc_not_zero_cx8)
180 SYM_FUNC_END(atomic64_inc_not_zero_cx8)