| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * atomic64_t for 586+ |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright © 2010 Luca Barbieri |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/linkage.h> |
|---|
| 13 | | -#include <asm/alternative-asm.h> |
|---|
| 9 | +#include <asm/alternative.h> |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | .macro read64 reg |
|---|
| 16 | 12 | movl %ebx, %eax |
|---|
| .. | .. |
|---|
| 20 | 16 | cmpxchg8b (\reg) |
|---|
| 21 | 17 | .endm |
|---|
| 22 | 18 | |
|---|
| 23 | | -ENTRY(atomic64_read_cx8) |
|---|
| 19 | +SYM_FUNC_START(atomic64_read_cx8) |
|---|
| 24 | 20 | read64 %ecx |
|---|
| 25 | | - ret |
|---|
| 26 | | -ENDPROC(atomic64_read_cx8) |
|---|
| 21 | + RET |
|---|
| 22 | +SYM_FUNC_END(atomic64_read_cx8) |
|---|
| 27 | 23 | |
|---|
| 28 | | -ENTRY(atomic64_set_cx8) |
|---|
| 24 | +SYM_FUNC_START(atomic64_set_cx8) |
|---|
| 29 | 25 | 1: |
|---|
| 30 | 26 | /* we don't need LOCK_PREFIX since aligned 64-bit writes |
|---|
| 31 | 27 | * are atomic on 586 and newer */ |
|---|
| 32 | 28 | cmpxchg8b (%esi) |
|---|
| 33 | 29 | jne 1b |
|---|
| 34 | 30 | |
|---|
| 35 | | - ret |
|---|
| 36 | | -ENDPROC(atomic64_set_cx8) |
|---|
| 31 | + RET |
|---|
| 32 | +SYM_FUNC_END(atomic64_set_cx8) |
|---|
| 37 | 33 | |
|---|
| 38 | | -ENTRY(atomic64_xchg_cx8) |
|---|
| 34 | +SYM_FUNC_START(atomic64_xchg_cx8) |
|---|
| 39 | 35 | 1: |
|---|
| 40 | 36 | LOCK_PREFIX |
|---|
| 41 | 37 | cmpxchg8b (%esi) |
|---|
| 42 | 38 | jne 1b |
|---|
| 43 | 39 | |
|---|
| 44 | | - ret |
|---|
| 45 | | -ENDPROC(atomic64_xchg_cx8) |
|---|
| 40 | + RET |
|---|
| 41 | +SYM_FUNC_END(atomic64_xchg_cx8) |
|---|
| 46 | 42 | |
|---|
| 47 | 43 | .macro addsub_return func ins insc |
|---|
| 48 | | -ENTRY(atomic64_\func\()_return_cx8) |
|---|
| 44 | +SYM_FUNC_START(atomic64_\func\()_return_cx8) |
|---|
| 49 | 45 | pushl %ebp |
|---|
| 50 | 46 | pushl %ebx |
|---|
| 51 | 47 | pushl %esi |
|---|
| .. | .. |
|---|
| 72 | 68 | popl %esi |
|---|
| 73 | 69 | popl %ebx |
|---|
| 74 | 70 | popl %ebp |
|---|
| 75 | | - ret |
|---|
| 76 | | -ENDPROC(atomic64_\func\()_return_cx8) |
|---|
| 71 | + RET |
|---|
| 72 | +SYM_FUNC_END(atomic64_\func\()_return_cx8) |
|---|
| 77 | 73 | .endm |
|---|
| 78 | 74 | |
|---|
| 79 | 75 | addsub_return add add adc |
|---|
| 80 | 76 | addsub_return sub sub sbb |
|---|
| 81 | 77 | |
|---|
| 82 | 78 | .macro incdec_return func ins insc |
|---|
| 83 | | -ENTRY(atomic64_\func\()_return_cx8) |
|---|
| 79 | +SYM_FUNC_START(atomic64_\func\()_return_cx8) |
|---|
| 84 | 80 | pushl %ebx |
|---|
| 85 | 81 | |
|---|
| 86 | 82 | read64 %esi |
|---|
| .. | .. |
|---|
| 97 | 93 | movl %ebx, %eax |
|---|
| 98 | 94 | movl %ecx, %edx |
|---|
| 99 | 95 | popl %ebx |
|---|
| 100 | | - ret |
|---|
| 101 | | -ENDPROC(atomic64_\func\()_return_cx8) |
|---|
| 96 | + RET |
|---|
| 97 | +SYM_FUNC_END(atomic64_\func\()_return_cx8) |
|---|
| 102 | 98 | .endm |
|---|
| 103 | 99 | |
|---|
| 104 | 100 | incdec_return inc add adc |
|---|
| 105 | 101 | incdec_return dec sub sbb |
|---|
| 106 | 102 | |
|---|
| 107 | | -ENTRY(atomic64_dec_if_positive_cx8) |
|---|
| 103 | +SYM_FUNC_START(atomic64_dec_if_positive_cx8) |
|---|
| 108 | 104 | pushl %ebx |
|---|
| 109 | 105 | |
|---|
| 110 | 106 | read64 %esi |
|---|
| .. | .. |
|---|
| 122 | 118 | movl %ebx, %eax |
|---|
| 123 | 119 | movl %ecx, %edx |
|---|
| 124 | 120 | popl %ebx |
|---|
| 125 | | - ret |
|---|
| 126 | | -ENDPROC(atomic64_dec_if_positive_cx8) |
|---|
| 121 | + RET |
|---|
| 122 | +SYM_FUNC_END(atomic64_dec_if_positive_cx8) |
|---|
| 127 | 123 | |
|---|
| 128 | | -ENTRY(atomic64_add_unless_cx8) |
|---|
| 124 | +SYM_FUNC_START(atomic64_add_unless_cx8) |
|---|
| 129 | 125 | pushl %ebp |
|---|
| 130 | 126 | pushl %ebx |
|---|
| 131 | 127 | /* these just push these two parameters on the stack */ |
|---|
| .. | .. |
|---|
| 153 | 149 | addl $8, %esp |
|---|
| 154 | 150 | popl %ebx |
|---|
| 155 | 151 | popl %ebp |
|---|
| 156 | | - ret |
|---|
| 152 | + RET |
|---|
| 157 | 153 | 4: |
|---|
| 158 | 154 | cmpl %edx, 4(%esp) |
|---|
| 159 | 155 | jne 2b |
|---|
| 160 | 156 | xorl %eax, %eax |
|---|
| 161 | 157 | jmp 3b |
|---|
| 162 | | -ENDPROC(atomic64_add_unless_cx8) |
|---|
| 158 | +SYM_FUNC_END(atomic64_add_unless_cx8) |
|---|
| 163 | 159 | |
|---|
| 164 | | -ENTRY(atomic64_inc_not_zero_cx8) |
|---|
| 160 | +SYM_FUNC_START(atomic64_inc_not_zero_cx8) |
|---|
| 165 | 161 | pushl %ebx |
|---|
| 166 | 162 | |
|---|
| 167 | 163 | read64 %esi |
|---|
| .. | .. |
|---|
| 180 | 176 | movl $1, %eax |
|---|
| 181 | 177 | 3: |
|---|
| 182 | 178 | popl %ebx |
|---|
| 183 | | - ret |
|---|
| 184 | | -ENDPROC(atomic64_inc_not_zero_cx8) |
|---|
| 179 | + RET |
|---|
| 180 | +SYM_FUNC_END(atomic64_inc_not_zero_cx8) |
|---|