hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/x86/lib/atomic64_386_32.S
....@@ -1,93 +1,91 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * atomic64_t for 386/486
34 *
45 * 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.
106 */
117
128 #include <linux/linkage.h>
13
-#include <asm/alternative-asm.h>
9
+#include <asm/alternative.h>
1410
1511 /* if you want SMP support, implement these with real spinlocks */
16
-.macro LOCK reg
12
+.macro IRQ_SAVE reg
1713 pushfl
1814 cli
1915 .endm
2016
21
-.macro UNLOCK reg
17
+.macro IRQ_RESTORE reg
2218 popfl
2319 .endm
2420
25
-#define BEGIN(op) \
21
+#define BEGIN_IRQ_SAVE(op) \
2622 .macro endp; \
27
-ENDPROC(atomic64_##op##_386); \
23
+SYM_FUNC_END(atomic64_##op##_386); \
2824 .purgem endp; \
2925 .endm; \
30
-ENTRY(atomic64_##op##_386); \
31
- LOCK v;
26
+SYM_FUNC_START(atomic64_##op##_386); \
27
+ IRQ_SAVE v;
3228
3329 #define ENDP endp
3430
35
-#define RET \
36
- UNLOCK v; \
37
- ret
38
-
39
-#define RET_ENDP \
40
- RET; \
41
- ENDP
31
+#define RET_IRQ_RESTORE \
32
+ IRQ_RESTORE v; \
33
+ RET
4234
4335 #define v %ecx
44
-BEGIN(read)
36
+BEGIN_IRQ_SAVE(read)
4537 movl (v), %eax
4638 movl 4(v), %edx
47
-RET_ENDP
39
+ RET_IRQ_RESTORE
40
+ENDP
4841 #undef v
4942
5043 #define v %esi
51
-BEGIN(set)
44
+BEGIN_IRQ_SAVE(set)
5245 movl %ebx, (v)
5346 movl %ecx, 4(v)
54
-RET_ENDP
47
+ RET_IRQ_RESTORE
48
+ENDP
5549 #undef v
5650
5751 #define v %esi
58
-BEGIN(xchg)
52
+BEGIN_IRQ_SAVE(xchg)
5953 movl (v), %eax
6054 movl 4(v), %edx
6155 movl %ebx, (v)
6256 movl %ecx, 4(v)
63
-RET_ENDP
57
+ RET_IRQ_RESTORE
58
+ENDP
6459 #undef v
6560
6661 #define v %ecx
67
-BEGIN(add)
62
+BEGIN_IRQ_SAVE(add)
6863 addl %eax, (v)
6964 adcl %edx, 4(v)
70
-RET_ENDP
65
+ RET_IRQ_RESTORE
66
+ENDP
7167 #undef v
7268
7369 #define v %ecx
74
-BEGIN(add_return)
70
+BEGIN_IRQ_SAVE(add_return)
7571 addl (v), %eax
7672 adcl 4(v), %edx
7773 movl %eax, (v)
7874 movl %edx, 4(v)
79
-RET_ENDP
75
+ RET_IRQ_RESTORE
76
+ENDP
8077 #undef v
8178
8279 #define v %ecx
83
-BEGIN(sub)
80
+BEGIN_IRQ_SAVE(sub)
8481 subl %eax, (v)
8582 sbbl %edx, 4(v)
86
-RET_ENDP
83
+ RET_IRQ_RESTORE
84
+ENDP
8785 #undef v
8886
8987 #define v %ecx
90
-BEGIN(sub_return)
88
+BEGIN_IRQ_SAVE(sub_return)
9189 negl %edx
9290 negl %eax
9391 sbbl $0, %edx
....@@ -95,47 +93,52 @@
9593 adcl 4(v), %edx
9694 movl %eax, (v)
9795 movl %edx, 4(v)
98
-RET_ENDP
96
+ RET_IRQ_RESTORE
97
+ENDP
9998 #undef v
10099
101100 #define v %esi
102
-BEGIN(inc)
101
+BEGIN_IRQ_SAVE(inc)
103102 addl $1, (v)
104103 adcl $0, 4(v)
105
-RET_ENDP
104
+ RET_IRQ_RESTORE
105
+ENDP
106106 #undef v
107107
108108 #define v %esi
109
-BEGIN(inc_return)
109
+BEGIN_IRQ_SAVE(inc_return)
110110 movl (v), %eax
111111 movl 4(v), %edx
112112 addl $1, %eax
113113 adcl $0, %edx
114114 movl %eax, (v)
115115 movl %edx, 4(v)
116
-RET_ENDP
116
+ RET_IRQ_RESTORE
117
+ENDP
117118 #undef v
118119
119120 #define v %esi
120
-BEGIN(dec)
121
+BEGIN_IRQ_SAVE(dec)
121122 subl $1, (v)
122123 sbbl $0, 4(v)
123
-RET_ENDP
124
+ RET_IRQ_RESTORE
125
+ENDP
124126 #undef v
125127
126128 #define v %esi
127
-BEGIN(dec_return)
129
+BEGIN_IRQ_SAVE(dec_return)
128130 movl (v), %eax
129131 movl 4(v), %edx
130132 subl $1, %eax
131133 sbbl $0, %edx
132134 movl %eax, (v)
133135 movl %edx, 4(v)
134
-RET_ENDP
136
+ RET_IRQ_RESTORE
137
+ENDP
135138 #undef v
136139
137140 #define v %esi
138
-BEGIN(add_unless)
141
+BEGIN_IRQ_SAVE(add_unless)
139142 addl %eax, %ecx
140143 adcl %edx, %edi
141144 addl (v), %eax
....@@ -147,7 +150,7 @@
147150 movl %edx, 4(v)
148151 movl $1, %eax
149152 2:
150
- RET
153
+ RET_IRQ_RESTORE
151154 3:
152155 cmpl %edx, %edi
153156 jne 1b
....@@ -157,7 +160,7 @@
157160 #undef v
158161
159162 #define v %esi
160
-BEGIN(inc_not_zero)
163
+BEGIN_IRQ_SAVE(inc_not_zero)
161164 movl (v), %eax
162165 movl 4(v), %edx
163166 testl %eax, %eax
....@@ -169,7 +172,7 @@
169172 movl %edx, 4(v)
170173 movl $1, %eax
171174 2:
172
- RET
175
+ RET_IRQ_RESTORE
173176 3:
174177 testl %edx, %edx
175178 jne 1b
....@@ -178,7 +181,7 @@
178181 #undef v
179182
180183 #define v %esi
181
-BEGIN(dec_if_positive)
184
+BEGIN_IRQ_SAVE(dec_if_positive)
182185 movl (v), %eax
183186 movl 4(v), %edx
184187 subl $1, %eax
....@@ -187,5 +190,6 @@
187190 movl %eax, (v)
188191 movl %edx, 4(v)
189192 1:
190
-RET_ENDP
193
+ RET_IRQ_RESTORE
194
+ENDP
191195 #undef v