diff options
36 files changed, 616 insertions, 891 deletions
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt index 7b4596ac4120..12299697b7cd 100644 --- a/Documentation/x86/boot.txt +++ b/Documentation/x86/boot.txt | |||
@@ -158,7 +158,7 @@ Offset Proto Name Meaning | |||
158 | 0202/4 2.00+ header Magic signature "HdrS" | 158 | 0202/4 2.00+ header Magic signature "HdrS" |
159 | 0206/2 2.00+ version Boot protocol version supported | 159 | 0206/2 2.00+ version Boot protocol version supported |
160 | 0208/4 2.00+ realmode_swtch Boot loader hook (see below) | 160 | 0208/4 2.00+ realmode_swtch Boot loader hook (see below) |
161 | 020C/2 2.00+ start_sys The load-low segment (0x1000) (obsolete) | 161 | 020C/2 2.00+ start_sys_seg The load-low segment (0x1000) (obsolete) |
162 | 020E/2 2.00+ kernel_version Pointer to kernel version string | 162 | 020E/2 2.00+ kernel_version Pointer to kernel version string |
163 | 0210/1 2.00+ type_of_loader Boot loader identifier | 163 | 0210/1 2.00+ type_of_loader Boot loader identifier |
164 | 0211/1 2.00+ loadflags Boot protocol option flags | 164 | 0211/1 2.00+ loadflags Boot protocol option flags |
@@ -170,10 +170,11 @@ Offset Proto Name Meaning | |||
170 | 0224/2 2.01+ heap_end_ptr Free memory after setup end | 170 | 0224/2 2.01+ heap_end_ptr Free memory after setup end |
171 | 0226/2 N/A pad1 Unused | 171 | 0226/2 N/A pad1 Unused |
172 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line | 172 | 0228/4 2.02+ cmd_line_ptr 32-bit pointer to the kernel command line |
173 | 022C/4 2.03+ initrd_addr_max Highest legal initrd address | 173 | 022C/4 2.03+ ramdisk_max Highest legal initrd address |
174 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel | 174 | 0230/4 2.05+ kernel_alignment Physical addr alignment required for kernel |
175 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not | 175 | 0234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not |
176 | 0235/3 N/A pad2 Unused | 176 | 0235/1 N/A pad2 Unused |
177 | 0236/2 N/A pad3 Unused | ||
177 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line | 178 | 0238/4 2.06+ cmdline_size Maximum size of the kernel command line |
178 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture | 179 | 023C/4 2.07+ hardware_subarch Hardware subarchitecture |
179 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data | 180 | 0240/8 2.07+ hardware_subarch_data Subarchitecture-specific data |
@@ -299,14 +300,14 @@ Protocol: 2.00+ | |||
299 | e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version | 300 | e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version |
300 | 10.17. | 301 | 10.17. |
301 | 302 | ||
302 | Field name: readmode_swtch | 303 | Field name: realmode_swtch |
303 | Type: modify (optional) | 304 | Type: modify (optional) |
304 | Offset/size: 0x208/4 | 305 | Offset/size: 0x208/4 |
305 | Protocol: 2.00+ | 306 | Protocol: 2.00+ |
306 | 307 | ||
307 | Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) | 308 | Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) |
308 | 309 | ||
309 | Field name: start_sys | 310 | Field name: start_sys_seg |
310 | Type: read | 311 | Type: read |
311 | Offset/size: 0x20c/2 | 312 | Offset/size: 0x20c/2 |
312 | Protocol: 2.00+ | 313 | Protocol: 2.00+ |
@@ -468,7 +469,7 @@ Protocol: 2.02+ | |||
468 | zero, the kernel will assume that your boot loader does not support | 469 | zero, the kernel will assume that your boot loader does not support |
469 | the 2.02+ protocol. | 470 | the 2.02+ protocol. |
470 | 471 | ||
471 | Field name: initrd_addr_max | 472 | Field name: ramdisk_max |
472 | Type: read | 473 | Type: read |
473 | Offset/size: 0x22c/4 | 474 | Offset/size: 0x22c/4 |
474 | Protocol: 2.03+ | 475 | Protocol: 2.03+ |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index 75115849af33..4a58c8ce3f69 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -269,9 +269,8 @@ void vesa_store_edid(void) | |||
269 | we genuinely have to assume all registers are destroyed here. */ | 269 | we genuinely have to assume all registers are destroyed here. */ |
270 | 270 | ||
271 | asm("pushw %%es; movw %2,%%es; "INT10"; popw %%es" | 271 | asm("pushw %%es; movw %2,%%es; "INT10"; popw %%es" |
272 | : "+a" (ax), "+b" (bx) | 272 | : "+a" (ax), "+b" (bx), "+c" (cx), "+D" (di) |
273 | : "c" (cx), "D" (di) | 273 | : : "esi", "edx"); |
274 | : "esi"); | ||
275 | 274 | ||
276 | if (ax != 0x004f) | 275 | if (ax != 0x004f) |
277 | return; /* No EDID */ | 276 | return; /* No EDID */ |
@@ -285,9 +284,9 @@ void vesa_store_edid(void) | |||
285 | dx = 0; /* EDID block number */ | 284 | dx = 0; /* EDID block number */ |
286 | di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */ | 285 | di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */ |
287 | asm(INT10 | 286 | asm(INT10 |
288 | : "+a" (ax), "+b" (bx), "+d" (dx), "=m" (boot_params.edid_info) | 287 | : "+a" (ax), "+b" (bx), "+d" (dx), "=m" (boot_params.edid_info), |
289 | : "c" (cx), "D" (di) | 288 | "+c" (cx), "+D" (di) |
290 | : "esi"); | 289 | : : "esi"); |
291 | #endif /* CONFIG_FIRMWARE_EDID */ | 290 | #endif /* CONFIG_FIRMWARE_EDID */ |
292 | } | 291 | } |
293 | 292 | ||
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 9dabd00e9805..dd77ac0cac46 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -46,78 +46,83 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | |||
46 | 46 | ||
47 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) | 47 | int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) |
48 | { | 48 | { |
49 | int err; | 49 | int err = 0; |
50 | 50 | ||
51 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) | 51 | if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) |
52 | return -EFAULT; | 52 | return -EFAULT; |
53 | 53 | ||
54 | /* If you change siginfo_t structure, please make sure that | 54 | put_user_try { |
55 | this code is fixed accordingly. | 55 | /* If you change siginfo_t structure, please make sure that |
56 | It should never copy any pad contained in the structure | 56 | this code is fixed accordingly. |
57 | to avoid security leaks, but must copy the generic | 57 | It should never copy any pad contained in the structure |
58 | 3 ints plus the relevant union member. */ | 58 | to avoid security leaks, but must copy the generic |
59 | err = __put_user(from->si_signo, &to->si_signo); | 59 | 3 ints plus the relevant union member. */ |
60 | err |= __put_user(from->si_errno, &to->si_errno); | 60 | put_user_ex(from->si_signo, &to->si_signo); |
61 | err |= __put_user((short)from->si_code, &to->si_code); | 61 | put_user_ex(from->si_errno, &to->si_errno); |
62 | 62 | put_user_ex((short)from->si_code, &to->si_code); | |
63 | if (from->si_code < 0) { | 63 | |
64 | err |= __put_user(from->si_pid, &to->si_pid); | 64 | if (from->si_code < 0) { |
65 | err |= __put_user(from->si_uid, &to->si_uid); | 65 | put_user_ex(from->si_pid, &to->si_pid); |
66 | err |= __put_user(ptr_to_compat(from->si_ptr), &to->si_ptr); | 66 | put_user_ex(from->si_uid, &to->si_uid); |
67 | } else { | 67 | put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr); |
68 | /* | 68 | } else { |
69 | * First 32bits of unions are always present: | 69 | /* |
70 | * si_pid === si_band === si_tid === si_addr(LS half) | 70 | * First 32bits of unions are always present: |
71 | */ | 71 | * si_pid === si_band === si_tid === si_addr(LS half) |
72 | err |= __put_user(from->_sifields._pad[0], | 72 | */ |
73 | &to->_sifields._pad[0]); | 73 | put_user_ex(from->_sifields._pad[0], |
74 | switch (from->si_code >> 16) { | 74 | &to->_sifields._pad[0]); |
75 | case __SI_FAULT >> 16: | 75 | switch (from->si_code >> 16) { |
76 | break; | 76 | case __SI_FAULT >> 16: |
77 | case __SI_CHLD >> 16: | 77 | break; |
78 | err |= __put_user(from->si_utime, &to->si_utime); | 78 | case __SI_CHLD >> 16: |
79 | err |= __put_user(from->si_stime, &to->si_stime); | 79 | put_user_ex(from->si_utime, &to->si_utime); |
80 | err |= __put_user(from->si_status, &to->si_status); | 80 | put_user_ex(from->si_stime, &to->si_stime); |
81 | /* FALL THROUGH */ | 81 | put_user_ex(from->si_status, &to->si_status); |
82 | default: | 82 | /* FALL THROUGH */ |
83 | case __SI_KILL >> 16: | 83 | default: |
84 | err |= __put_user(from->si_uid, &to->si_uid); | 84 | case __SI_KILL >> 16: |
85 | break; | 85 | put_user_ex(from->si_uid, &to->si_uid); |
86 | case __SI_POLL >> 16: | 86 | break; |
87 | err |= __put_user(from->si_fd, &to->si_fd); | 87 | case __SI_POLL >> 16: |
88 | break; | 88 | put_user_ex(from->si_fd, &to->si_fd); |
89 | case __SI_TIMER >> 16: | 89 | break; |
90 | err |= __put_user(from->si_overrun, &to->si_overrun); | 90 | case __SI_TIMER >> 16: |
91 | err |= __put_user(ptr_to_compat(from->si_ptr), | 91 | put_user_ex(from->si_overrun, &to->si_overrun); |
92 | &to->si_ptr); | 92 | put_user_ex(ptr_to_compat(from->si_ptr), |
93 | break; | 93 | &to->si_ptr); |
94 | /* This is not generated by the kernel as of now. */ | 94 | break; |
95 | case __SI_RT >> 16: | 95 | /* This is not generated by the kernel as of now. */ |
96 | case __SI_MESGQ >> 16: | 96 | case __SI_RT >> 16: |
97 | err |= __put_user(from->si_uid, &to->si_uid); | 97 | case __SI_MESGQ >> 16: |
98 | err |= __put_user(from->si_int, &to->si_int); | 98 | put_user_ex(from->si_uid, &to->si_uid); |
99 | break; | 99 | put_user_ex(from->si_int, &to->si_int); |
100 | break; | ||
101 | } | ||
100 | } | 102 | } |
101 | } | 103 | } put_user_catch(err); |
104 | |||
102 | return err; | 105 | return err; |
103 | } | 106 | } |
104 | 107 | ||
105 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | 108 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
106 | { | 109 | { |
107 | int err; | 110 | int err = 0; |
108 | u32 ptr32; | 111 | u32 ptr32; |
109 | 112 | ||
110 | if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) | 113 | if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) |
111 | return -EFAULT; | 114 | return -EFAULT; |
112 | 115 | ||
113 | err = __get_user(to->si_signo, &from->si_signo); | 116 | get_user_try { |
114 | err |= __get_user(to->si_errno, &from->si_errno); | 117 | get_user_ex(to->si_signo, &from->si_signo); |
115 | err |= __get_user(to->si_code, &from->si_code); | 118 | get_user_ex(to->si_errno, &from->si_errno); |
119 | get_user_ex(to->si_code, &from->si_code); | ||
116 | 120 | ||
117 | err |= __get_user(to->si_pid, &from->si_pid); | 121 | get_user_ex(to->si_pid, &from->si_pid); |
118 | err |= __get_user(to->si_uid, &from->si_uid); | 122 | get_user_ex(to->si_uid, &from->si_uid); |
119 | err |= __get_user(ptr32, &from->si_ptr); | 123 | get_user_ex(ptr32, &from->si_ptr); |
120 | to->si_ptr = compat_ptr(ptr32); | 124 | to->si_ptr = compat_ptr(ptr32); |
125 | } get_user_catch(err); | ||
121 | 126 | ||
122 | return err; | 127 | return err; |
123 | } | 128 | } |
@@ -142,17 +147,23 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
142 | struct pt_regs *regs) | 147 | struct pt_regs *regs) |
143 | { | 148 | { |
144 | stack_t uss, uoss; | 149 | stack_t uss, uoss; |
145 | int ret; | 150 | int ret, err = 0; |
146 | mm_segment_t seg; | 151 | mm_segment_t seg; |
147 | 152 | ||
148 | if (uss_ptr) { | 153 | if (uss_ptr) { |
149 | u32 ptr; | 154 | u32 ptr; |
150 | 155 | ||
151 | memset(&uss, 0, sizeof(stack_t)); | 156 | memset(&uss, 0, sizeof(stack_t)); |
152 | if (!access_ok(VERIFY_READ, uss_ptr, sizeof(stack_ia32_t)) || | 157 | if (!access_ok(VERIFY_READ, uss_ptr, sizeof(stack_ia32_t))) |
153 | __get_user(ptr, &uss_ptr->ss_sp) || | 158 | return -EFAULT; |
154 | __get_user(uss.ss_flags, &uss_ptr->ss_flags) || | 159 | |
155 | __get_user(uss.ss_size, &uss_ptr->ss_size)) | 160 | get_user_try { |
161 | get_user_ex(ptr, &uss_ptr->ss_sp); | ||
162 | get_user_ex(uss.ss_flags, &uss_ptr->ss_flags); | ||
163 | get_user_ex(uss.ss_size, &uss_ptr->ss_size); | ||
164 | } get_user_catch(err); | ||
165 | |||
166 | if (err) | ||
156 | return -EFAULT; | 167 | return -EFAULT; |
157 | uss.ss_sp = compat_ptr(ptr); | 168 | uss.ss_sp = compat_ptr(ptr); |
158 | } | 169 | } |
@@ -161,10 +172,16 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
161 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp); | 172 | ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, regs->sp); |
162 | set_fs(seg); | 173 | set_fs(seg); |
163 | if (ret >= 0 && uoss_ptr) { | 174 | if (ret >= 0 && uoss_ptr) { |
164 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)) || | 175 | if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t))) |
165 | __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) || | 176 | return -EFAULT; |
166 | __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) || | 177 | |
167 | __put_user(uoss.ss_size, &uoss_ptr->ss_size)) | 178 | put_user_try { |
179 | put_user_ex(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp); | ||
180 | put_user_ex(uoss.ss_flags, &uoss_ptr->ss_flags); | ||
181 | put_user_ex(uoss.ss_size, &uoss_ptr->ss_size); | ||
182 | } put_user_catch(err); | ||
183 | |||
184 | if (err) | ||
168 | ret = -EFAULT; | 185 | ret = -EFAULT; |
169 | } | 186 | } |
170 | return ret; | 187 | return ret; |
@@ -174,18 +191,18 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
174 | * Do a signal return; undo the signal stack. | 191 | * Do a signal return; undo the signal stack. |
175 | */ | 192 | */ |
176 | #define COPY(x) { \ | 193 | #define COPY(x) { \ |
177 | err |= __get_user(regs->x, &sc->x); \ | 194 | get_user_ex(regs->x, &sc->x); \ |
178 | } | 195 | } |
179 | 196 | ||
180 | #define COPY_SEG_CPL3(seg) { \ | 197 | #define COPY_SEG_CPL3(seg) { \ |
181 | unsigned short tmp; \ | 198 | unsigned short tmp; \ |
182 | err |= __get_user(tmp, &sc->seg); \ | 199 | get_user_ex(tmp, &sc->seg); \ |
183 | regs->seg = tmp | 3; \ | 200 | regs->seg = tmp | 3; \ |
184 | } | 201 | } |
185 | 202 | ||
186 | #define RELOAD_SEG(seg) { \ | 203 | #define RELOAD_SEG(seg) { \ |
187 | unsigned int cur, pre; \ | 204 | unsigned int cur, pre; \ |
188 | err |= __get_user(pre, &sc->seg); \ | 205 | get_user_ex(pre, &sc->seg); \ |
189 | savesegment(seg, cur); \ | 206 | savesegment(seg, cur); \ |
190 | pre |= 3; \ | 207 | pre |= 3; \ |
191 | if (pre != cur) \ | 208 | if (pre != cur) \ |
@@ -209,39 +226,42 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
209 | sc, sc->err, sc->ip, sc->cs, sc->flags); | 226 | sc, sc->err, sc->ip, sc->cs, sc->flags); |
210 | #endif | 227 | #endif |
211 | 228 | ||
212 | /* | 229 | get_user_try { |
213 | * Reload fs and gs if they have changed in the signal | 230 | /* |
214 | * handler. This does not handle long fs/gs base changes in | 231 | * Reload fs and gs if they have changed in the signal |
215 | * the handler, but does not clobber them at least in the | 232 | * handler. This does not handle long fs/gs base changes in |
216 | * normal case. | 233 | * the handler, but does not clobber them at least in the |
217 | */ | 234 | * normal case. |
218 | err |= __get_user(gs, &sc->gs); | 235 | */ |
219 | gs |= 3; | 236 | get_user_ex(gs, &sc->gs); |
220 | savesegment(gs, oldgs); | 237 | gs |= 3; |
221 | if (gs != oldgs) | 238 | savesegment(gs, oldgs); |
222 | load_gs_index(gs); | 239 | if (gs != oldgs) |
223 | 240 | load_gs_index(gs); | |
224 | RELOAD_SEG(fs); | 241 | |
225 | RELOAD_SEG(ds); | 242 | RELOAD_SEG(fs); |
226 | RELOAD_SEG(es); | 243 | RELOAD_SEG(ds); |
227 | 244 | RELOAD_SEG(es); | |
228 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 245 | |
229 | COPY(dx); COPY(cx); COPY(ip); | 246 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
230 | /* Don't touch extended registers */ | 247 | COPY(dx); COPY(cx); COPY(ip); |
231 | 248 | /* Don't touch extended registers */ | |
232 | COPY_SEG_CPL3(cs); | 249 | |
233 | COPY_SEG_CPL3(ss); | 250 | COPY_SEG_CPL3(cs); |
234 | 251 | COPY_SEG_CPL3(ss); | |
235 | err |= __get_user(tmpflags, &sc->flags); | 252 | |
236 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 253 | get_user_ex(tmpflags, &sc->flags); |
237 | /* disable syscall checks */ | 254 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
238 | regs->orig_ax = -1; | 255 | /* disable syscall checks */ |
239 | 256 | regs->orig_ax = -1; | |
240 | err |= __get_user(tmp, &sc->fpstate); | 257 | |
241 | buf = compat_ptr(tmp); | 258 | get_user_ex(tmp, &sc->fpstate); |
242 | err |= restore_i387_xstate_ia32(buf); | 259 | buf = compat_ptr(tmp); |
243 | 260 | err |= restore_i387_xstate_ia32(buf); | |
244 | err |= __get_user(*pax, &sc->ax); | 261 | |
262 | get_user_ex(*pax, &sc->ax); | ||
263 | } get_user_catch(err); | ||
264 | |||
245 | return err; | 265 | return err; |
246 | } | 266 | } |
247 | 267 | ||
@@ -319,36 +339,38 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
319 | { | 339 | { |
320 | int tmp, err = 0; | 340 | int tmp, err = 0; |
321 | 341 | ||
322 | savesegment(gs, tmp); | 342 | put_user_try { |
323 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); | 343 | savesegment(gs, tmp); |
324 | savesegment(fs, tmp); | 344 | put_user_ex(tmp, (unsigned int __user *)&sc->gs); |
325 | err |= __put_user(tmp, (unsigned int __user *)&sc->fs); | 345 | savesegment(fs, tmp); |
326 | savesegment(ds, tmp); | 346 | put_user_ex(tmp, (unsigned int __user *)&sc->fs); |
327 | err |= __put_user(tmp, (unsigned int __user *)&sc->ds); | 347 | savesegment(ds, tmp); |
328 | savesegment(es, tmp); | 348 | put_user_ex(tmp, (unsigned int __user *)&sc->ds); |
329 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); | 349 | savesegment(es, tmp); |
330 | 350 | put_user_ex(tmp, (unsigned int __user *)&sc->es); | |
331 | err |= __put_user(regs->di, &sc->di); | 351 | |
332 | err |= __put_user(regs->si, &sc->si); | 352 | put_user_ex(regs->di, &sc->di); |
333 | err |= __put_user(regs->bp, &sc->bp); | 353 | put_user_ex(regs->si, &sc->si); |
334 | err |= __put_user(regs->sp, &sc->sp); | 354 | put_user_ex(regs->bp, &sc->bp); |
335 | err |= __put_user(regs->bx, &sc->bx); | 355 | put_user_ex(regs->sp, &sc->sp); |
336 | err |= __put_user(regs->dx, &sc->dx); | 356 | put_user_ex(regs->bx, &sc->bx); |
337 | err |= __put_user(regs->cx, &sc->cx); | 357 | put_user_ex(regs->dx, &sc->dx); |
338 | err |= __put_user(regs->ax, &sc->ax); | 358 | put_user_ex(regs->cx, &sc->cx); |
339 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 359 | put_user_ex(regs->ax, &sc->ax); |
340 | err |= __put_user(current->thread.error_code, &sc->err); | 360 | put_user_ex(current->thread.trap_no, &sc->trapno); |
341 | err |= __put_user(regs->ip, &sc->ip); | 361 | put_user_ex(current->thread.error_code, &sc->err); |
342 | err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); | 362 | put_user_ex(regs->ip, &sc->ip); |
343 | err |= __put_user(regs->flags, &sc->flags); | 363 | put_user_ex(regs->cs, (unsigned int __user *)&sc->cs); |
344 | err |= __put_user(regs->sp, &sc->sp_at_signal); | 364 | put_user_ex(regs->flags, &sc->flags); |
345 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); | 365 | put_user_ex(regs->sp, &sc->sp_at_signal); |
346 | 366 | put_user_ex(regs->ss, (unsigned int __user *)&sc->ss); | |
347 | err |= __put_user(ptr_to_compat(fpstate), &sc->fpstate); | 367 | |
348 | 368 | put_user_ex(ptr_to_compat(fpstate), &sc->fpstate); | |
349 | /* non-iBCS2 extensions.. */ | 369 | |
350 | err |= __put_user(mask, &sc->oldmask); | 370 | /* non-iBCS2 extensions.. */ |
351 | err |= __put_user(current->thread.cr2, &sc->cr2); | 371 | put_user_ex(mask, &sc->oldmask); |
372 | put_user_ex(current->thread.cr2, &sc->cr2); | ||
373 | } put_user_catch(err); | ||
352 | 374 | ||
353 | return err; | 375 | return err; |
354 | } | 376 | } |
@@ -437,13 +459,17 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
437 | else | 459 | else |
438 | restorer = &frame->retcode; | 460 | restorer = &frame->retcode; |
439 | } | 461 | } |
440 | err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); | ||
441 | 462 | ||
442 | /* | 463 | put_user_try { |
443 | * These are actually not used anymore, but left because some | 464 | put_user_ex(ptr_to_compat(restorer), &frame->pretcode); |
444 | * gdb versions depend on them as a marker. | 465 | |
445 | */ | 466 | /* |
446 | err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode); | 467 | * These are actually not used anymore, but left because some |
468 | * gdb versions depend on them as a marker. | ||
469 | */ | ||
470 | put_user_ex(*((u64 *)&code), (u64 *)frame->retcode); | ||
471 | } put_user_catch(err); | ||
472 | |||
447 | if (err) | 473 | if (err) |
448 | return -EFAULT; | 474 | return -EFAULT; |
449 | 475 | ||
@@ -496,41 +522,40 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
496 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 522 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
497 | return -EFAULT; | 523 | return -EFAULT; |
498 | 524 | ||
499 | err |= __put_user(sig, &frame->sig); | 525 | put_user_try { |
500 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); | 526 | put_user_ex(sig, &frame->sig); |
501 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); | 527 | put_user_ex(ptr_to_compat(&frame->info), &frame->pinfo); |
502 | err |= copy_siginfo_to_user32(&frame->info, info); | 528 | put_user_ex(ptr_to_compat(&frame->uc), &frame->puc); |
503 | if (err) | 529 | err |= copy_siginfo_to_user32(&frame->info, info); |
504 | return -EFAULT; | ||
505 | 530 | ||
506 | /* Create the ucontext. */ | 531 | /* Create the ucontext. */ |
507 | if (cpu_has_xsave) | 532 | if (cpu_has_xsave) |
508 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | 533 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
509 | else | 534 | else |
510 | err |= __put_user(0, &frame->uc.uc_flags); | 535 | put_user_ex(0, &frame->uc.uc_flags); |
511 | err |= __put_user(0, &frame->uc.uc_link); | 536 | put_user_ex(0, &frame->uc.uc_link); |
512 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 537 | put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
513 | err |= __put_user(sas_ss_flags(regs->sp), | 538 | put_user_ex(sas_ss_flags(regs->sp), |
514 | &frame->uc.uc_stack.ss_flags); | 539 | &frame->uc.uc_stack.ss_flags); |
515 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | 540 | put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size); |
516 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | 541 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, |
517 | regs, set->sig[0]); | 542 | regs, set->sig[0]); |
518 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 543 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
519 | if (err) | 544 | |
520 | return -EFAULT; | 545 | if (ka->sa.sa_flags & SA_RESTORER) |
546 | restorer = ka->sa.sa_restorer; | ||
547 | else | ||
548 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, | ||
549 | rt_sigreturn); | ||
550 | put_user_ex(ptr_to_compat(restorer), &frame->pretcode); | ||
551 | |||
552 | /* | ||
553 | * Not actually used anymore, but left because some gdb | ||
554 | * versions need it. | ||
555 | */ | ||
556 | put_user_ex(*((u64 *)&code), (u64 *)frame->retcode); | ||
557 | } put_user_catch(err); | ||
521 | 558 | ||
522 | if (ka->sa.sa_flags & SA_RESTORER) | ||
523 | restorer = ka->sa.sa_restorer; | ||
524 | else | ||
525 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, | ||
526 | rt_sigreturn); | ||
527 | err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); | ||
528 | |||
529 | /* | ||
530 | * Not actually used anymore, but left because some gdb | ||
531 | * versions need it. | ||
532 | */ | ||
533 | err |= __put_user(*((u64 *)&code), (u64 *)frame->retcode); | ||
534 | if (err) | 559 | if (err) |
535 | return -EFAULT; | 560 | return -EFAULT; |
536 | 561 | ||
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 1dbbdf4be9b4..bcf7ea4e1367 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -91,7 +91,7 @@ extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr); | |||
91 | 91 | ||
92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, | 92 | extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, |
93 | unsigned long prot_val); | 93 | unsigned long prot_val); |
94 | extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size); | 94 | extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * early_ioremap() and early_iounmap() are for temporary early boot-time | 97 | * early_ioremap() and early_iounmap() are for temporary early boot-time |
diff --git a/arch/x86/include/asm/mach-rdc321x/gpio.h b/arch/x86/include/asm/mach-rdc321x/gpio.h deleted file mode 100644 index c210ab5788b0..000000000000 --- a/arch/x86/include/asm/mach-rdc321x/gpio.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | #ifndef _ASM_X86_MACH_RDC321X_GPIO_H | ||
2 | #define _ASM_X86_MACH_RDC321X_GPIO_H | ||
3 | |||
4 | #include <linux/kernel.h> | ||
5 | |||
6 | extern int rdc_gpio_get_value(unsigned gpio); | ||
7 | extern void rdc_gpio_set_value(unsigned gpio, int value); | ||
8 | extern int rdc_gpio_direction_input(unsigned gpio); | ||
9 | extern int rdc_gpio_direction_output(unsigned gpio, int value); | ||
10 | extern int rdc_gpio_request(unsigned gpio, const char *label); | ||
11 | extern void rdc_gpio_free(unsigned gpio); | ||
12 | extern void __init rdc321x_gpio_setup(void); | ||
13 | |||
14 | /* Wrappers for the arch-neutral GPIO API */ | ||
15 | |||
16 | static inline int gpio_request(unsigned gpio, const char *label) | ||
17 | { | ||
18 | return rdc_gpio_request(gpio, label); | ||
19 | } | ||
20 | |||
21 | static inline void gpio_free(unsigned gpio) | ||
22 | { | ||
23 | might_sleep(); | ||
24 | rdc_gpio_free(gpio); | ||
25 | } | ||
26 | |||
27 | static inline int gpio_direction_input(unsigned gpio) | ||
28 | { | ||
29 | return rdc_gpio_direction_input(gpio); | ||
30 | } | ||
31 | |||
32 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
33 | { | ||
34 | return rdc_gpio_direction_output(gpio, value); | ||
35 | } | ||
36 | |||
37 | static inline int gpio_get_value(unsigned gpio) | ||
38 | { | ||
39 | return rdc_gpio_get_value(gpio); | ||
40 | } | ||
41 | |||
42 | static inline void gpio_set_value(unsigned gpio, int value) | ||
43 | { | ||
44 | rdc_gpio_set_value(gpio, value); | ||
45 | } | ||
46 | |||
47 | static inline int gpio_to_irq(unsigned gpio) | ||
48 | { | ||
49 | return gpio; | ||
50 | } | ||
51 | |||
52 | static inline int irq_to_gpio(unsigned irq) | ||
53 | { | ||
54 | return irq; | ||
55 | } | ||
56 | |||
57 | /* For cansleep */ | ||
58 | #include <asm-generic/gpio.h> | ||
59 | |||
60 | #endif /* _ASM_X86_MACH_RDC321X_GPIO_H */ | ||
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index e9873a2e8695..6b9810859daf 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
@@ -147,7 +147,7 @@ static inline pteval_t native_pte_val(pte_t pte) | |||
147 | return pte.pte; | 147 | return pte.pte; |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline pteval_t native_pte_flags(pte_t pte) | 150 | static inline pteval_t pte_flags(pte_t pte) |
151 | { | 151 | { |
152 | return native_pte_val(pte) & PTE_FLAGS_MASK; | 152 | return native_pte_val(pte) & PTE_FLAGS_MASK; |
153 | } | 153 | } |
@@ -173,7 +173,6 @@ static inline pteval_t native_pte_flags(pte_t pte) | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #define pte_val(x) native_pte_val(x) | 175 | #define pte_val(x) native_pte_val(x) |
176 | #define pte_flags(x) native_pte_flags(x) | ||
177 | #define __pte(x) native_make_pte(x) | 176 | #define __pte(x) native_make_pte(x) |
178 | 177 | ||
179 | #endif /* CONFIG_PARAVIRT */ | 178 | #endif /* CONFIG_PARAVIRT */ |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index c26c6bf4da00..7e674ea80f0d 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -280,7 +280,6 @@ struct pv_mmu_ops { | |||
280 | pte_t *ptep, pte_t pte); | 280 | pte_t *ptep, pte_t pte); |
281 | 281 | ||
282 | pteval_t (*pte_val)(pte_t); | 282 | pteval_t (*pte_val)(pte_t); |
283 | pteval_t (*pte_flags)(pte_t); | ||
284 | pte_t (*make_pte)(pteval_t pte); | 283 | pte_t (*make_pte)(pteval_t pte); |
285 | 284 | ||
286 | pgdval_t (*pgd_val)(pgd_t); | 285 | pgdval_t (*pgd_val)(pgd_t); |
@@ -1086,23 +1085,6 @@ static inline pteval_t pte_val(pte_t pte) | |||
1086 | return ret; | 1085 | return ret; |
1087 | } | 1086 | } |
1088 | 1087 | ||
1089 | static inline pteval_t pte_flags(pte_t pte) | ||
1090 | { | ||
1091 | pteval_t ret; | ||
1092 | |||
1093 | if (sizeof(pteval_t) > sizeof(long)) | ||
1094 | ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_flags, | ||
1095 | pte.pte, (u64)pte.pte >> 32); | ||
1096 | else | ||
1097 | ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_flags, | ||
1098 | pte.pte); | ||
1099 | |||
1100 | #ifdef CONFIG_PARAVIRT_DEBUG | ||
1101 | BUG_ON(ret & PTE_PFN_MASK); | ||
1102 | #endif | ||
1103 | return ret; | ||
1104 | } | ||
1105 | |||
1106 | static inline pgd_t __pgd(pgdval_t val) | 1088 | static inline pgd_t __pgd(pgdval_t val) |
1107 | { | 1089 | { |
1108 | pgdval_t ret; | 1090 | pgdval_t ret; |
@@ -1391,8 +1373,6 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | |||
1391 | void _paravirt_nop(void); | 1373 | void _paravirt_nop(void); |
1392 | #define paravirt_nop ((void *)_paravirt_nop) | 1374 | #define paravirt_nop ((void *)_paravirt_nop) |
1393 | 1375 | ||
1394 | void paravirt_use_bytelocks(void); | ||
1395 | |||
1396 | #ifdef CONFIG_SMP | 1376 | #ifdef CONFIG_SMP |
1397 | 1377 | ||
1398 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) | 1378 | static inline int __raw_spin_is_locked(struct raw_spinlock *lock) |
diff --git a/arch/x86/include/asm/pat.h b/arch/x86/include/asm/pat.h index b8493b3b9890..9709fdff6615 100644 --- a/arch/x86/include/asm/pat.h +++ b/arch/x86/include/asm/pat.h | |||
@@ -5,10 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_X86_PAT | 6 | #ifdef CONFIG_X86_PAT |
7 | extern int pat_enabled; | 7 | extern int pat_enabled; |
8 | extern void validate_pat_support(struct cpuinfo_x86 *c); | ||
9 | #else | 8 | #else |
10 | static const int pat_enabled; | 9 | static const int pat_enabled; |
11 | static inline void validate_pat_support(struct cpuinfo_x86 *c) { } | ||
12 | #endif | 10 | #endif |
13 | 11 | ||
14 | extern void pat_init(void); | 12 | extern void pat_init(void); |
@@ -17,6 +15,4 @@ extern int reserve_memtype(u64 start, u64 end, | |||
17 | unsigned long req_type, unsigned long *ret_type); | 15 | unsigned long req_type, unsigned long *ret_type); |
18 | extern int free_memtype(u64 start, u64 end); | 16 | extern int free_memtype(u64 start, u64 end); |
19 | 17 | ||
20 | extern void pat_disable(char *reason); | ||
21 | |||
22 | #endif /* _ASM_X86_PAT_H */ | 18 | #endif /* _ASM_X86_PAT_H */ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 06bbcbd66e9c..6ceaef08486f 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -240,64 +240,78 @@ static inline int pmd_large(pmd_t pte) | |||
240 | (_PAGE_PSE | _PAGE_PRESENT); | 240 | (_PAGE_PSE | _PAGE_PRESENT); |
241 | } | 241 | } |
242 | 242 | ||
243 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) | ||
244 | { | ||
245 | pteval_t v = native_pte_val(pte); | ||
246 | |||
247 | return native_make_pte(v | set); | ||
248 | } | ||
249 | |||
250 | static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear) | ||
251 | { | ||
252 | pteval_t v = native_pte_val(pte); | ||
253 | |||
254 | return native_make_pte(v & ~clear); | ||
255 | } | ||
256 | |||
243 | static inline pte_t pte_mkclean(pte_t pte) | 257 | static inline pte_t pte_mkclean(pte_t pte) |
244 | { | 258 | { |
245 | return __pte(pte_val(pte) & ~_PAGE_DIRTY); | 259 | return pte_clear_flags(pte, _PAGE_DIRTY); |
246 | } | 260 | } |
247 | 261 | ||
248 | static inline pte_t pte_mkold(pte_t pte) | 262 | static inline pte_t pte_mkold(pte_t pte) |
249 | { | 263 | { |
250 | return __pte(pte_val(pte) & ~_PAGE_ACCESSED); | 264 | return pte_clear_flags(pte, _PAGE_ACCESSED); |
251 | } | 265 | } |
252 | 266 | ||
253 | static inline pte_t pte_wrprotect(pte_t pte) | 267 | static inline pte_t pte_wrprotect(pte_t pte) |
254 | { | 268 | { |
255 | return __pte(pte_val(pte) & ~_PAGE_RW); | 269 | return pte_clear_flags(pte, _PAGE_RW); |
256 | } | 270 | } |
257 | 271 | ||
258 | static inline pte_t pte_mkexec(pte_t pte) | 272 | static inline pte_t pte_mkexec(pte_t pte) |
259 | { | 273 | { |
260 | return __pte(pte_val(pte) & ~_PAGE_NX); | 274 | return pte_clear_flags(pte, _PAGE_NX); |
261 | } | 275 | } |
262 | 276 | ||
263 | static inline pte_t pte_mkdirty(pte_t pte) | 277 | static inline pte_t pte_mkdirty(pte_t pte) |
264 | { | 278 | { |
265 | return __pte(pte_val(pte) | _PAGE_DIRTY); | 279 | return pte_set_flags(pte, _PAGE_DIRTY); |
266 | } | 280 | } |
267 | 281 | ||
268 | static inline pte_t pte_mkyoung(pte_t pte) | 282 | static inline pte_t pte_mkyoung(pte_t pte) |
269 | { | 283 | { |
270 | return __pte(pte_val(pte) | _PAGE_ACCESSED); | 284 | return pte_set_flags(pte, _PAGE_ACCESSED); |
271 | } | 285 | } |
272 | 286 | ||
273 | static inline pte_t pte_mkwrite(pte_t pte) | 287 | static inline pte_t pte_mkwrite(pte_t pte) |
274 | { | 288 | { |
275 | return __pte(pte_val(pte) | _PAGE_RW); | 289 | return pte_set_flags(pte, _PAGE_RW); |
276 | } | 290 | } |
277 | 291 | ||
278 | static inline pte_t pte_mkhuge(pte_t pte) | 292 | static inline pte_t pte_mkhuge(pte_t pte) |
279 | { | 293 | { |
280 | return __pte(pte_val(pte) | _PAGE_PSE); | 294 | return pte_set_flags(pte, _PAGE_PSE); |
281 | } | 295 | } |
282 | 296 | ||
283 | static inline pte_t pte_clrhuge(pte_t pte) | 297 | static inline pte_t pte_clrhuge(pte_t pte) |
284 | { | 298 | { |
285 | return __pte(pte_val(pte) & ~_PAGE_PSE); | 299 | return pte_clear_flags(pte, _PAGE_PSE); |
286 | } | 300 | } |
287 | 301 | ||
288 | static inline pte_t pte_mkglobal(pte_t pte) | 302 | static inline pte_t pte_mkglobal(pte_t pte) |
289 | { | 303 | { |
290 | return __pte(pte_val(pte) | _PAGE_GLOBAL); | 304 | return pte_set_flags(pte, _PAGE_GLOBAL); |
291 | } | 305 | } |
292 | 306 | ||
293 | static inline pte_t pte_clrglobal(pte_t pte) | 307 | static inline pte_t pte_clrglobal(pte_t pte) |
294 | { | 308 | { |
295 | return __pte(pte_val(pte) & ~_PAGE_GLOBAL); | 309 | return pte_clear_flags(pte, _PAGE_GLOBAL); |
296 | } | 310 | } |
297 | 311 | ||
298 | static inline pte_t pte_mkspecial(pte_t pte) | 312 | static inline pte_t pte_mkspecial(pte_t pte) |
299 | { | 313 | { |
300 | return __pte(pte_val(pte) | _PAGE_SPECIAL); | 314 | return pte_set_flags(pte, _PAGE_SPECIAL); |
301 | } | 315 | } |
302 | 316 | ||
303 | extern pteval_t __supported_pte_mask; | 317 | extern pteval_t __supported_pte_mask; |
diff --git a/arch/x86/include/asm/prctl.h b/arch/x86/include/asm/prctl.h index a8894647dd9a..3ac5032fae09 100644 --- a/arch/x86/include/asm/prctl.h +++ b/arch/x86/include/asm/prctl.h | |||
@@ -6,8 +6,4 @@ | |||
6 | #define ARCH_GET_FS 0x1003 | 6 | #define ARCH_GET_FS 0x1003 |
7 | #define ARCH_GET_GS 0x1004 | 7 | #define ARCH_GET_GS 0x1004 |
8 | 8 | ||
9 | #ifdef CONFIG_X86_64 | ||
10 | extern long sys_arch_prctl(int, unsigned long); | ||
11 | #endif /* CONFIG_X86_64 */ | ||
12 | |||
13 | #endif /* _ASM_X86_PRCTL_H */ | 9 | #endif /* _ASM_X86_PRCTL_H */ |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index befa20b4a68c..84afa0d4d717 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -73,7 +73,7 @@ struct cpuinfo_x86 { | |||
73 | char pad0; | 73 | char pad0; |
74 | #else | 74 | #else |
75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ | 75 | /* Number of 4K pages in DTLB/ITLB combined(in pages): */ |
76 | int x86_tlbsize; | 76 | int x86_tlbsize; |
77 | __u8 x86_virt_bits; | 77 | __u8 x86_virt_bits; |
78 | __u8 x86_phys_bits; | 78 | __u8 x86_phys_bits; |
79 | #endif | 79 | #endif |
diff --git a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h b/arch/x86/include/asm/rdc321x_defs.h index c8e9c8bed3d0..c8e9c8bed3d0 100644 --- a/arch/x86/include/asm/mach-rdc321x/rdc321x_defs.h +++ b/arch/x86/include/asm/rdc321x_defs.h | |||
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index 536949749bc2..45b40278b582 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_SETUP_H | 1 | #ifndef _ASM_X86_SETUP_H |
2 | #define _ASM_X86_SETUP_H | 2 | #define _ASM_X86_SETUP_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
4 | #define COMMAND_LINE_SIZE 2048 | 6 | #define COMMAND_LINE_SIZE 2048 |
5 | 7 | ||
6 | #ifndef __ASSEMBLY__ | 8 | #ifndef __ASSEMBLY__ |
@@ -8,10 +10,8 @@ | |||
8 | /* Interrupt control for vSMPowered x86_64 systems */ | 10 | /* Interrupt control for vSMPowered x86_64 systems */ |
9 | void vsmp_init(void); | 11 | void vsmp_init(void); |
10 | 12 | ||
11 | |||
12 | void setup_bios_corruption_check(void); | 13 | void setup_bios_corruption_check(void); |
13 | 14 | ||
14 | |||
15 | #ifdef CONFIG_X86_VISWS | 15 | #ifdef CONFIG_X86_VISWS |
16 | extern void visws_early_detect(void); | 16 | extern void visws_early_detect(void); |
17 | extern int is_visws_box(void); | 17 | extern int is_visws_box(void); |
@@ -43,7 +43,7 @@ struct x86_quirks { | |||
43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); | 43 | void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name); |
44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); | 44 | void (*mpc_oem_pci_bus)(struct mpc_bus *m); |
45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, | 45 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, |
46 | unsigned short oemsize); | 46 | unsigned short oemsize); |
47 | int (*setup_ioapic_ids)(void); | 47 | int (*setup_ioapic_ids)(void); |
48 | int (*update_genapic)(void); | 48 | int (*update_genapic)(void); |
49 | }; | 49 | }; |
@@ -56,8 +56,6 @@ extern unsigned long saved_video_mode; | |||
56 | #endif | 56 | #endif |
57 | #endif /* __ASSEMBLY__ */ | 57 | #endif /* __ASSEMBLY__ */ |
58 | 58 | ||
59 | #ifdef __KERNEL__ | ||
60 | |||
61 | #ifdef __i386__ | 59 | #ifdef __i386__ |
62 | 60 | ||
63 | #include <linux/pfn.h> | 61 | #include <linux/pfn.h> |
diff --git a/arch/x86/include/asm/sigcontext32.h b/arch/x86/include/asm/sigcontext32.h index 6126188cf3a9..ad1478c4ae12 100644 --- a/arch/x86/include/asm/sigcontext32.h +++ b/arch/x86/include/asm/sigcontext32.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_X86_SIGCONTEXT32_H | 1 | #ifndef _ASM_X86_SIGCONTEXT32_H |
2 | #define _ASM_X86_SIGCONTEXT32_H | 2 | #define _ASM_X86_SIGCONTEXT32_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | /* signal context for 32bit programs. */ | 6 | /* signal context for 32bit programs. */ |
5 | 7 | ||
6 | #define X86_FXSR_MAGIC 0x0000 | 8 | #define X86_FXSR_MAGIC 0x0000 |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index d17c91981da2..139b4249a5ec 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -172,70 +172,8 @@ static inline int __ticket_spin_is_contended(raw_spinlock_t *lock) | |||
172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; | 172 | return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_PARAVIRT | 175 | #ifndef CONFIG_PARAVIRT |
176 | /* | ||
177 | * Define virtualization-friendly old-style lock byte lock, for use in | ||
178 | * pv_lock_ops if desired. | ||
179 | * | ||
180 | * This differs from the pre-2.6.24 spinlock by always using xchgb | ||
181 | * rather than decb to take the lock; this allows it to use a | ||
182 | * zero-initialized lock structure. It also maintains a 1-byte | ||
183 | * contention counter, so that we can implement | ||
184 | * __byte_spin_is_contended. | ||
185 | */ | ||
186 | struct __byte_spinlock { | ||
187 | s8 lock; | ||
188 | s8 spinners; | ||
189 | }; | ||
190 | |||
191 | static inline int __byte_spin_is_locked(raw_spinlock_t *lock) | ||
192 | { | ||
193 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
194 | return bl->lock != 0; | ||
195 | } | ||
196 | |||
197 | static inline int __byte_spin_is_contended(raw_spinlock_t *lock) | ||
198 | { | ||
199 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
200 | return bl->spinners != 0; | ||
201 | } | ||
202 | |||
203 | static inline void __byte_spin_lock(raw_spinlock_t *lock) | ||
204 | { | ||
205 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
206 | s8 val = 1; | ||
207 | |||
208 | asm("1: xchgb %1, %0\n" | ||
209 | " test %1,%1\n" | ||
210 | " jz 3f\n" | ||
211 | " " LOCK_PREFIX "incb %2\n" | ||
212 | "2: rep;nop\n" | ||
213 | " cmpb $1, %0\n" | ||
214 | " je 2b\n" | ||
215 | " " LOCK_PREFIX "decb %2\n" | ||
216 | " jmp 1b\n" | ||
217 | "3:" | ||
218 | : "+m" (bl->lock), "+q" (val), "+m" (bl->spinners): : "memory"); | ||
219 | } | ||
220 | |||
221 | static inline int __byte_spin_trylock(raw_spinlock_t *lock) | ||
222 | { | ||
223 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
224 | u8 old = 1; | ||
225 | |||
226 | asm("xchgb %1,%0" | ||
227 | : "+m" (bl->lock), "+q" (old) : : "memory"); | ||
228 | 176 | ||
229 | return old == 0; | ||
230 | } | ||
231 | |||
232 | static inline void __byte_spin_unlock(raw_spinlock_t *lock) | ||
233 | { | ||
234 | struct __byte_spinlock *bl = (struct __byte_spinlock *)lock; | ||
235 | smp_wmb(); | ||
236 | bl->lock = 0; | ||
237 | } | ||
238 | #else /* !CONFIG_PARAVIRT */ | ||
239 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) | 177 | static inline int __raw_spin_is_locked(raw_spinlock_t *lock) |
240 | { | 178 | { |
241 | return __ticket_spin_is_locked(lock); | 179 | return __ticket_spin_is_locked(lock); |
@@ -267,7 +205,7 @@ static __always_inline void __raw_spin_lock_flags(raw_spinlock_t *lock, | |||
267 | __raw_spin_lock(lock); | 205 | __raw_spin_lock(lock); |
268 | } | 206 | } |
269 | 207 | ||
270 | #endif /* CONFIG_PARAVIRT */ | 208 | #endif |
271 | 209 | ||
272 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) | 210 | static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
273 | { | 211 | { |
@@ -329,8 +267,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock) | |||
329 | { | 267 | { |
330 | atomic_t *count = (atomic_t *)lock; | 268 | atomic_t *count = (atomic_t *)lock; |
331 | 269 | ||
332 | atomic_dec(count); | 270 | if (atomic_dec_return(count) >= 0) |
333 | if (atomic_read(count) >= 0) | ||
334 | return 1; | 271 | return 1; |
335 | atomic_inc(count); | 272 | atomic_inc(count); |
336 | return 0; | 273 | return 0; |
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 2fcc70bc85f3..c22383743f36 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -111,16 +111,16 @@ do { \ | |||
111 | "movq "__percpu_arg([current_task])",%%rsi\n\t" \ | 111 | "movq "__percpu_arg([current_task])",%%rsi\n\t" \ |
112 | __switch_canary \ | 112 | __switch_canary \ |
113 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 113 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
114 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | ||
115 | "movq %%rax,%%rdi\n\t" \ | 114 | "movq %%rax,%%rdi\n\t" \ |
116 | "jc ret_from_fork\n\t" \ | 115 | "testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \ |
116 | "jnz ret_from_fork\n\t" \ | ||
117 | RESTORE_CONTEXT \ | 117 | RESTORE_CONTEXT \ |
118 | : "=a" (last) \ | 118 | : "=a" (last) \ |
119 | __switch_canary_oparam \ | 119 | __switch_canary_oparam \ |
120 | : [next] "S" (next), [prev] "D" (prev), \ | 120 | : [next] "S" (next), [prev] "D" (prev), \ |
121 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ | 121 | [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \ |
122 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 122 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
123 | [tif_fork] "i" (TIF_FORK), \ | 123 | [_tif_fork] "i" (_TIF_FORK), \ |
124 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 124 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
125 | [current_task] "m" (per_cpu_var(current_task)) \ | 125 | [current_task] "m" (per_cpu_var(current_task)) \ |
126 | __switch_canary_iparam \ | 126 | __switch_canary_iparam \ |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index b46f8ca007b5..df9d5f78385e 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -40,6 +40,7 @@ struct thread_info { | |||
40 | */ | 40 | */ |
41 | __u8 supervisor_stack[0]; | 41 | __u8 supervisor_stack[0]; |
42 | #endif | 42 | #endif |
43 | int uaccess_err; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | #define INIT_THREAD_INFO(tsk) \ | 46 | #define INIT_THREAD_INFO(tsk) \ |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 4340055b7559..0ec6de4bcb0b 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -121,7 +121,7 @@ extern int __get_user_bad(void); | |||
121 | 121 | ||
122 | #define __get_user_x(size, ret, x, ptr) \ | 122 | #define __get_user_x(size, ret, x, ptr) \ |
123 | asm volatile("call __get_user_" #size \ | 123 | asm volatile("call __get_user_" #size \ |
124 | : "=a" (ret),"=d" (x) \ | 124 | : "=a" (ret), "=d" (x) \ |
125 | : "0" (ptr)) \ | 125 | : "0" (ptr)) \ |
126 | 126 | ||
127 | /* Careful: we have to cast the result to the type of the pointer | 127 | /* Careful: we have to cast the result to the type of the pointer |
@@ -181,12 +181,12 @@ extern int __get_user_bad(void); | |||
181 | 181 | ||
182 | #define __put_user_x(size, x, ptr, __ret_pu) \ | 182 | #define __put_user_x(size, x, ptr, __ret_pu) \ |
183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ | 183 | asm volatile("call __put_user_" #size : "=a" (__ret_pu) \ |
184 | :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 184 | : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | #ifdef CONFIG_X86_32 | 188 | #ifdef CONFIG_X86_32 |
189 | #define __put_user_u64(x, addr, err) \ | 189 | #define __put_user_asm_u64(x, addr, err) \ |
190 | asm volatile("1: movl %%eax,0(%2)\n" \ | 190 | asm volatile("1: movl %%eax,0(%2)\n" \ |
191 | "2: movl %%edx,4(%2)\n" \ | 191 | "2: movl %%edx,4(%2)\n" \ |
192 | "3:\n" \ | 192 | "3:\n" \ |
@@ -199,12 +199,22 @@ extern int __get_user_bad(void); | |||
199 | : "=r" (err) \ | 199 | : "=r" (err) \ |
200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) | 200 | : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err)) |
201 | 201 | ||
202 | #define __put_user_asm_ex_u64(x, addr) \ | ||
203 | asm volatile("1: movl %%eax,0(%1)\n" \ | ||
204 | "2: movl %%edx,4(%1)\n" \ | ||
205 | "3:\n" \ | ||
206 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
207 | _ASM_EXTABLE(2b, 3b - 2b) \ | ||
208 | : : "A" (x), "r" (addr)) | ||
209 | |||
202 | #define __put_user_x8(x, ptr, __ret_pu) \ | 210 | #define __put_user_x8(x, ptr, __ret_pu) \ |
203 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ | 211 | asm volatile("call __put_user_8" : "=a" (__ret_pu) \ |
204 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") | 212 | : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx") |
205 | #else | 213 | #else |
206 | #define __put_user_u64(x, ptr, retval) \ | 214 | #define __put_user_asm_u64(x, ptr, retval) \ |
207 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) | 215 | __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT) |
216 | #define __put_user_asm_ex_u64(x, addr) \ | ||
217 | __put_user_asm_ex(x, addr, "q", "", "Zr") | ||
208 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) | 218 | #define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu) |
209 | #endif | 219 | #endif |
210 | 220 | ||
@@ -276,10 +286,31 @@ do { \ | |||
276 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ | 286 | __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \ |
277 | break; \ | 287 | break; \ |
278 | case 4: \ | 288 | case 4: \ |
279 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret);\ | 289 | __put_user_asm(x, ptr, retval, "l", "k", "ir", errret); \ |
280 | break; \ | 290 | break; \ |
281 | case 8: \ | 291 | case 8: \ |
282 | __put_user_u64((__typeof__(*ptr))(x), ptr, retval); \ | 292 | __put_user_asm_u64((__typeof__(*ptr))(x), ptr, retval); \ |
293 | break; \ | ||
294 | default: \ | ||
295 | __put_user_bad(); \ | ||
296 | } \ | ||
297 | } while (0) | ||
298 | |||
299 | #define __put_user_size_ex(x, ptr, size) \ | ||
300 | do { \ | ||
301 | __chk_user_ptr(ptr); \ | ||
302 | switch (size) { \ | ||
303 | case 1: \ | ||
304 | __put_user_asm_ex(x, ptr, "b", "b", "iq"); \ | ||
305 | break; \ | ||
306 | case 2: \ | ||
307 | __put_user_asm_ex(x, ptr, "w", "w", "ir"); \ | ||
308 | break; \ | ||
309 | case 4: \ | ||
310 | __put_user_asm_ex(x, ptr, "l", "k", "ir"); \ | ||
311 | break; \ | ||
312 | case 8: \ | ||
313 | __put_user_asm_ex_u64((__typeof__(*ptr))(x), ptr); \ | ||
283 | break; \ | 314 | break; \ |
284 | default: \ | 315 | default: \ |
285 | __put_user_bad(); \ | 316 | __put_user_bad(); \ |
@@ -311,9 +342,12 @@ do { \ | |||
311 | 342 | ||
312 | #ifdef CONFIG_X86_32 | 343 | #ifdef CONFIG_X86_32 |
313 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() | 344 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() |
345 | #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() | ||
314 | #else | 346 | #else |
315 | #define __get_user_asm_u64(x, ptr, retval, errret) \ | 347 | #define __get_user_asm_u64(x, ptr, retval, errret) \ |
316 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) | 348 | __get_user_asm(x, ptr, retval, "q", "", "=r", errret) |
349 | #define __get_user_asm_ex_u64(x, ptr) \ | ||
350 | __get_user_asm_ex(x, ptr, "q", "", "=r") | ||
317 | #endif | 351 | #endif |
318 | 352 | ||
319 | #define __get_user_size(x, ptr, size, retval, errret) \ | 353 | #define __get_user_size(x, ptr, size, retval, errret) \ |
@@ -350,6 +384,33 @@ do { \ | |||
350 | : "=r" (err), ltype(x) \ | 384 | : "=r" (err), ltype(x) \ |
351 | : "m" (__m(addr)), "i" (errret), "0" (err)) | 385 | : "m" (__m(addr)), "i" (errret), "0" (err)) |
352 | 386 | ||
387 | #define __get_user_size_ex(x, ptr, size) \ | ||
388 | do { \ | ||
389 | __chk_user_ptr(ptr); \ | ||
390 | switch (size) { \ | ||
391 | case 1: \ | ||
392 | __get_user_asm_ex(x, ptr, "b", "b", "=q"); \ | ||
393 | break; \ | ||
394 | case 2: \ | ||
395 | __get_user_asm_ex(x, ptr, "w", "w", "=r"); \ | ||
396 | break; \ | ||
397 | case 4: \ | ||
398 | __get_user_asm_ex(x, ptr, "l", "k", "=r"); \ | ||
399 | break; \ | ||
400 | case 8: \ | ||
401 | __get_user_asm_ex_u64(x, ptr); \ | ||
402 | break; \ | ||
403 | default: \ | ||
404 | (x) = __get_user_bad(); \ | ||
405 | } \ | ||
406 | } while (0) | ||
407 | |||
408 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
409 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | ||
410 | "2:\n" \ | ||
411 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
412 | : ltype(x) : "m" (__m(addr))) | ||
413 | |||
353 | #define __put_user_nocheck(x, ptr, size) \ | 414 | #define __put_user_nocheck(x, ptr, size) \ |
354 | ({ \ | 415 | ({ \ |
355 | int __pu_err; \ | 416 | int __pu_err; \ |
@@ -385,6 +446,26 @@ struct __large_struct { unsigned long buf[100]; }; | |||
385 | _ASM_EXTABLE(1b, 3b) \ | 446 | _ASM_EXTABLE(1b, 3b) \ |
386 | : "=r"(err) \ | 447 | : "=r"(err) \ |
387 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) | 448 | : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err)) |
449 | |||
450 | #define __put_user_asm_ex(x, addr, itype, rtype, ltype) \ | ||
451 | asm volatile("1: mov"itype" %"rtype"0,%1\n" \ | ||
452 | "2:\n" \ | ||
453 | _ASM_EXTABLE(1b, 2b - 1b) \ | ||
454 | : : ltype(x), "m" (__m(addr))) | ||
455 | |||
456 | /* | ||
457 | * uaccess_try and catch | ||
458 | */ | ||
459 | #define uaccess_try do { \ | ||
460 | int prev_err = current_thread_info()->uaccess_err; \ | ||
461 | current_thread_info()->uaccess_err = 0; \ | ||
462 | barrier(); | ||
463 | |||
464 | #define uaccess_catch(err) \ | ||
465 | (err) |= current_thread_info()->uaccess_err; \ | ||
466 | current_thread_info()->uaccess_err = prev_err; \ | ||
467 | } while (0) | ||
468 | |||
388 | /** | 469 | /** |
389 | * __get_user: - Get a simple variable from user space, with less checking. | 470 | * __get_user: - Get a simple variable from user space, with less checking. |
390 | * @x: Variable to store result. | 471 | * @x: Variable to store result. |
@@ -408,6 +489,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
408 | 489 | ||
409 | #define __get_user(x, ptr) \ | 490 | #define __get_user(x, ptr) \ |
410 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) | 491 | __get_user_nocheck((x), (ptr), sizeof(*(ptr))) |
492 | |||
411 | /** | 493 | /** |
412 | * __put_user: - Write a simple value into user space, with less checking. | 494 | * __put_user: - Write a simple value into user space, with less checking. |
413 | * @x: Value to copy to user space. | 495 | * @x: Value to copy to user space. |
@@ -435,6 +517,27 @@ struct __large_struct { unsigned long buf[100]; }; | |||
435 | #define __put_user_unaligned __put_user | 517 | #define __put_user_unaligned __put_user |
436 | 518 | ||
437 | /* | 519 | /* |
520 | * {get|put}_user_try and catch | ||
521 | * | ||
522 | * get_user_try { | ||
523 | * get_user_ex(...); | ||
524 | * } get_user_catch(err) | ||
525 | */ | ||
526 | #define get_user_try uaccess_try | ||
527 | #define get_user_catch(err) uaccess_catch(err) | ||
528 | #define put_user_try uaccess_try | ||
529 | #define put_user_catch(err) uaccess_catch(err) | ||
530 | |||
531 | #define get_user_ex(x, ptr) do { \ | ||
532 | unsigned long __gue_val; \ | ||
533 | __get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \ | ||
534 | (x) = (__force __typeof__(*(ptr)))__gue_val; \ | ||
535 | } while (0) | ||
536 | |||
537 | #define put_user_ex(x, ptr) \ | ||
538 | __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | ||
539 | |||
540 | /* | ||
438 | * movsl can be slow when source and dest are not both 8-byte aligned | 541 | * movsl can be slow when source and dest are not both 8-byte aligned |
439 | */ | 542 | */ |
440 | #ifdef CONFIG_X86_INTEL_USERCOPY | 543 | #ifdef CONFIG_X86_INTEL_USERCOPY |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 2cf23634b6d9..4e581fdc0a5a 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -143,37 +143,3 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | |||
143 | return; | 143 | return; |
144 | #endif | 144 | #endif |
145 | } | 145 | } |
146 | |||
147 | #ifdef CONFIG_X86_PAT | ||
148 | void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) | ||
149 | { | ||
150 | if (!cpu_has_pat) | ||
151 | pat_disable("PAT not supported by CPU."); | ||
152 | |||
153 | switch (c->x86_vendor) { | ||
154 | case X86_VENDOR_INTEL: | ||
155 | /* | ||
156 | * There is a known erratum on Pentium III and Core Solo | ||
157 | * and Core Duo CPUs. | ||
158 | * " Page with PAT set to WC while associated MTRR is UC | ||
159 | * may consolidate to UC " | ||
160 | * Because of this erratum, it is better to stick with | ||
161 | * setting WC in MTRR rather than using PAT on these CPUs. | ||
162 | * | ||
163 | * Enable PAT WC only on P4, Core 2 or later CPUs. | ||
164 | */ | ||
165 | if (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 15)) | ||
166 | return; | ||
167 | |||
168 | pat_disable("PAT WC disabled due to known CPU erratum."); | ||
169 | return; | ||
170 | |||
171 | case X86_VENDOR_AMD: | ||
172 | case X86_VENDOR_CENTAUR: | ||
173 | case X86_VENDOR_TRANSMETA: | ||
174 | return; | ||
175 | } | ||
176 | |||
177 | pat_disable("PAT disabled. Not yet verified on this CPU type."); | ||
178 | } | ||
179 | #endif | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 652fdc9a757a..275e2cb43b91 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -224,6 +224,49 @@ static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | |||
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Some CPU features depend on higher CPUID levels, which may not always | ||
228 | * be available due to CPUID level capping or broken virtualization | ||
229 | * software. Add those features to this table to auto-disable them. | ||
230 | */ | ||
231 | struct cpuid_dependent_feature { | ||
232 | u32 feature; | ||
233 | u32 level; | ||
234 | }; | ||
235 | static const struct cpuid_dependent_feature __cpuinitconst | ||
236 | cpuid_dependent_features[] = { | ||
237 | { X86_FEATURE_MWAIT, 0x00000005 }, | ||
238 | { X86_FEATURE_DCA, 0x00000009 }, | ||
239 | { X86_FEATURE_XSAVE, 0x0000000d }, | ||
240 | { 0, 0 } | ||
241 | }; | ||
242 | |||
243 | static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) | ||
244 | { | ||
245 | const struct cpuid_dependent_feature *df; | ||
246 | for (df = cpuid_dependent_features; df->feature; df++) { | ||
247 | /* | ||
248 | * Note: cpuid_level is set to -1 if unavailable, but | ||
249 | * extended_extended_level is set to 0 if unavailable | ||
250 | * and the legitimate extended levels are all negative | ||
251 | * when signed; hence the weird messing around with | ||
252 | * signs here... | ||
253 | */ | ||
254 | if (cpu_has(c, df->feature) && | ||
255 | ((s32)df->feature < 0 ? | ||
256 | (u32)df->feature > (u32)c->extended_cpuid_level : | ||
257 | (s32)df->feature > (s32)c->cpuid_level)) { | ||
258 | clear_cpu_cap(c, df->feature); | ||
259 | if (warn) | ||
260 | printk(KERN_WARNING | ||
261 | "CPU: CPU feature %s disabled " | ||
262 | "due to lack of CPUID level 0x%x\n", | ||
263 | x86_cap_flags[df->feature], | ||
264 | df->level); | ||
265 | } | ||
266 | } | ||
267 | } | ||
268 | |||
269 | /* | ||
227 | * Naming convention should be: <Name> [(<Codename>)] | 270 | * Naming convention should be: <Name> [(<Codename>)] |
228 | * This table only is used unless init_<vendor>() below doesn't set it; | 271 | * This table only is used unless init_<vendor>() below doesn't set it; |
229 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used | 272 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used |
@@ -586,11 +629,10 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
586 | if (this_cpu->c_early_init) | 629 | if (this_cpu->c_early_init) |
587 | this_cpu->c_early_init(c); | 630 | this_cpu->c_early_init(c); |
588 | 631 | ||
589 | validate_pat_support(c); | ||
590 | |||
591 | #ifdef CONFIG_SMP | 632 | #ifdef CONFIG_SMP |
592 | c->cpu_index = boot_cpu_id; | 633 | c->cpu_index = boot_cpu_id; |
593 | #endif | 634 | #endif |
635 | filter_cpuid_features(c, false); | ||
594 | } | 636 | } |
595 | 637 | ||
596 | void __init early_cpu_init(void) | 638 | void __init early_cpu_init(void) |
@@ -724,6 +766,9 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
724 | * we do "generic changes." | 766 | * we do "generic changes." |
725 | */ | 767 | */ |
726 | 768 | ||
769 | /* Filter out anything that depends on CPUID levels we don't have */ | ||
770 | filter_cpuid_features(c, true); | ||
771 | |||
727 | /* If the model name is still unset, do table lookup. */ | 772 | /* If the model name is still unset, do table lookup. */ |
728 | if (!c->x86_model_id[0]) { | 773 | if (!c->x86_model_id[0]) { |
729 | char *p; | 774 | char *p; |
@@ -1053,22 +1098,19 @@ void __cpuinit cpu_init(void) | |||
1053 | */ | 1098 | */ |
1054 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) | 1099 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) |
1055 | arch_kgdb_ops.correct_hw_break(); | 1100 | arch_kgdb_ops.correct_hw_break(); |
1056 | else { | 1101 | else |
1057 | #endif | 1102 | #endif |
1058 | /* | 1103 | { |
1059 | * Clear all 6 debug registers: | 1104 | /* |
1060 | */ | 1105 | * Clear all 6 debug registers: |
1061 | 1106 | */ | |
1062 | set_debugreg(0UL, 0); | 1107 | set_debugreg(0UL, 0); |
1063 | set_debugreg(0UL, 1); | 1108 | set_debugreg(0UL, 1); |
1064 | set_debugreg(0UL, 2); | 1109 | set_debugreg(0UL, 2); |
1065 | set_debugreg(0UL, 3); | 1110 | set_debugreg(0UL, 3); |
1066 | set_debugreg(0UL, 6); | 1111 | set_debugreg(0UL, 6); |
1067 | set_debugreg(0UL, 7); | 1112 | set_debugreg(0UL, 7); |
1068 | #ifdef CONFIG_KGDB | ||
1069 | /* If the kgdb is connected no debug regs should be altered. */ | ||
1070 | } | 1113 | } |
1071 | #endif | ||
1072 | 1114 | ||
1073 | fpu_init(); | 1115 | fpu_init(); |
1074 | 1116 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 549f2ada55f5..5deefae9064d 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -30,7 +30,7 @@ | |||
30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | 30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) |
31 | { | 31 | { |
32 | /* Unmask CPUID levels if masked: */ | 32 | /* Unmask CPUID levels if masked: */ |
33 | if (c->x86 == 6 && c->x86_model >= 15) { | 33 | if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { |
34 | u64 misc_enable; | 34 | u64 misc_enable; |
35 | 35 | ||
36 | rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); | 36 | rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); |
@@ -63,6 +63,18 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | |||
63 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); | 63 | set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); |
64 | } | 64 | } |
65 | 65 | ||
66 | /* | ||
67 | * There is a known erratum on Pentium III and Core Solo | ||
68 | * and Core Duo CPUs. | ||
69 | * " Page with PAT set to WC while associated MTRR is UC | ||
70 | * may consolidate to UC " | ||
71 | * Because of this erratum, it is better to stick with | ||
72 | * setting WC in MTRR rather than using PAT on these CPUs. | ||
73 | * | ||
74 | * Enable PAT WC only on P4, Core 2 or later CPUs. | ||
75 | */ | ||
76 | if (c->x86 == 6 && c->x86_model < 15) | ||
77 | clear_cpu_cap(c, X86_FEATURE_PAT); | ||
66 | } | 78 | } |
67 | 79 | ||
68 | #ifdef CONFIG_X86_32 | 80 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index a52703864a16..82801fd2e931 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -409,6 +409,8 @@ END(save_paranoid) | |||
409 | ENTRY(ret_from_fork) | 409 | ENTRY(ret_from_fork) |
410 | DEFAULT_FRAME | 410 | DEFAULT_FRAME |
411 | 411 | ||
412 | LOCK ; btr $TIF_FORK,TI_flags(%r8) | ||
413 | |||
412 | push kernel_eflags(%rip) | 414 | push kernel_eflags(%rip) |
413 | CFI_ADJUST_CFA_OFFSET 8 | 415 | CFI_ADJUST_CFA_OFFSET 8 |
414 | popf # reset kernel eflags | 416 | popf # reset kernel eflags |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 24c0e5cd71e3..722464c520cf 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -548,12 +548,8 @@ early_fault: | |||
548 | pushl %eax | 548 | pushl %eax |
549 | pushl %edx /* trapno */ | 549 | pushl %edx /* trapno */ |
550 | pushl $fault_msg | 550 | pushl $fault_msg |
551 | #ifdef CONFIG_EARLY_PRINTK | ||
552 | call early_printk | ||
553 | #else | ||
554 | call printk | 551 | call printk |
555 | #endif | 552 | #endif |
556 | #endif | ||
557 | call dump_stack | 553 | call dump_stack |
558 | hlt_loop: | 554 | hlt_loop: |
559 | hlt | 555 | hlt |
@@ -580,11 +576,10 @@ ignore_int: | |||
580 | pushl 32(%esp) | 576 | pushl 32(%esp) |
581 | pushl 40(%esp) | 577 | pushl 40(%esp) |
582 | pushl $int_msg | 578 | pushl $int_msg |
583 | #ifdef CONFIG_EARLY_PRINTK | ||
584 | call early_printk | ||
585 | #else | ||
586 | call printk | 579 | call printk |
587 | #endif | 580 | |
581 | call dump_stack | ||
582 | |||
588 | addl $(5*4),%esp | 583 | addl $(5*4),%esp |
589 | popl %ds | 584 | popl %ds |
590 | popl %es | 585 | popl %es |
@@ -660,7 +655,7 @@ early_recursion_flag: | |||
660 | .long 0 | 655 | .long 0 |
661 | 656 | ||
662 | int_msg: | 657 | int_msg: |
663 | .asciz "Unknown interrupt or fault at EIP %p %p %p\n" | 658 | .asciz "Unknown interrupt or fault at: %p %p %p\n" |
664 | 659 | ||
665 | fault_msg: | 660 | fault_msg: |
666 | /* fault info: */ | 661 | /* fault info: */ |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index e4d36bd56b62..bfb7d734062a 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -3465,40 +3465,6 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) | |||
3465 | return 0; | 3465 | return 0; |
3466 | } | 3466 | } |
3467 | 3467 | ||
3468 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc) | ||
3469 | { | ||
3470 | unsigned int irq; | ||
3471 | int ret; | ||
3472 | unsigned int irq_want; | ||
3473 | |||
3474 | irq_want = nr_irqs_gsi; | ||
3475 | irq = create_irq_nr(irq_want); | ||
3476 | if (irq == 0) | ||
3477 | return -1; | ||
3478 | |||
3479 | #ifdef CONFIG_INTR_REMAP | ||
3480 | if (!intr_remapping_enabled) | ||
3481 | goto no_ir; | ||
3482 | |||
3483 | ret = msi_alloc_irte(dev, irq, 1); | ||
3484 | if (ret < 0) | ||
3485 | goto error; | ||
3486 | no_ir: | ||
3487 | #endif | ||
3488 | ret = setup_msi_irq(dev, msidesc, irq); | ||
3489 | if (ret < 0) { | ||
3490 | destroy_irq(irq); | ||
3491 | return ret; | ||
3492 | } | ||
3493 | return 0; | ||
3494 | |||
3495 | #ifdef CONFIG_INTR_REMAP | ||
3496 | error: | ||
3497 | destroy_irq(irq); | ||
3498 | return ret; | ||
3499 | #endif | ||
3500 | } | ||
3501 | |||
3502 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | 3468 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) |
3503 | { | 3469 | { |
3504 | unsigned int irq; | 3470 | unsigned int irq; |
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c index 95777b0faa73..3a7c5a44082e 100644 --- a/arch/x86/kernel/paravirt-spinlocks.c +++ b/arch/x86/kernel/paravirt-spinlocks.c | |||
@@ -26,13 +26,3 @@ struct pv_lock_ops pv_lock_ops = { | |||
26 | }; | 26 | }; |
27 | EXPORT_SYMBOL(pv_lock_ops); | 27 | EXPORT_SYMBOL(pv_lock_ops); |
28 | 28 | ||
29 | void __init paravirt_use_bytelocks(void) | ||
30 | { | ||
31 | #ifdef CONFIG_SMP | ||
32 | pv_lock_ops.spin_is_locked = __byte_spin_is_locked; | ||
33 | pv_lock_ops.spin_is_contended = __byte_spin_is_contended; | ||
34 | pv_lock_ops.spin_lock = __byte_spin_lock; | ||
35 | pv_lock_ops.spin_trylock = __byte_spin_trylock; | ||
36 | pv_lock_ops.spin_unlock = __byte_spin_unlock; | ||
37 | #endif | ||
38 | } | ||
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index e4c8fb608873..202514be5923 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -435,7 +435,6 @@ struct pv_mmu_ops pv_mmu_ops = { | |||
435 | #endif /* PAGETABLE_LEVELS >= 3 */ | 435 | #endif /* PAGETABLE_LEVELS >= 3 */ |
436 | 436 | ||
437 | .pte_val = native_pte_val, | 437 | .pte_val = native_pte_val, |
438 | .pte_flags = native_pte_flags, | ||
439 | .pgd_val = native_pgd_val, | 438 | .pgd_val = native_pgd_val, |
440 | 439 | ||
441 | .make_pte = native_make_pte, | 440 | .make_pte = native_make_pte, |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index df0587f24c54..7fc78b019815 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -51,24 +51,24 @@ | |||
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define COPY(x) { \ | 53 | #define COPY(x) { \ |
54 | err |= __get_user(regs->x, &sc->x); \ | 54 | get_user_ex(regs->x, &sc->x); \ |
55 | } | 55 | } |
56 | 56 | ||
57 | #define COPY_SEG(seg) { \ | 57 | #define COPY_SEG(seg) { \ |
58 | unsigned short tmp; \ | 58 | unsigned short tmp; \ |
59 | err |= __get_user(tmp, &sc->seg); \ | 59 | get_user_ex(tmp, &sc->seg); \ |
60 | regs->seg = tmp; \ | 60 | regs->seg = tmp; \ |
61 | } | 61 | } |
62 | 62 | ||
63 | #define COPY_SEG_CPL3(seg) { \ | 63 | #define COPY_SEG_CPL3(seg) { \ |
64 | unsigned short tmp; \ | 64 | unsigned short tmp; \ |
65 | err |= __get_user(tmp, &sc->seg); \ | 65 | get_user_ex(tmp, &sc->seg); \ |
66 | regs->seg = tmp | 3; \ | 66 | regs->seg = tmp | 3; \ |
67 | } | 67 | } |
68 | 68 | ||
69 | #define GET_SEG(seg) { \ | 69 | #define GET_SEG(seg) { \ |
70 | unsigned short tmp; \ | 70 | unsigned short tmp; \ |
71 | err |= __get_user(tmp, &sc->seg); \ | 71 | get_user_ex(tmp, &sc->seg); \ |
72 | loadsegment(seg, tmp); \ | 72 | loadsegment(seg, tmp); \ |
73 | } | 73 | } |
74 | 74 | ||
@@ -83,45 +83,49 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
83 | /* Always make any pending restarted system calls return -EINTR */ | 83 | /* Always make any pending restarted system calls return -EINTR */ |
84 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 84 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
85 | 85 | ||
86 | get_user_try { | ||
87 | |||
86 | #ifdef CONFIG_X86_32 | 88 | #ifdef CONFIG_X86_32 |
87 | GET_SEG(gs); | 89 | GET_SEG(gs); |
88 | COPY_SEG(fs); | 90 | COPY_SEG(fs); |
89 | COPY_SEG(es); | 91 | COPY_SEG(es); |
90 | COPY_SEG(ds); | 92 | COPY_SEG(ds); |
91 | #endif /* CONFIG_X86_32 */ | 93 | #endif /* CONFIG_X86_32 */ |
92 | 94 | ||
93 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); | 95 | COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
94 | COPY(dx); COPY(cx); COPY(ip); | 96 | COPY(dx); COPY(cx); COPY(ip); |
95 | 97 | ||
96 | #ifdef CONFIG_X86_64 | 98 | #ifdef CONFIG_X86_64 |
97 | COPY(r8); | 99 | COPY(r8); |
98 | COPY(r9); | 100 | COPY(r9); |
99 | COPY(r10); | 101 | COPY(r10); |
100 | COPY(r11); | 102 | COPY(r11); |
101 | COPY(r12); | 103 | COPY(r12); |
102 | COPY(r13); | 104 | COPY(r13); |
103 | COPY(r14); | 105 | COPY(r14); |
104 | COPY(r15); | 106 | COPY(r15); |
105 | #endif /* CONFIG_X86_64 */ | 107 | #endif /* CONFIG_X86_64 */ |
106 | 108 | ||
107 | #ifdef CONFIG_X86_32 | 109 | #ifdef CONFIG_X86_32 |
108 | COPY_SEG_CPL3(cs); | 110 | COPY_SEG_CPL3(cs); |
109 | COPY_SEG_CPL3(ss); | 111 | COPY_SEG_CPL3(ss); |
110 | #else /* !CONFIG_X86_32 */ | 112 | #else /* !CONFIG_X86_32 */ |
111 | /* Kernel saves and restores only the CS segment register on signals, | 113 | /* Kernel saves and restores only the CS segment register on signals, |
112 | * which is the bare minimum needed to allow mixed 32/64-bit code. | 114 | * which is the bare minimum needed to allow mixed 32/64-bit code. |
113 | * App's signal handler can save/restore other segments if needed. */ | 115 | * App's signal handler can save/restore other segments if needed. */ |
114 | COPY_SEG_CPL3(cs); | 116 | COPY_SEG_CPL3(cs); |
115 | #endif /* CONFIG_X86_32 */ | 117 | #endif /* CONFIG_X86_32 */ |
116 | 118 | ||
117 | err |= __get_user(tmpflags, &sc->flags); | 119 | get_user_ex(tmpflags, &sc->flags); |
118 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 120 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
119 | regs->orig_ax = -1; /* disable syscall checks */ | 121 | regs->orig_ax = -1; /* disable syscall checks */ |
122 | |||
123 | get_user_ex(buf, &sc->fpstate); | ||
124 | err |= restore_i387_xstate(buf); | ||
120 | 125 | ||
121 | err |= __get_user(buf, &sc->fpstate); | 126 | get_user_ex(*pax, &sc->ax); |
122 | err |= restore_i387_xstate(buf); | 127 | } get_user_catch(err); |
123 | 128 | ||
124 | err |= __get_user(*pax, &sc->ax); | ||
125 | return err; | 129 | return err; |
126 | } | 130 | } |
127 | 131 | ||
@@ -131,57 +135,60 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | |||
131 | { | 135 | { |
132 | int err = 0; | 136 | int err = 0; |
133 | 137 | ||
138 | put_user_try { | ||
139 | |||
134 | #ifdef CONFIG_X86_32 | 140 | #ifdef CONFIG_X86_32 |
135 | { | 141 | { |
136 | unsigned int tmp; | 142 | unsigned int tmp; |
137 | 143 | ||
138 | savesegment(gs, tmp); | 144 | savesegment(gs, tmp); |
139 | err |= __put_user(tmp, (unsigned int __user *)&sc->gs); | 145 | put_user_ex(tmp, (unsigned int __user *)&sc->gs); |
140 | } | 146 | } |
141 | err |= __put_user(regs->fs, (unsigned int __user *)&sc->fs); | 147 | put_user_ex(regs->fs, (unsigned int __user *)&sc->fs); |
142 | err |= __put_user(regs->es, (unsigned int __user *)&sc->es); | 148 | put_user_ex(regs->es, (unsigned int __user *)&sc->es); |
143 | err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds); | 149 | put_user_ex(regs->ds, (unsigned int __user *)&sc->ds); |
144 | #endif /* CONFIG_X86_32 */ | 150 | #endif /* CONFIG_X86_32 */ |
145 | 151 | ||
146 | err |= __put_user(regs->di, &sc->di); | 152 | put_user_ex(regs->di, &sc->di); |
147 | err |= __put_user(regs->si, &sc->si); | 153 | put_user_ex(regs->si, &sc->si); |
148 | err |= __put_user(regs->bp, &sc->bp); | 154 | put_user_ex(regs->bp, &sc->bp); |
149 | err |= __put_user(regs->sp, &sc->sp); | 155 | put_user_ex(regs->sp, &sc->sp); |
150 | err |= __put_user(regs->bx, &sc->bx); | 156 | put_user_ex(regs->bx, &sc->bx); |
151 | err |= __put_user(regs->dx, &sc->dx); | 157 | put_user_ex(regs->dx, &sc->dx); |
152 | err |= __put_user(regs->cx, &sc->cx); | 158 | put_user_ex(regs->cx, &sc->cx); |
153 | err |= __put_user(regs->ax, &sc->ax); | 159 | put_user_ex(regs->ax, &sc->ax); |
154 | #ifdef CONFIG_X86_64 | 160 | #ifdef CONFIG_X86_64 |
155 | err |= __put_user(regs->r8, &sc->r8); | 161 | put_user_ex(regs->r8, &sc->r8); |
156 | err |= __put_user(regs->r9, &sc->r9); | 162 | put_user_ex(regs->r9, &sc->r9); |
157 | err |= __put_user(regs->r10, &sc->r10); | 163 | put_user_ex(regs->r10, &sc->r10); |
158 | err |= __put_user(regs->r11, &sc->r11); | 164 | put_user_ex(regs->r11, &sc->r11); |
159 | err |= __put_user(regs->r12, &sc->r12); | 165 | put_user_ex(regs->r12, &sc->r12); |
160 | err |= __put_user(regs->r13, &sc->r13); | 166 | put_user_ex(regs->r13, &sc->r13); |
161 | err |= __put_user(regs->r14, &sc->r14); | 167 | put_user_ex(regs->r14, &sc->r14); |
162 | err |= __put_user(regs->r15, &sc->r15); | 168 | put_user_ex(regs->r15, &sc->r15); |
163 | #endif /* CONFIG_X86_64 */ | 169 | #endif /* CONFIG_X86_64 */ |
164 | 170 | ||
165 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 171 | put_user_ex(current->thread.trap_no, &sc->trapno); |
166 | err |= __put_user(current->thread.error_code, &sc->err); | 172 | put_user_ex(current->thread.error_code, &sc->err); |
167 | err |= __put_user(regs->ip, &sc->ip); | 173 | put_user_ex(regs->ip, &sc->ip); |
168 | #ifdef CONFIG_X86_32 | 174 | #ifdef CONFIG_X86_32 |
169 | err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); | 175 | put_user_ex(regs->cs, (unsigned int __user *)&sc->cs); |
170 | err |= __put_user(regs->flags, &sc->flags); | 176 | put_user_ex(regs->flags, &sc->flags); |
171 | err |= __put_user(regs->sp, &sc->sp_at_signal); | 177 | put_user_ex(regs->sp, &sc->sp_at_signal); |
172 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); | 178 | put_user_ex(regs->ss, (unsigned int __user *)&sc->ss); |
173 | #else /* !CONFIG_X86_32 */ | 179 | #else /* !CONFIG_X86_32 */ |
174 | err |= __put_user(regs->flags, &sc->flags); | 180 | put_user_ex(regs->flags, &sc->flags); |
175 | err |= __put_user(regs->cs, &sc->cs); | 181 | put_user_ex(regs->cs, &sc->cs); |
176 | err |= __put_user(0, &sc->gs); | 182 | put_user_ex(0, &sc->gs); |
177 | err |= __put_user(0, &sc->fs); | 183 | put_user_ex(0, &sc->fs); |
178 | #endif /* CONFIG_X86_32 */ | 184 | #endif /* CONFIG_X86_32 */ |
179 | 185 | ||
180 | err |= __put_user(fpstate, &sc->fpstate); | 186 | put_user_ex(fpstate, &sc->fpstate); |
181 | 187 | ||
182 | /* non-iBCS2 extensions.. */ | 188 | /* non-iBCS2 extensions.. */ |
183 | err |= __put_user(mask, &sc->oldmask); | 189 | put_user_ex(mask, &sc->oldmask); |
184 | err |= __put_user(current->thread.cr2, &sc->cr2); | 190 | put_user_ex(current->thread.cr2, &sc->cr2); |
191 | } put_user_catch(err); | ||
185 | 192 | ||
186 | return err; | 193 | return err; |
187 | } | 194 | } |
@@ -336,43 +343,41 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
336 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 343 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
337 | return -EFAULT; | 344 | return -EFAULT; |
338 | 345 | ||
339 | err |= __put_user(sig, &frame->sig); | 346 | put_user_try { |
340 | err |= __put_user(&frame->info, &frame->pinfo); | 347 | put_user_ex(sig, &frame->sig); |
341 | err |= __put_user(&frame->uc, &frame->puc); | 348 | put_user_ex(&frame->info, &frame->pinfo); |
342 | err |= copy_siginfo_to_user(&frame->info, info); | 349 | put_user_ex(&frame->uc, &frame->puc); |
343 | if (err) | 350 | err |= copy_siginfo_to_user(&frame->info, info); |
344 | return -EFAULT; | ||
345 | |||
346 | /* Create the ucontext. */ | ||
347 | if (cpu_has_xsave) | ||
348 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
349 | else | ||
350 | err |= __put_user(0, &frame->uc.uc_flags); | ||
351 | err |= __put_user(0, &frame->uc.uc_link); | ||
352 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | ||
353 | err |= __put_user(sas_ss_flags(regs->sp), | ||
354 | &frame->uc.uc_stack.ss_flags); | ||
355 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
356 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | ||
357 | regs, set->sig[0]); | ||
358 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
359 | if (err) | ||
360 | return -EFAULT; | ||
361 | 351 | ||
362 | /* Set up to return from userspace. */ | 352 | /* Create the ucontext. */ |
363 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); | 353 | if (cpu_has_xsave) |
364 | if (ka->sa.sa_flags & SA_RESTORER) | 354 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
365 | restorer = ka->sa.sa_restorer; | 355 | else |
366 | err |= __put_user(restorer, &frame->pretcode); | 356 | put_user_ex(0, &frame->uc.uc_flags); |
357 | put_user_ex(0, &frame->uc.uc_link); | ||
358 | put_user_ex(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | ||
359 | put_user_ex(sas_ss_flags(regs->sp), | ||
360 | &frame->uc.uc_stack.ss_flags); | ||
361 | put_user_ex(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | ||
362 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, | ||
363 | regs, set->sig[0]); | ||
364 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
365 | |||
366 | /* Set up to return from userspace. */ | ||
367 | restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); | ||
368 | if (ka->sa.sa_flags & SA_RESTORER) | ||
369 | restorer = ka->sa.sa_restorer; | ||
370 | put_user_ex(restorer, &frame->pretcode); | ||
367 | 371 | ||
368 | /* | 372 | /* |
369 | * This is movl $__NR_rt_sigreturn, %ax ; int $0x80 | 373 | * This is movl $__NR_rt_sigreturn, %ax ; int $0x80 |
370 | * | 374 | * |
371 | * WE DO NOT USE IT ANY MORE! It's only left here for historical | 375 | * WE DO NOT USE IT ANY MORE! It's only left here for historical |
372 | * reasons and because gdb uses it as a signature to notice | 376 | * reasons and because gdb uses it as a signature to notice |
373 | * signal handler stack frames. | 377 | * signal handler stack frames. |
374 | */ | 378 | */ |
375 | err |= __put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode); | 379 | put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode); |
380 | } put_user_catch(err); | ||
376 | 381 | ||
377 | if (err) | 382 | if (err) |
378 | return -EFAULT; | 383 | return -EFAULT; |
@@ -436,28 +441,30 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
436 | return -EFAULT; | 441 | return -EFAULT; |
437 | } | 442 | } |
438 | 443 | ||
439 | /* Create the ucontext. */ | 444 | put_user_try { |
440 | if (cpu_has_xsave) | 445 | /* Create the ucontext. */ |
441 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | 446 | if (cpu_has_xsave) |
442 | else | 447 | put_user_ex(UC_FP_XSTATE, &frame->uc.uc_flags); |
443 | err |= __put_user(0, &frame->uc.uc_flags); | 448 | else |
444 | err |= __put_user(0, &frame->uc.uc_link); | 449 | put_user_ex(0, &frame->uc.uc_flags); |
445 | err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 450 | put_user_ex(0, &frame->uc.uc_link); |
446 | err |= __put_user(sas_ss_flags(regs->sp), | 451 | put_user_ex(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
447 | &frame->uc.uc_stack.ss_flags); | 452 | put_user_ex(sas_ss_flags(regs->sp), |
448 | err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); | 453 | &frame->uc.uc_stack.ss_flags); |
449 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); | 454 | put_user_ex(me->sas_ss_size, &frame->uc.uc_stack.ss_size); |
450 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 455 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); |
451 | 456 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | |
452 | /* Set up to return from userspace. If provided, use a stub | 457 | |
453 | already in userspace. */ | 458 | /* Set up to return from userspace. If provided, use a stub |
454 | /* x86-64 should always use SA_RESTORER. */ | 459 | already in userspace. */ |
455 | if (ka->sa.sa_flags & SA_RESTORER) { | 460 | /* x86-64 should always use SA_RESTORER. */ |
456 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); | 461 | if (ka->sa.sa_flags & SA_RESTORER) { |
457 | } else { | 462 | put_user_ex(ka->sa.sa_restorer, &frame->pretcode); |
458 | /* could use a vstub here */ | 463 | } else { |
459 | return -EFAULT; | 464 | /* could use a vstub here */ |
460 | } | 465 | err |= -EFAULT; |
466 | } | ||
467 | } put_user_catch(err); | ||
461 | 468 | ||
462 | if (err) | 469 | if (err) |
463 | return -EFAULT; | 470 | return -EFAULT; |
@@ -509,31 +516,41 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, | |||
509 | struct old_sigaction __user *oact) | 516 | struct old_sigaction __user *oact) |
510 | { | 517 | { |
511 | struct k_sigaction new_ka, old_ka; | 518 | struct k_sigaction new_ka, old_ka; |
512 | int ret; | 519 | int ret = 0; |
513 | 520 | ||
514 | if (act) { | 521 | if (act) { |
515 | old_sigset_t mask; | 522 | old_sigset_t mask; |
516 | 523 | ||
517 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | 524 | if (!access_ok(VERIFY_READ, act, sizeof(*act))) |
518 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || | ||
519 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) | ||
520 | return -EFAULT; | 525 | return -EFAULT; |
521 | 526 | ||
522 | __get_user(new_ka.sa.sa_flags, &act->sa_flags); | 527 | get_user_try { |
523 | __get_user(mask, &act->sa_mask); | 528 | get_user_ex(new_ka.sa.sa_handler, &act->sa_handler); |
529 | get_user_ex(new_ka.sa.sa_flags, &act->sa_flags); | ||
530 | get_user_ex(mask, &act->sa_mask); | ||
531 | get_user_ex(new_ka.sa.sa_restorer, &act->sa_restorer); | ||
532 | } get_user_catch(ret); | ||
533 | |||
534 | if (ret) | ||
535 | return -EFAULT; | ||
524 | siginitset(&new_ka.sa.sa_mask, mask); | 536 | siginitset(&new_ka.sa.sa_mask, mask); |
525 | } | 537 | } |
526 | 538 | ||
527 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | 539 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); |
528 | 540 | ||
529 | if (!ret && oact) { | 541 | if (!ret && oact) { |
530 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | 542 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact))) |
531 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || | ||
532 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) | ||
533 | return -EFAULT; | 543 | return -EFAULT; |
534 | 544 | ||
535 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | 545 | put_user_try { |
536 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | 546 | put_user_ex(old_ka.sa.sa_handler, &oact->sa_handler); |
547 | put_user_ex(old_ka.sa.sa_flags, &oact->sa_flags); | ||
548 | put_user_ex(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | ||
549 | put_user_ex(old_ka.sa.sa_restorer, &oact->sa_restorer); | ||
550 | } put_user_catch(ret); | ||
551 | |||
552 | if (ret) | ||
553 | return -EFAULT; | ||
537 | } | 554 | } |
538 | 555 | ||
539 | return ret; | 556 | return ret; |
diff --git a/arch/x86/mach-rdc321x/Makefile b/arch/x86/mach-rdc321x/Makefile deleted file mode 100644 index 8325b4ca431c..000000000000 --- a/arch/x86/mach-rdc321x/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the RDC321x specific parts of the kernel | ||
3 | # | ||
4 | obj-$(CONFIG_X86_RDC321X) := gpio.o platform.o | ||
5 | |||
diff --git a/arch/x86/mach-rdc321x/gpio.c b/arch/x86/mach-rdc321x/gpio.c deleted file mode 100644 index 247f33d3a407..000000000000 --- a/arch/x86/mach-rdc321x/gpio.c +++ /dev/null | |||
@@ -1,194 +0,0 @@ | |||
1 | /* | ||
2 | * GPIO support for RDC SoC R3210/R8610 | ||
3 | * | ||
4 | * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org> | ||
5 | * Copyright (C) 2008, Volker Weiss <dev@tintuc.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/spinlock.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/module.h> | ||
28 | |||
29 | #include <asm/gpio.h> | ||
30 | #include <asm/mach-rdc321x/rdc321x_defs.h> | ||
31 | |||
32 | |||
33 | /* spin lock to protect our private copy of GPIO data register plus | ||
34 | the access to PCI conf registers. */ | ||
35 | static DEFINE_SPINLOCK(gpio_lock); | ||
36 | |||
37 | /* copy of GPIO data registers */ | ||
38 | static u32 gpio_data_reg1; | ||
39 | static u32 gpio_data_reg2; | ||
40 | |||
41 | static u32 gpio_request_data[2]; | ||
42 | |||
43 | |||
44 | static inline void rdc321x_conf_write(unsigned addr, u32 value) | ||
45 | { | ||
46 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
47 | outl(value, RDC3210_CFGREG_DATA); | ||
48 | } | ||
49 | |||
50 | static inline void rdc321x_conf_or(unsigned addr, u32 value) | ||
51 | { | ||
52 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
53 | value |= inl(RDC3210_CFGREG_DATA); | ||
54 | outl(value, RDC3210_CFGREG_DATA); | ||
55 | } | ||
56 | |||
57 | static inline u32 rdc321x_conf_read(unsigned addr) | ||
58 | { | ||
59 | outl((1 << 31) | (7 << 11) | addr, RDC3210_CFGREG_ADDR); | ||
60 | |||
61 | return inl(RDC3210_CFGREG_DATA); | ||
62 | } | ||
63 | |||
64 | /* configure pin as GPIO */ | ||
65 | static void rdc321x_configure_gpio(unsigned gpio) | ||
66 | { | ||
67 | unsigned long flags; | ||
68 | |||
69 | spin_lock_irqsave(&gpio_lock, flags); | ||
70 | rdc321x_conf_or(gpio < 32 | ||
71 | ? RDC321X_GPIO_CTRL_REG1 : RDC321X_GPIO_CTRL_REG2, | ||
72 | 1 << (gpio & 0x1f)); | ||
73 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
74 | } | ||
75 | |||
76 | /* initially setup the 2 copies of the gpio data registers. | ||
77 | This function must be called by the platform setup code. */ | ||
78 | void __init rdc321x_gpio_setup() | ||
79 | { | ||
80 | /* this might not be, what others (BIOS, bootloader, etc.) | ||
81 | wrote to these registers before, but it's a good guess. Still | ||
82 | better than just using 0xffffffff. */ | ||
83 | |||
84 | gpio_data_reg1 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG1); | ||
85 | gpio_data_reg2 = rdc321x_conf_read(RDC321X_GPIO_DATA_REG2); | ||
86 | } | ||
87 | |||
88 | /* determine, if gpio number is valid */ | ||
89 | static inline int rdc321x_is_gpio(unsigned gpio) | ||
90 | { | ||
91 | return gpio <= RDC321X_MAX_GPIO; | ||
92 | } | ||
93 | |||
94 | /* request GPIO */ | ||
95 | int rdc_gpio_request(unsigned gpio, const char *label) | ||
96 | { | ||
97 | unsigned long flags; | ||
98 | |||
99 | if (!rdc321x_is_gpio(gpio)) | ||
100 | return -EINVAL; | ||
101 | |||
102 | spin_lock_irqsave(&gpio_lock, flags); | ||
103 | if (gpio_request_data[(gpio & 0x20) ? 1 : 0] & (1 << (gpio & 0x1f))) | ||
104 | goto inuse; | ||
105 | gpio_request_data[(gpio & 0x20) ? 1 : 0] |= (1 << (gpio & 0x1f)); | ||
106 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
107 | |||
108 | return 0; | ||
109 | inuse: | ||
110 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
111 | return -EINVAL; | ||
112 | } | ||
113 | EXPORT_SYMBOL(rdc_gpio_request); | ||
114 | |||
115 | /* release previously-claimed GPIO */ | ||
116 | void rdc_gpio_free(unsigned gpio) | ||
117 | { | ||
118 | unsigned long flags; | ||
119 | |||
120 | if (!rdc321x_is_gpio(gpio)) | ||
121 | return; | ||
122 | |||
123 | spin_lock_irqsave(&gpio_lock, flags); | ||
124 | gpio_request_data[(gpio & 0x20) ? 1 : 0] &= ~(1 << (gpio & 0x1f)); | ||
125 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
126 | } | ||
127 | EXPORT_SYMBOL(rdc_gpio_free); | ||
128 | |||
129 | /* read GPIO pin */ | ||
130 | int rdc_gpio_get_value(unsigned gpio) | ||
131 | { | ||
132 | u32 reg; | ||
133 | unsigned long flags; | ||
134 | |||
135 | spin_lock_irqsave(&gpio_lock, flags); | ||
136 | reg = rdc321x_conf_read(gpio < 32 | ||
137 | ? RDC321X_GPIO_DATA_REG1 : RDC321X_GPIO_DATA_REG2); | ||
138 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
139 | |||
140 | return (1 << (gpio & 0x1f)) & reg ? 1 : 0; | ||
141 | } | ||
142 | EXPORT_SYMBOL(rdc_gpio_get_value); | ||
143 | |||
144 | /* set GPIO pin to value */ | ||
145 | void rdc_gpio_set_value(unsigned gpio, int value) | ||
146 | { | ||
147 | unsigned long flags; | ||
148 | u32 reg; | ||
149 | |||
150 | reg = 1 << (gpio & 0x1f); | ||
151 | if (gpio < 32) { | ||
152 | spin_lock_irqsave(&gpio_lock, flags); | ||
153 | if (value) | ||
154 | gpio_data_reg1 |= reg; | ||
155 | else | ||
156 | gpio_data_reg1 &= ~reg; | ||
157 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG1, gpio_data_reg1); | ||
158 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
159 | } else { | ||
160 | spin_lock_irqsave(&gpio_lock, flags); | ||
161 | if (value) | ||
162 | gpio_data_reg2 |= reg; | ||
163 | else | ||
164 | gpio_data_reg2 &= ~reg; | ||
165 | rdc321x_conf_write(RDC321X_GPIO_DATA_REG2, gpio_data_reg2); | ||
166 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
167 | } | ||
168 | } | ||
169 | EXPORT_SYMBOL(rdc_gpio_set_value); | ||
170 | |||
171 | /* configure GPIO pin as input */ | ||
172 | int rdc_gpio_direction_input(unsigned gpio) | ||
173 | { | ||
174 | if (!rdc321x_is_gpio(gpio)) | ||
175 | return -EINVAL; | ||
176 | |||
177 | rdc321x_configure_gpio(gpio); | ||
178 | |||
179 | return 0; | ||
180 | } | ||
181 | EXPORT_SYMBOL(rdc_gpio_direction_input); | ||
182 | |||
183 | /* configure GPIO pin as output and set value */ | ||
184 | int rdc_gpio_direction_output(unsigned gpio, int value) | ||
185 | { | ||
186 | if (!rdc321x_is_gpio(gpio)) | ||
187 | return -EINVAL; | ||
188 | |||
189 | gpio_set_value(gpio, value); | ||
190 | rdc321x_configure_gpio(gpio); | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | EXPORT_SYMBOL(rdc_gpio_direction_output); | ||
diff --git a/arch/x86/mach-rdc321x/platform.c b/arch/x86/mach-rdc321x/platform.c deleted file mode 100644 index 4f4e50c3ad3b..000000000000 --- a/arch/x86/mach-rdc321x/platform.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Generic RDC321x platform devices | ||
3 | * | ||
4 | * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version 2 | ||
9 | * of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the | ||
18 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/leds.h> | ||
29 | |||
30 | #include <asm/gpio.h> | ||
31 | |||
32 | /* LEDS */ | ||
33 | static struct gpio_led default_leds[] = { | ||
34 | { .name = "rdc:dmz", .gpio = 1, }, | ||
35 | }; | ||
36 | |||
37 | static struct gpio_led_platform_data rdc321x_led_data = { | ||
38 | .num_leds = ARRAY_SIZE(default_leds), | ||
39 | .leds = default_leds, | ||
40 | }; | ||
41 | |||
42 | static struct platform_device rdc321x_leds = { | ||
43 | .name = "leds-gpio", | ||
44 | .id = -1, | ||
45 | .dev = { | ||
46 | .platform_data = &rdc321x_led_data, | ||
47 | } | ||
48 | }; | ||
49 | |||
50 | /* Watchdog */ | ||
51 | static struct platform_device rdc321x_wdt = { | ||
52 | .name = "rdc321x-wdt", | ||
53 | .id = -1, | ||
54 | .num_resources = 0, | ||
55 | }; | ||
56 | |||
57 | static struct platform_device *rdc321x_devs[] = { | ||
58 | &rdc321x_leds, | ||
59 | &rdc321x_wdt | ||
60 | }; | ||
61 | |||
62 | static int __init rdc_board_setup(void) | ||
63 | { | ||
64 | rdc321x_gpio_setup(); | ||
65 | |||
66 | return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); | ||
67 | } | ||
68 | |||
69 | arch_initcall(rdc_board_setup); | ||
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 7e8db53528a7..61b41ca3b5a2 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c | |||
@@ -23,6 +23,12 @@ int fixup_exception(struct pt_regs *regs) | |||
23 | 23 | ||
24 | fixup = search_exception_tables(regs->ip); | 24 | fixup = search_exception_tables(regs->ip); |
25 | if (fixup) { | 25 | if (fixup) { |
26 | /* If fixup is less than 16, it means uaccess error */ | ||
27 | if (fixup->fixup < 16) { | ||
28 | current_thread_info()->uaccess_err = -EFAULT; | ||
29 | regs->ip += fixup->fixup; | ||
30 | return 1; | ||
31 | } | ||
26 | regs->ip = fixup->fixup; | 32 | regs->ip = fixup->fixup; |
27 | return 1; | 33 | return 1; |
28 | } | 34 | } |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 65709a6aa6ee..d3eee74f830a 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -420,7 +420,6 @@ static noinline void pgtable_bad(struct pt_regs *regs, | |||
420 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | 420 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", |
421 | tsk->comm, address); | 421 | tsk->comm, address); |
422 | dump_pagetable(address); | 422 | dump_pagetable(address); |
423 | tsk = current; | ||
424 | tsk->thread.cr2 = address; | 423 | tsk->thread.cr2 = address; |
425 | tsk->thread.trap_no = 14; | 424 | tsk->thread.trap_no = 14; |
426 | tsk->thread.error_code = error_code; | 425 | tsk->thread.error_code = error_code; |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index af750ab973b6..1448bcb7f22f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -367,7 +367,7 @@ EXPORT_SYMBOL(ioremap_nocache); | |||
367 | * | 367 | * |
368 | * Must be freed with iounmap. | 368 | * Must be freed with iounmap. |
369 | */ | 369 | */ |
370 | void __iomem *ioremap_wc(unsigned long phys_addr, unsigned long size) | 370 | void __iomem *ioremap_wc(resource_size_t phys_addr, unsigned long size) |
371 | { | 371 | { |
372 | if (pat_enabled) | 372 | if (pat_enabled) |
373 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, | 373 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_WC, |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 7b61036427df..9127e31c7268 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #ifdef CONFIG_X86_PAT | 30 | #ifdef CONFIG_X86_PAT |
31 | int __read_mostly pat_enabled = 1; | 31 | int __read_mostly pat_enabled = 1; |
32 | 32 | ||
33 | void __cpuinit pat_disable(char *reason) | 33 | void __cpuinit pat_disable(const char *reason) |
34 | { | 34 | { |
35 | pat_enabled = 0; | 35 | pat_enabled = 0; |
36 | printk(KERN_INFO "%s\n", reason); | 36 | printk(KERN_INFO "%s\n", reason); |
@@ -42,6 +42,11 @@ static int __init nopat(char *str) | |||
42 | return 0; | 42 | return 0; |
43 | } | 43 | } |
44 | early_param("nopat", nopat); | 44 | early_param("nopat", nopat); |
45 | #else | ||
46 | static inline void pat_disable(const char *reason) | ||
47 | { | ||
48 | (void)reason; | ||
49 | } | ||
45 | #endif | 50 | #endif |
46 | 51 | ||
47 | 52 | ||
@@ -78,16 +83,20 @@ void pat_init(void) | |||
78 | if (!pat_enabled) | 83 | if (!pat_enabled) |
79 | return; | 84 | return; |
80 | 85 | ||
81 | /* Paranoia check. */ | 86 | if (!cpu_has_pat) { |
82 | if (!cpu_has_pat && boot_pat_state) { | 87 | if (!boot_pat_state) { |
83 | /* | 88 | pat_disable("PAT not supported by CPU."); |
84 | * If this happens we are on a secondary CPU, but | 89 | return; |
85 | * switched to PAT on the boot CPU. We have no way to | 90 | } else { |
86 | * undo PAT. | 91 | /* |
87 | */ | 92 | * If this happens we are on a secondary CPU, but |
88 | printk(KERN_ERR "PAT enabled, " | 93 | * switched to PAT on the boot CPU. We have no way to |
89 | "but not supported by secondary CPU\n"); | 94 | * undo PAT. |
90 | BUG(); | 95 | */ |
96 | printk(KERN_ERR "PAT enabled, " | ||
97 | "but not supported by secondary CPU\n"); | ||
98 | BUG(); | ||
99 | } | ||
91 | } | 100 | } |
92 | 101 | ||
93 | /* Set PWT to Write-Combining. All other bits stay the same */ | 102 | /* Set PWT to Write-Combining. All other bits stay the same */ |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index bef941f61451..6b3f7eef57e3 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1307,7 +1307,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = { | |||
1307 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, | 1307 | .ptep_modify_prot_commit = __ptep_modify_prot_commit, |
1308 | 1308 | ||
1309 | .pte_val = xen_pte_val, | 1309 | .pte_val = xen_pte_val, |
1310 | .pte_flags = native_pte_flags, | ||
1311 | .pgd_val = xen_pgd_val, | 1310 | .pgd_val = xen_pgd_val, |
1312 | 1311 | ||
1313 | .make_pte = xen_make_pte, | 1312 | .make_pte = xen_make_pte, |
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index bf92802f2bbe..36e221beedcd 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/io.h> | 37 | #include <linux/io.h> |
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | 39 | ||
40 | #include <asm/mach-rdc321x/rdc321x_defs.h> | 40 | #include <asm/rdc321x_defs.h> |
41 | 41 | ||
42 | #define RDC_WDT_MASK 0x80000000 /* Mask */ | 42 | #define RDC_WDT_MASK 0x80000000 /* Mask */ |
43 | #define RDC_WDT_EN 0x00800000 /* Enable bit */ | 43 | #define RDC_WDT_EN 0x00800000 /* Enable bit */ |