Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/lib/atomic64_386_32: Rename things

Principally, in order to get rid of #define RET in this code to make
place for a new RET, but also to clarify the code, rename a bunch of
things:

s/UNLOCK/IRQ_RESTORE/
s/LOCK/IRQ_SAVE/
s/BEGIN/BEGIN_IRQ_SAVE/
s/\<RET\>/RET_IRQ_RESTORE/
s/RET_ENDP/\tRET_IRQ_RESTORE\rENDP/

which then leaves RET unused so it can be removed.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211204134907.841623970@infradead.org

authored by

Peter Zijlstra and committed by
Borislav Petkov
22da5a07 68cf4f2a

+46 -38
+46 -38
arch/x86/lib/atomic64_386_32.S
··· 9 9 #include <asm/alternative.h> 10 10 11 11 /* if you want SMP support, implement these with real spinlocks */ 12 - .macro LOCK reg 12 + .macro IRQ_SAVE reg 13 13 pushfl 14 14 cli 15 15 .endm 16 16 17 - .macro UNLOCK reg 17 + .macro IRQ_RESTORE reg 18 18 popfl 19 19 .endm 20 20 21 - #define BEGIN(op) \ 21 + #define BEGIN_IRQ_SAVE(op) \ 22 22 .macro endp; \ 23 23 SYM_FUNC_END(atomic64_##op##_386); \ 24 24 .purgem endp; \ 25 25 .endm; \ 26 26 SYM_FUNC_START(atomic64_##op##_386); \ 27 - LOCK v; 27 + IRQ_SAVE v; 28 28 29 29 #define ENDP endp 30 30 31 - #define RET \ 32 - UNLOCK v; \ 31 + #define RET_IRQ_RESTORE \ 32 + IRQ_RESTORE v; \ 33 33 ret 34 34 35 - #define RET_ENDP \ 36 - RET; \ 37 - ENDP 38 - 39 35 #define v %ecx 40 - BEGIN(read) 36 + BEGIN_IRQ_SAVE(read) 41 37 movl (v), %eax 42 38 movl 4(v), %edx 43 - RET_ENDP 39 + RET_IRQ_RESTORE 40 + ENDP 44 41 #undef v 45 42 46 43 #define v %esi 47 - BEGIN(set) 44 + BEGIN_IRQ_SAVE(set) 48 45 movl %ebx, (v) 49 46 movl %ecx, 4(v) 50 - RET_ENDP 47 + RET_IRQ_RESTORE 48 + ENDP 51 49 #undef v 52 50 53 51 #define v %esi 54 - BEGIN(xchg) 52 + BEGIN_IRQ_SAVE(xchg) 55 53 movl (v), %eax 56 54 movl 4(v), %edx 57 55 movl %ebx, (v) 58 56 movl %ecx, 4(v) 59 - RET_ENDP 57 + RET_IRQ_RESTORE 58 + ENDP 60 59 #undef v 61 60 62 61 #define v %ecx 63 - BEGIN(add) 62 + BEGIN_IRQ_SAVE(add) 64 63 addl %eax, (v) 65 64 adcl %edx, 4(v) 66 - RET_ENDP 65 + RET_IRQ_RESTORE 66 + ENDP 67 67 #undef v 68 68 69 69 #define v %ecx 70 - BEGIN(add_return) 70 + BEGIN_IRQ_SAVE(add_return) 71 71 addl (v), %eax 72 72 adcl 4(v), %edx 73 73 movl %eax, (v) 74 74 movl %edx, 4(v) 75 - RET_ENDP 75 + RET_IRQ_RESTORE 76 + ENDP 76 77 #undef v 77 78 78 79 #define v %ecx 79 - BEGIN(sub) 80 + BEGIN_IRQ_SAVE(sub) 80 81 subl %eax, (v) 81 82 sbbl %edx, 4(v) 82 - RET_ENDP 83 + RET_IRQ_RESTORE 84 + ENDP 83 85 #undef v 84 86 85 87 #define v %ecx 86 - BEGIN(sub_return) 88 + BEGIN_IRQ_SAVE(sub_return) 87 89 negl %edx 88 90 negl %eax 89 91 sbbl $0, %edx ··· 93 91 adcl 4(v), %edx 94 92 movl %eax, (v) 95 93 movl %edx, 4(v) 96 - RET_ENDP 94 + RET_IRQ_RESTORE 95 + ENDP 97 96 #undef v 98 97 99 98 #define v %esi 100 - BEGIN(inc) 99 + BEGIN_IRQ_SAVE(inc) 101 100 addl $1, (v) 102 101 adcl $0, 4(v) 103 - RET_ENDP 102 + RET_IRQ_RESTORE 103 + ENDP 104 104 #undef v 105 105 106 106 #define v %esi 107 - BEGIN(inc_return) 107 + BEGIN_IRQ_SAVE(inc_return) 108 108 movl (v), %eax 109 109 movl 4(v), %edx 110 110 addl $1, %eax 111 111 adcl $0, %edx 112 112 movl %eax, (v) 113 113 movl %edx, 4(v) 114 - RET_ENDP 114 + RET_IRQ_RESTORE 115 + ENDP 115 116 #undef v 116 117 117 118 #define v %esi 118 - BEGIN(dec) 119 + BEGIN_IRQ_SAVE(dec) 119 120 subl $1, (v) 120 121 sbbl $0, 4(v) 121 - RET_ENDP 122 + RET_IRQ_RESTORE 123 + ENDP 122 124 #undef v 123 125 124 126 #define v %esi 125 - BEGIN(dec_return) 127 + BEGIN_IRQ_SAVE(dec_return) 126 128 movl (v), %eax 127 129 movl 4(v), %edx 128 130 subl $1, %eax 129 131 sbbl $0, %edx 130 132 movl %eax, (v) 131 133 movl %edx, 4(v) 132 - RET_ENDP 134 + RET_IRQ_RESTORE 135 + ENDP 133 136 #undef v 134 137 135 138 #define v %esi 136 - BEGIN(add_unless) 139 + BEGIN_IRQ_SAVE(add_unless) 137 140 addl %eax, %ecx 138 141 adcl %edx, %edi 139 142 addl (v), %eax ··· 150 143 movl %edx, 4(v) 151 144 movl $1, %eax 152 145 2: 153 - RET 146 + RET_IRQ_RESTORE 154 147 3: 155 148 cmpl %edx, %edi 156 149 jne 1b ··· 160 153 #undef v 161 154 162 155 #define v %esi 163 - BEGIN(inc_not_zero) 156 + BEGIN_IRQ_SAVE(inc_not_zero) 164 157 movl (v), %eax 165 158 movl 4(v), %edx 166 159 testl %eax, %eax ··· 172 165 movl %edx, 4(v) 173 166 movl $1, %eax 174 167 2: 175 - RET 168 + RET_IRQ_RESTORE 176 169 3: 177 170 testl %edx, %edx 178 171 jne 1b ··· 181 174 #undef v 182 175 183 176 #define v %esi 184 - BEGIN(dec_if_positive) 177 + BEGIN_IRQ_SAVE(dec_if_positive) 185 178 movl (v), %eax 186 179 movl 4(v), %edx 187 180 subl $1, %eax ··· 190 183 movl %eax, (v) 191 184 movl %edx, 4(v) 192 185 1: 193 - RET_ENDP 186 + RET_IRQ_RESTORE 187 + ENDP 194 188 #undef v