4 * Copied from arch/x86/lib/atomic64_cx8_32.S
6 * Copyright © 2010 Luca Barbieri
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
15 #include <linux/linkage.h>
16 #include <asm/alternative-asm.h>
17 #include <asm/dwarf2.h>
21 CFI_REL_OFFSET \reg, 0
32 /* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */
37 ENTRY(atomic64_read_cx8)
43 ENDPROC(atomic64_read_cx8)
45 ENTRY(atomic64_set_cx8)
49 /* we don't need LOCK_PREFIX since aligned 64-bit writes
50 * are atomic on 586 and newer */
56 ENDPROC(atomic64_set_cx8)
58 ENTRY(atomic64_xchg_cx8)
70 ENDPROC(atomic64_xchg_cx8)
72 .macro addsub_return func ins insc
73 ENTRY(atomic64_\func\()_return_cx8)
103 ENDPROC(atomic64_\func\()_return_cx8)
106 addsub_return add add adc
107 addsub_return sub sub sbb
109 .macro incdec_return func ins insc
110 ENTRY(atomic64_\func\()_return_cx8)
130 ENDPROC(atomic64_\func\()_return_cx8)
133 incdec_return inc add adc
134 incdec_return dec sub sbb
136 ENTRY(atomic64_dec_if_positive_cx8)
157 ENDPROC(atomic64_dec_if_positive_cx8)
159 ENTRY(atomic64_add_unless_cx8)
163 /* these just push these two parameters on the stack */
187 CFI_ADJUST_CFA_OFFSET -8
197 ENDPROC(atomic64_add_unless_cx8)
199 ENTRY(atomic64_inc_not_zero_cx8)
225 ENDPROC(atomic64_inc_not_zero_cx8)