diff options
Diffstat (limited to 'arch/parisc/include')
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 6c79311acdaf..0abdd4c607ed 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #define KERNEL_DS ((mm_segment_t){0}) | 17 | #define KERNEL_DS ((mm_segment_t){0}) |
18 | #define USER_DS ((mm_segment_t){1}) | 18 | #define USER_DS ((mm_segment_t){1}) |
19 | 19 | ||
20 | #define segment_eq(a,b) ((a).seg == (b).seg) | 20 | #define segment_eq(a, b) ((a).seg == (b).seg) |
21 | 21 | ||
22 | #define get_ds() (KERNEL_DS) | 22 | #define get_ds() (KERNEL_DS) |
23 | #define get_fs() (current_thread_info()->addr_limit) | 23 | #define get_fs() (current_thread_info()->addr_limit) |
@@ -42,14 +42,14 @@ static inline long access_ok(int type, const void __user * addr, | |||
42 | #if !defined(CONFIG_64BIT) | 42 | #if !defined(CONFIG_64BIT) |
43 | #define LDD_KERNEL(ptr) BUILD_BUG() | 43 | #define LDD_KERNEL(ptr) BUILD_BUG() |
44 | #define LDD_USER(ptr) BUILD_BUG() | 44 | #define LDD_USER(ptr) BUILD_BUG() |
45 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) | 45 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x, ptr) |
46 | #define STD_USER(x, ptr) __put_user_asm64(x,ptr) | 46 | #define STD_USER(x, ptr) __put_user_asm64(x, ptr) |
47 | #define ASM_WORD_INSN ".word\t" | 47 | #define ASM_WORD_INSN ".word\t" |
48 | #else | 48 | #else |
49 | #define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr) | 49 | #define LDD_KERNEL(ptr) __get_kernel_asm("ldd", ptr) |
50 | #define LDD_USER(ptr) __get_user_asm("ldd",ptr) | 50 | #define LDD_USER(ptr) __get_user_asm("ldd", ptr) |
51 | #define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr) | 51 | #define STD_KERNEL(x, ptr) __put_kernel_asm("std", x, ptr) |
52 | #define STD_USER(x, ptr) __put_user_asm("std",x,ptr) | 52 | #define STD_USER(x, ptr) __put_user_asm("std", x, ptr) |
53 | #define ASM_WORD_INSN ".dword\t" | 53 | #define ASM_WORD_INSN ".dword\t" |
54 | #endif | 54 | #endif |
55 | 55 | ||
@@ -80,68 +80,68 @@ struct exception_data { | |||
80 | unsigned long fault_addr; | 80 | unsigned long fault_addr; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #define __get_user(x,ptr) \ | 83 | #define __get_user(x, ptr) \ |
84 | ({ \ | 84 | ({ \ |
85 | register long __gu_err __asm__ ("r8") = 0; \ | 85 | register long __gu_err __asm__ ("r8") = 0; \ |
86 | register long __gu_val __asm__ ("r9") = 0; \ | 86 | register long __gu_val __asm__ ("r9") = 0; \ |
87 | \ | 87 | \ |
88 | if (segment_eq(get_fs(),KERNEL_DS)) { \ | 88 | if (segment_eq(get_fs(), KERNEL_DS)) { \ |
89 | switch (sizeof(*(ptr))) { \ | 89 | switch (sizeof(*(ptr))) { \ |
90 | case 1: __get_kernel_asm("ldb",ptr); break; \ | 90 | case 1: __get_kernel_asm("ldb", ptr); break; \ |
91 | case 2: __get_kernel_asm("ldh",ptr); break; \ | 91 | case 2: __get_kernel_asm("ldh", ptr); break; \ |
92 | case 4: __get_kernel_asm("ldw",ptr); break; \ | 92 | case 4: __get_kernel_asm("ldw", ptr); break; \ |
93 | case 8: LDD_KERNEL(ptr); break; \ | 93 | case 8: LDD_KERNEL(ptr); break; \ |
94 | default: BUILD_BUG(); break; \ | 94 | default: BUILD_BUG(); break; \ |
95 | } \ | 95 | } \ |
96 | } \ | 96 | } \ |
97 | else { \ | 97 | else { \ |
98 | switch (sizeof(*(ptr))) { \ | 98 | switch (sizeof(*(ptr))) { \ |
99 | case 1: __get_user_asm("ldb",ptr); break; \ | 99 | case 1: __get_user_asm("ldb", ptr); break; \ |
100 | case 2: __get_user_asm("ldh",ptr); break; \ | 100 | case 2: __get_user_asm("ldh", ptr); break; \ |
101 | case 4: __get_user_asm("ldw",ptr); break; \ | 101 | case 4: __get_user_asm("ldw", ptr); break; \ |
102 | case 8: LDD_USER(ptr); break; \ | 102 | case 8: LDD_USER(ptr); break; \ |
103 | default: BUILD_BUG(); break; \ | 103 | default: BUILD_BUG(); break; \ |
104 | } \ | 104 | } \ |
105 | } \ | 105 | } \ |
106 | \ | 106 | \ |
107 | (x) = (__force __typeof__(*(ptr))) __gu_val; \ | 107 | (x) = (__force __typeof__(*(ptr))) __gu_val; \ |
108 | __gu_err; \ | 108 | __gu_err; \ |
109 | }) | 109 | }) |
110 | 110 | ||
111 | #define __get_kernel_asm(ldx,ptr) \ | 111 | #define __get_kernel_asm(ldx, ptr) \ |
112 | __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \ | 112 | __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \ |
113 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ | 113 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ |
114 | : "=r"(__gu_val), "=r"(__gu_err) \ | 114 | : "=r"(__gu_val), "=r"(__gu_err) \ |
115 | : "r"(ptr), "1"(__gu_err) \ | 115 | : "r"(ptr), "1"(__gu_err) \ |
116 | : "r1"); | 116 | : "r1"); |
117 | 117 | ||
118 | #define __get_user_asm(ldx,ptr) \ | 118 | #define __get_user_asm(ldx, ptr) \ |
119 | __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \ | 119 | __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \ |
120 | ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\ | 120 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ |
121 | : "=r"(__gu_val), "=r"(__gu_err) \ | 121 | : "=r"(__gu_val), "=r"(__gu_err) \ |
122 | : "r"(ptr), "1"(__gu_err) \ | 122 | : "r"(ptr), "1"(__gu_err) \ |
123 | : "r1"); | 123 | : "r1"); |
124 | 124 | ||
125 | #define __put_user(x,ptr) \ | 125 | #define __put_user(x, ptr) \ |
126 | ({ \ | 126 | ({ \ |
127 | register long __pu_err __asm__ ("r8") = 0; \ | 127 | register long __pu_err __asm__ ("r8") = 0; \ |
128 | __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \ | 128 | __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \ |
129 | \ | 129 | \ |
130 | if (segment_eq(get_fs(),KERNEL_DS)) { \ | 130 | if (segment_eq(get_fs(), KERNEL_DS)) { \ |
131 | switch (sizeof(*(ptr))) { \ | 131 | switch (sizeof(*(ptr))) { \ |
132 | case 1: __put_kernel_asm("stb",__x,ptr); break; \ | 132 | case 1: __put_kernel_asm("stb", __x, ptr); break; \ |
133 | case 2: __put_kernel_asm("sth",__x,ptr); break; \ | 133 | case 2: __put_kernel_asm("sth", __x, ptr); break; \ |
134 | case 4: __put_kernel_asm("stw",__x,ptr); break; \ | 134 | case 4: __put_kernel_asm("stw", __x, ptr); break; \ |
135 | case 8: STD_KERNEL(__x,ptr); break; \ | 135 | case 8: STD_KERNEL(__x, ptr); break; \ |
136 | default: BUILD_BUG(); break; \ | 136 | default: BUILD_BUG(); break; \ |
137 | } \ | 137 | } \ |
138 | } \ | 138 | } \ |
139 | else { \ | 139 | else { \ |
140 | switch (sizeof(*(ptr))) { \ | 140 | switch (sizeof(*(ptr))) { \ |
141 | case 1: __put_user_asm("stb",__x,ptr); break; \ | 141 | case 1: __put_user_asm("stb", __x, ptr); break; \ |
142 | case 2: __put_user_asm("sth",__x,ptr); break; \ | 142 | case 2: __put_user_asm("sth", __x, ptr); break; \ |
143 | case 4: __put_user_asm("stw",__x,ptr); break; \ | 143 | case 4: __put_user_asm("stw", __x, ptr); break; \ |
144 | case 8: STD_USER(__x,ptr); break; \ | 144 | case 8: STD_USER(__x, ptr); break; \ |
145 | default: BUILD_BUG(); break; \ | 145 | default: BUILD_BUG(); break; \ |
146 | } \ | 146 | } \ |
147 | } \ | 147 | } \ |
@@ -159,18 +159,18 @@ struct exception_data { | |||
159 | * r8/r9 are already listed as err/val. | 159 | * r8/r9 are already listed as err/val. |
160 | */ | 160 | */ |
161 | 161 | ||
162 | #define __put_kernel_asm(stx,x,ptr) \ | 162 | #define __put_kernel_asm(stx, x, ptr) \ |
163 | __asm__ __volatile__ ( \ | 163 | __asm__ __volatile__ ( \ |
164 | "\n1:\t" stx "\t%2,0(%1)\n\t" \ | 164 | "\n1:\t" stx "\t%2,0(%1)\n\t" \ |
165 | ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\ | 165 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\ |
166 | : "=r"(__pu_err) \ | 166 | : "=r"(__pu_err) \ |
167 | : "r"(ptr), "r"(x), "0"(__pu_err) \ | 167 | : "r"(ptr), "r"(x), "0"(__pu_err) \ |
168 | : "r1") | 168 | : "r1") |
169 | 169 | ||
170 | #define __put_user_asm(stx,x,ptr) \ | 170 | #define __put_user_asm(stx, x, ptr) \ |
171 | __asm__ __volatile__ ( \ | 171 | __asm__ __volatile__ ( \ |
172 | "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \ | 172 | "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \ |
173 | ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\ | 173 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\ |
174 | : "=r"(__pu_err) \ | 174 | : "=r"(__pu_err) \ |
175 | : "r"(ptr), "r"(x), "0"(__pu_err) \ | 175 | : "r"(ptr), "r"(x), "0"(__pu_err) \ |
176 | : "r1") | 176 | : "r1") |
@@ -178,23 +178,23 @@ struct exception_data { | |||
178 | 178 | ||
179 | #if !defined(CONFIG_64BIT) | 179 | #if !defined(CONFIG_64BIT) |
180 | 180 | ||
181 | #define __put_kernel_asm64(__val,ptr) do { \ | 181 | #define __put_kernel_asm64(__val, ptr) do { \ |
182 | __asm__ __volatile__ ( \ | 182 | __asm__ __volatile__ ( \ |
183 | "\n1:\tstw %2,0(%1)" \ | 183 | "\n1:\tstw %2,0(%1)" \ |
184 | "\n2:\tstw %R2,4(%1)\n\t" \ | 184 | "\n2:\tstw %R2,4(%1)\n\t" \ |
185 | ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ | 185 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\ |
186 | ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ | 186 | ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\ |
187 | : "=r"(__pu_err) \ | 187 | : "=r"(__pu_err) \ |
188 | : "r"(ptr), "r"(__val), "0"(__pu_err) \ | 188 | : "r"(ptr), "r"(__val), "0"(__pu_err) \ |
189 | : "r1"); \ | 189 | : "r1"); \ |
190 | } while (0) | 190 | } while (0) |
191 | 191 | ||
192 | #define __put_user_asm64(__val,ptr) do { \ | 192 | #define __put_user_asm64(__val, ptr) do { \ |
193 | __asm__ __volatile__ ( \ | 193 | __asm__ __volatile__ ( \ |
194 | "\n1:\tstw %2,0(%%sr3,%1)" \ | 194 | "\n1:\tstw %2,0(%%sr3,%1)" \ |
195 | "\n2:\tstw %R2,4(%%sr3,%1)\n\t" \ | 195 | "\n2:\tstw %R2,4(%%sr3,%1)\n\t" \ |
196 | ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ | 196 | ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\ |
197 | ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ | 197 | ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\ |
198 | : "=r"(__pu_err) \ | 198 | : "=r"(__pu_err) \ |
199 | : "r"(ptr), "r"(__val), "0"(__pu_err) \ | 199 | : "r"(ptr), "r"(__val), "0"(__pu_err) \ |
200 | : "r1"); \ | 200 | : "r1"); \ |
@@ -211,8 +211,8 @@ extern unsigned long lcopy_to_user(void __user *, const void *, unsigned long); | |||
211 | extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long); | 211 | extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long); |
212 | extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long); | 212 | extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long); |
213 | extern long strncpy_from_user(char *, const char __user *, long); | 213 | extern long strncpy_from_user(char *, const char __user *, long); |
214 | extern unsigned lclear_user(void __user *,unsigned long); | 214 | extern unsigned lclear_user(void __user *, unsigned long); |
215 | extern long lstrnlen_user(const char __user *,long); | 215 | extern long lstrnlen_user(const char __user *, long); |
216 | /* | 216 | /* |
217 | * Complex access routines -- macros | 217 | * Complex access routines -- macros |
218 | */ | 218 | */ |