diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-06-24 14:02:31 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 03:14:07 -0400 |
commit | 70706e432ee5618abf59381101d8dea7b8d97a7d (patch) | |
tree | 069dac4d26d55546aff420a2ef61af67a853f895 | |
parent | 268cf048c890d10bd3a86bd87922ed8a722d502f (diff) |
x86: user put_user_x instead of all variants.
Follow the pattern, and define a single put_user_x, instead
of defining macros for all available sizes. Exception is
put_user_8, since the "A" constraint does not give us enough
power to specify which register (a or d) to use in the 32-bit
common case.
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/asm-x86/uaccess_32.h | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h index 0ecfe47ad60d..f8abc12a77c2 100644 --- a/include/asm-x86/uaccess_32.h +++ b/include/asm-x86/uaccess_32.h | |||
@@ -186,25 +186,14 @@ extern void __put_user_2(void); | |||
186 | extern void __put_user_4(void); | 186 | extern void __put_user_4(void); |
187 | extern void __put_user_8(void); | 187 | extern void __put_user_8(void); |
188 | 188 | ||
189 | #define __put_user_1(x, ptr) \ | 189 | #define __put_user_x(size, x, ptr) \ |
190 | asm volatile("call __put_user_1" : "=a" (__ret_pu) \ | 190 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
191 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 191 | :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
192 | |||
193 | #define __put_user_2(x, ptr) \ | ||
194 | asm volatile("call __put_user_2" : "=a" (__ret_pu) \ | ||
195 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | ||
196 | |||
197 | #define __put_user_4(x, ptr) \ | ||
198 | asm volatile("call __put_user_4" : "=a" (__ret_pu) \ | ||
199 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | ||
200 | 192 | ||
201 | #define __put_user_8(x, ptr) \ | 193 | #define __put_user_8(x, ptr) \ |
202 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ | 194 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ |
203 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 195 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
204 | 196 | ||
205 | #define __put_user_X(x, ptr) \ | ||
206 | asm volatile("call __put_user_X" : "=a" (__ret_pu) \ | ||
207 | : "c" (ptr): "ebx") | ||
208 | 197 | ||
209 | /** | 198 | /** |
210 | * put_user: - Write a simple value into user space. | 199 | * put_user: - Write a simple value into user space. |
@@ -232,19 +221,19 @@ extern void __put_user_8(void); | |||
232 | __pu_val = x; \ | 221 | __pu_val = x; \ |
233 | switch (sizeof(*(ptr))) { \ | 222 | switch (sizeof(*(ptr))) { \ |
234 | case 1: \ | 223 | case 1: \ |
235 | __put_user_1(__pu_val, ptr); \ | 224 | __put_user_x(1, __pu_val, ptr); \ |
236 | break; \ | 225 | break; \ |
237 | case 2: \ | 226 | case 2: \ |
238 | __put_user_2(__pu_val, ptr); \ | 227 | __put_user_x(2, __pu_val, ptr); \ |
239 | break; \ | 228 | break; \ |
240 | case 4: \ | 229 | case 4: \ |
241 | __put_user_4(__pu_val, ptr); \ | 230 | __put_user_x(4, __pu_val, ptr); \ |
242 | break; \ | 231 | break; \ |
243 | case 8: \ | 232 | case 8: \ |
244 | __put_user_8(__pu_val, ptr); \ | 233 | __put_user_8(__pu_val, ptr); \ |
245 | break; \ | 234 | break; \ |
246 | default: \ | 235 | default: \ |
247 | __put_user_X(__pu_val, ptr); \ | 236 | __put_user_x(X, __pu_val, ptr); \ |
248 | break; \ | 237 | break; \ |
249 | } \ | 238 | } \ |
250 | __ret_pu; \ | 239 | __ret_pu; \ |