diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-22 12:23:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-22 12:23:57 -0400 |
commit | 1b674bf106f59e04e24b3825c2f08dcd9a5b7264 (patch) | |
tree | b90b52b692111f0be66eaf7efb040e35a6e763e3 /arch/x86/lib | |
parent | e17fdf5c6778ff77d93dd769910992e4073b9348 (diff) | |
parent | cb8095bba6d24118135a5683a956f4f4fb5f17bb (diff) |
Merge branch 'x86-atomic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/atomic changes from Ingo Molnar.
* 'x86-atomic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: atomic64 assembly improvements
x86: Adjust asm constraints in atomic64 wrappers
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/atomic64_32.c | 59 | ||||
-rw-r--r-- | arch/x86/lib/atomic64_386_32.S | 6 | ||||
-rw-r--r-- | arch/x86/lib/atomic64_cx8_32.S | 29 |
3 files changed, 16 insertions, 78 deletions
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c index 042f6826bf57..a0b4a350daa7 100644 --- a/arch/x86/lib/atomic64_32.c +++ b/arch/x86/lib/atomic64_32.c | |||
@@ -1,59 +1,4 @@ | |||
1 | #include <linux/compiler.h> | 1 | #define ATOMIC64_EXPORT EXPORT_SYMBOL |
2 | #include <linux/module.h> | ||
3 | #include <linux/types.h> | ||
4 | 2 | ||
5 | #include <asm/processor.h> | 3 | #include <linux/export.h> |
6 | #include <asm/cmpxchg.h> | ||
7 | #include <linux/atomic.h> | 4 | #include <linux/atomic.h> |
8 | |||
9 | long long atomic64_read_cx8(long long, const atomic64_t *v); | ||
10 | EXPORT_SYMBOL(atomic64_read_cx8); | ||
11 | long long atomic64_set_cx8(long long, const atomic64_t *v); | ||
12 | EXPORT_SYMBOL(atomic64_set_cx8); | ||
13 | long long atomic64_xchg_cx8(long long, unsigned high); | ||
14 | EXPORT_SYMBOL(atomic64_xchg_cx8); | ||
15 | long long atomic64_add_return_cx8(long long a, atomic64_t *v); | ||
16 | EXPORT_SYMBOL(atomic64_add_return_cx8); | ||
17 | long long atomic64_sub_return_cx8(long long a, atomic64_t *v); | ||
18 | EXPORT_SYMBOL(atomic64_sub_return_cx8); | ||
19 | long long atomic64_inc_return_cx8(long long a, atomic64_t *v); | ||
20 | EXPORT_SYMBOL(atomic64_inc_return_cx8); | ||
21 | long long atomic64_dec_return_cx8(long long a, atomic64_t *v); | ||
22 | EXPORT_SYMBOL(atomic64_dec_return_cx8); | ||
23 | long long atomic64_dec_if_positive_cx8(atomic64_t *v); | ||
24 | EXPORT_SYMBOL(atomic64_dec_if_positive_cx8); | ||
25 | int atomic64_inc_not_zero_cx8(atomic64_t *v); | ||
26 | EXPORT_SYMBOL(atomic64_inc_not_zero_cx8); | ||
27 | int atomic64_add_unless_cx8(atomic64_t *v, long long a, long long u); | ||
28 | EXPORT_SYMBOL(atomic64_add_unless_cx8); | ||
29 | |||
30 | #ifndef CONFIG_X86_CMPXCHG64 | ||
31 | long long atomic64_read_386(long long, const atomic64_t *v); | ||
32 | EXPORT_SYMBOL(atomic64_read_386); | ||
33 | long long atomic64_set_386(long long, const atomic64_t *v); | ||
34 | EXPORT_SYMBOL(atomic64_set_386); | ||
35 | long long atomic64_xchg_386(long long, unsigned high); | ||
36 | EXPORT_SYMBOL(atomic64_xchg_386); | ||
37 | long long atomic64_add_return_386(long long a, atomic64_t *v); | ||
38 | EXPORT_SYMBOL(atomic64_add_return_386); | ||
39 | long long atomic64_sub_return_386(long long a, atomic64_t *v); | ||
40 | EXPORT_SYMBOL(atomic64_sub_return_386); | ||
41 | long long atomic64_inc_return_386(long long a, atomic64_t *v); | ||
42 | EXPORT_SYMBOL(atomic64_inc_return_386); | ||
43 | long long atomic64_dec_return_386(long long a, atomic64_t *v); | ||
44 | EXPORT_SYMBOL(atomic64_dec_return_386); | ||
45 | long long atomic64_add_386(long long a, atomic64_t *v); | ||
46 | EXPORT_SYMBOL(atomic64_add_386); | ||
47 | long long atomic64_sub_386(long long a, atomic64_t *v); | ||
48 | EXPORT_SYMBOL(atomic64_sub_386); | ||
49 | long long atomic64_inc_386(long long a, atomic64_t *v); | ||
50 | EXPORT_SYMBOL(atomic64_inc_386); | ||
51 | long long atomic64_dec_386(long long a, atomic64_t *v); | ||
52 | EXPORT_SYMBOL(atomic64_dec_386); | ||
53 | long long atomic64_dec_if_positive_386(atomic64_t *v); | ||
54 | EXPORT_SYMBOL(atomic64_dec_if_positive_386); | ||
55 | int atomic64_inc_not_zero_386(atomic64_t *v); | ||
56 | EXPORT_SYMBOL(atomic64_inc_not_zero_386); | ||
57 | int atomic64_add_unless_386(atomic64_t *v, long long a, long long u); | ||
58 | EXPORT_SYMBOL(atomic64_add_unless_386); | ||
59 | #endif | ||
diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S index e8e7e0d06f42..00933d5e992f 100644 --- a/arch/x86/lib/atomic64_386_32.S +++ b/arch/x86/lib/atomic64_386_32.S | |||
@@ -137,13 +137,13 @@ BEGIN(dec_return) | |||
137 | RET_ENDP | 137 | RET_ENDP |
138 | #undef v | 138 | #undef v |
139 | 139 | ||
140 | #define v %ecx | 140 | #define v %esi |
141 | BEGIN(add_unless) | 141 | BEGIN(add_unless) |
142 | addl %eax, %esi | 142 | addl %eax, %ecx |
143 | adcl %edx, %edi | 143 | adcl %edx, %edi |
144 | addl (v), %eax | 144 | addl (v), %eax |
145 | adcl 4(v), %edx | 145 | adcl 4(v), %edx |
146 | cmpl %eax, %esi | 146 | cmpl %eax, %ecx |
147 | je 3f | 147 | je 3f |
148 | 1: | 148 | 1: |
149 | movl %eax, (v) | 149 | movl %eax, (v) |
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S index 391a083674b4..f5cc9eb1d51b 100644 --- a/arch/x86/lib/atomic64_cx8_32.S +++ b/arch/x86/lib/atomic64_cx8_32.S | |||
@@ -55,8 +55,6 @@ ENDPROC(atomic64_set_cx8) | |||
55 | ENTRY(atomic64_xchg_cx8) | 55 | ENTRY(atomic64_xchg_cx8) |
56 | CFI_STARTPROC | 56 | CFI_STARTPROC |
57 | 57 | ||
58 | movl %ebx, %eax | ||
59 | movl %ecx, %edx | ||
60 | 1: | 58 | 1: |
61 | LOCK_PREFIX | 59 | LOCK_PREFIX |
62 | cmpxchg8b (%esi) | 60 | cmpxchg8b (%esi) |
@@ -78,7 +76,7 @@ ENTRY(atomic64_\func\()_return_cx8) | |||
78 | movl %edx, %edi | 76 | movl %edx, %edi |
79 | movl %ecx, %ebp | 77 | movl %ecx, %ebp |
80 | 78 | ||
81 | read64 %ebp | 79 | read64 %ecx |
82 | 1: | 80 | 1: |
83 | movl %eax, %ebx | 81 | movl %eax, %ebx |
84 | movl %edx, %ecx | 82 | movl %edx, %ecx |
@@ -159,23 +157,22 @@ ENTRY(atomic64_add_unless_cx8) | |||
159 | SAVE ebx | 157 | SAVE ebx |
160 | /* these just push these two parameters on the stack */ | 158 | /* these just push these two parameters on the stack */ |
161 | SAVE edi | 159 | SAVE edi |
162 | SAVE esi | 160 | SAVE ecx |
163 | 161 | ||
164 | movl %ecx, %ebp | 162 | movl %eax, %ebp |
165 | movl %eax, %esi | ||
166 | movl %edx, %edi | 163 | movl %edx, %edi |
167 | 164 | ||
168 | read64 %ebp | 165 | read64 %esi |
169 | 1: | 166 | 1: |
170 | cmpl %eax, 0(%esp) | 167 | cmpl %eax, 0(%esp) |
171 | je 4f | 168 | je 4f |
172 | 2: | 169 | 2: |
173 | movl %eax, %ebx | 170 | movl %eax, %ebx |
174 | movl %edx, %ecx | 171 | movl %edx, %ecx |
175 | addl %esi, %ebx | 172 | addl %ebp, %ebx |
176 | adcl %edi, %ecx | 173 | adcl %edi, %ecx |
177 | LOCK_PREFIX | 174 | LOCK_PREFIX |
178 | cmpxchg8b (%ebp) | 175 | cmpxchg8b (%esi) |
179 | jne 1b | 176 | jne 1b |
180 | 177 | ||
181 | movl $1, %eax | 178 | movl $1, %eax |
@@ -199,13 +196,13 @@ ENTRY(atomic64_inc_not_zero_cx8) | |||
199 | 196 | ||
200 | read64 %esi | 197 | read64 %esi |
201 | 1: | 198 | 1: |
202 | testl %eax, %eax | 199 | movl %eax, %ecx |
203 | je 4f | 200 | orl %edx, %ecx |
204 | 2: | 201 | jz 3f |
205 | movl %eax, %ebx | 202 | movl %eax, %ebx |
206 | movl %edx, %ecx | 203 | xorl %ecx, %ecx |
207 | addl $1, %ebx | 204 | addl $1, %ebx |
208 | adcl $0, %ecx | 205 | adcl %edx, %ecx |
209 | LOCK_PREFIX | 206 | LOCK_PREFIX |
210 | cmpxchg8b (%esi) | 207 | cmpxchg8b (%esi) |
211 | jne 1b | 208 | jne 1b |
@@ -214,9 +211,5 @@ ENTRY(atomic64_inc_not_zero_cx8) | |||
214 | 3: | 211 | 3: |
215 | RESTORE ebx | 212 | RESTORE ebx |
216 | ret | 213 | ret |
217 | 4: | ||
218 | testl %edx, %edx | ||
219 | jne 2b | ||
220 | jmp 3b | ||
221 | CFI_ENDPROC | 214 | CFI_ENDPROC |
222 | ENDPROC(atomic64_inc_not_zero_cx8) | 215 | ENDPROC(atomic64_inc_not_zero_cx8) |