diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-06-25 10:48:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 03:14:22 -0400 |
commit | dc70ddf4098de043ac52f623c7573a11f2ae3d09 (patch) | |
tree | 0641f33c243a7d1feec051670cdced9ffec36535 /include/asm-x86/uaccess_64.h | |
parent | d42e6af613375be7a9a431628ecd742e87230554 (diff) |
x86: merge __put_user_asm and its user.
Move both __put_user_asm and __put_user_size to
uaccess.h. i386 already had a special function for 64-bit access,
so for x86_64, we just define a macro with the same name.
Note that for X86_64, CONFIG_X86_WP_WORKS_OK will always
be defined, so the #else part will never be even compiled in.
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>
Diffstat (limited to 'include/asm-x86/uaccess_64.h')
-rw-r--r-- | include/asm-x86/uaccess_64.h | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h index 6532d638d5a3..42c01aa70e72 100644 --- a/include/asm-x86/uaccess_64.h +++ b/include/asm-x86/uaccess_64.h | |||
@@ -34,14 +34,6 @@ extern void __put_user_bad(void); | |||
34 | #define __get_user_unaligned __get_user | 34 | #define __get_user_unaligned __get_user |
35 | #define __put_user_unaligned __put_user | 35 | #define __put_user_unaligned __put_user |
36 | 36 | ||
37 | #define __put_user_nocheck(x, ptr, size) \ | ||
38 | ({ \ | ||
39 | int __pu_err; \ | ||
40 | __put_user_size((x), (ptr), (size), __pu_err, -EFAULT); \ | ||
41 | __pu_err; \ | ||
42 | }) | ||
43 | |||
44 | |||
45 | #define __put_user_check(x, ptr, size) \ | 37 | #define __put_user_check(x, ptr, size) \ |
46 | ({ \ | 38 | ({ \ |
47 | int __pu_err; \ | 39 | int __pu_err; \ |
@@ -65,49 +57,6 @@ extern void __put_user_bad(void); | |||
65 | __pu_err; \ | 57 | __pu_err; \ |
66 | }) | 58 | }) |
67 | 59 | ||
68 | #define __put_user_size(x, ptr, size, retval, errret) \ | ||
69 | do { \ | ||
70 | retval = 0; \ | ||
71 | __chk_user_ptr(ptr); \ | ||
72 | switch (size) { \ | ||
73 | case 1: \ | ||
74 | __put_user_asm(x, ptr, retval, "b", "b", "iq", errret);\ | ||
75 | break; \ | ||
76 | case 2: \ | ||
77 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret);\ | ||
78 | break; \ | ||
79 | case 4: \ | ||
80 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret);\ | ||
81 | break; \ | ||
82 | case 8: \ | ||
83 | __put_user_asm(x, ptr, retval, "q", "", "Zr", errret); \ | ||
84 | break; \ | ||
85 | default: \ | ||
86 | __put_user_bad(); \ | ||
87 | } \ | ||
88 | } while (0) | ||
89 | |||
90 | /* FIXME: this hack is definitely wrong -AK */ | ||
91 | struct __large_struct { unsigned long buf[100]; }; | ||
92 | #define __m(x) (*(struct __large_struct __user *)(x)) | ||
93 | |||
94 | /* | ||
95 | * Tell gcc we read from memory instead of writing: this is because | ||
96 | * we do not write to any memory gcc knows about, so there are no | ||
97 | * aliasing issues. | ||
98 | */ | ||
99 | #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ | ||
100 | asm volatile("1: mov"itype" %"rtype"1,%2\n" \ | ||
101 | "2:\n" \ | ||
102 | ".section .fixup, \"ax\"\n" \ | ||
103 | "3: mov %3,%0\n" \ | ||
104 | " jmp 2b\n" \ | ||
105 | ".previous\n" \ | ||
106 | _ASM_EXTABLE(1b, 3b) \ | ||
107 | : "=r"(err) \ | ||
108 | : ltype (x), "m" (__m(addr)), "i" (errno), "0" (err)) | ||
109 | |||
110 | |||
111 | #define __get_user_nocheck(x, ptr, size) \ | 60 | #define __get_user_nocheck(x, ptr, size) \ |
112 | ({ \ | 61 | ({ \ |
113 | int __gu_err; \ | 62 | int __gu_err; \ |