diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-04-20 15:19:52 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-04-20 16:51:39 -0400 |
commit | 9c6751280b6206e2a96f9600938003a29968e4fa (patch) | |
tree | 01867ca9f8aa5732c79b1dd586e01908d447c5ab /arch/x86/lib | |
parent | a53a96e5413d3639ed75d202bbfe68aa0a56c091 (diff) |
x86, extable: Remove open-coded exception table entries in arch/x86/lib/usercopy_32.c
Remove open-coded exception table entries in arch/x86/lib/usercopy_32.c,
and replace them with _ASM_EXTABLE() macros; this will allow us to
change the format and type of the exception table entries.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: David Daney <david.daney@cavium.com>
Link: http://lkml.kernel.org/r/CA%2B55aFyijf43qSu3N9nWHEBwaGbb7T2Oq9A=9EyR=Jtyqfq_cQ@mail.gmail.com
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/usercopy_32.c | 232 |
1 files changed, 106 insertions, 126 deletions
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index ef2a6a5d78e3..883b216c60b2 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <asm/mmx.h> | 15 | #include <asm/mmx.h> |
16 | #include <asm/asm.h> | ||
16 | 17 | ||
17 | #ifdef CONFIG_X86_INTEL_USERCOPY | 18 | #ifdef CONFIG_X86_INTEL_USERCOPY |
18 | /* | 19 | /* |
@@ -127,10 +128,7 @@ long strnlen_user(const char __user *s, long n) | |||
127 | "3: movb $1,%%al\n" | 128 | "3: movb $1,%%al\n" |
128 | " jmp 1b\n" | 129 | " jmp 1b\n" |
129 | ".previous\n" | 130 | ".previous\n" |
130 | ".section __ex_table,\"a\"\n" | 131 | _ASM_EXTABLE(0b,2b) |
131 | " .align 4\n" | ||
132 | " .long 0b,2b\n" | ||
133 | ".previous" | ||
134 | :"=&r" (n), "=&D" (s), "=&a" (res), "=&c" (tmp) | 132 | :"=&r" (n), "=&D" (s), "=&a" (res), "=&c" (tmp) |
135 | :"0" (n), "1" (s), "2" (0), "3" (mask) | 133 | :"0" (n), "1" (s), "2" (0), "3" (mask) |
136 | :"cc"); | 134 | :"cc"); |
@@ -199,47 +197,44 @@ __copy_user_intel(void __user *to, const void *from, unsigned long size) | |||
199 | "101: lea 0(%%eax,%0,4),%0\n" | 197 | "101: lea 0(%%eax,%0,4),%0\n" |
200 | " jmp 100b\n" | 198 | " jmp 100b\n" |
201 | ".previous\n" | 199 | ".previous\n" |
202 | ".section __ex_table,\"a\"\n" | 200 | _ASM_EXTABLE(1b,100b) |
203 | " .align 4\n" | 201 | _ASM_EXTABLE(2b,100b) |
204 | " .long 1b,100b\n" | 202 | _ASM_EXTABLE(3b,100b) |
205 | " .long 2b,100b\n" | 203 | _ASM_EXTABLE(4b,100b) |
206 | " .long 3b,100b\n" | 204 | _ASM_EXTABLE(5b,100b) |
207 | " .long 4b,100b\n" | 205 | _ASM_EXTABLE(6b,100b) |
208 | " .long 5b,100b\n" | 206 | _ASM_EXTABLE(7b,100b) |
209 | " .long 6b,100b\n" | 207 | _ASM_EXTABLE(8b,100b) |
210 | " .long 7b,100b\n" | 208 | _ASM_EXTABLE(9b,100b) |
211 | " .long 8b,100b\n" | 209 | _ASM_EXTABLE(10b,100b) |
212 | " .long 9b,100b\n" | 210 | _ASM_EXTABLE(11b,100b) |
213 | " .long 10b,100b\n" | 211 | _ASM_EXTABLE(12b,100b) |
214 | " .long 11b,100b\n" | 212 | _ASM_EXTABLE(13b,100b) |
215 | " .long 12b,100b\n" | 213 | _ASM_EXTABLE(14b,100b) |
216 | " .long 13b,100b\n" | 214 | _ASM_EXTABLE(15b,100b) |
217 | " .long 14b,100b\n" | 215 | _ASM_EXTABLE(16b,100b) |
218 | " .long 15b,100b\n" | 216 | _ASM_EXTABLE(17b,100b) |
219 | " .long 16b,100b\n" | 217 | _ASM_EXTABLE(18b,100b) |
220 | " .long 17b,100b\n" | 218 | _ASM_EXTABLE(19b,100b) |
221 | " .long 18b,100b\n" | 219 | _ASM_EXTABLE(20b,100b) |
222 | " .long 19b,100b\n" | 220 | _ASM_EXTABLE(21b,100b) |
223 | " .long 20b,100b\n" | 221 | _ASM_EXTABLE(22b,100b) |
224 | " .long 21b,100b\n" | 222 | _ASM_EXTABLE(23b,100b) |
225 | " .long 22b,100b\n" | 223 | _ASM_EXTABLE(24b,100b) |
226 | " .long 23b,100b\n" | 224 | _ASM_EXTABLE(25b,100b) |
227 | " .long 24b,100b\n" | 225 | _ASM_EXTABLE(26b,100b) |
228 | " .long 25b,100b\n" | 226 | _ASM_EXTABLE(27b,100b) |
229 | " .long 26b,100b\n" | 227 | _ASM_EXTABLE(28b,100b) |
230 | " .long 27b,100b\n" | 228 | _ASM_EXTABLE(29b,100b) |
231 | " .long 28b,100b\n" | 229 | _ASM_EXTABLE(30b,100b) |
232 | " .long 29b,100b\n" | 230 | _ASM_EXTABLE(31b,100b) |
233 | " .long 30b,100b\n" | 231 | _ASM_EXTABLE(32b,100b) |
234 | " .long 31b,100b\n" | 232 | _ASM_EXTABLE(33b,100b) |
235 | " .long 32b,100b\n" | 233 | _ASM_EXTABLE(34b,100b) |
236 | " .long 33b,100b\n" | 234 | _ASM_EXTABLE(35b,100b) |
237 | " .long 34b,100b\n" | 235 | _ASM_EXTABLE(36b,100b) |
238 | " .long 35b,100b\n" | 236 | _ASM_EXTABLE(37b,100b) |
239 | " .long 36b,100b\n" | 237 | _ASM_EXTABLE(99b,101b) |
240 | " .long 37b,100b\n" | ||
241 | " .long 99b,101b\n" | ||
242 | ".previous" | ||
243 | : "=&c"(size), "=&D" (d0), "=&S" (d1) | 238 | : "=&c"(size), "=&D" (d0), "=&S" (d1) |
244 | : "1"(to), "2"(from), "0"(size) | 239 | : "1"(to), "2"(from), "0"(size) |
245 | : "eax", "edx", "memory"); | 240 | : "eax", "edx", "memory"); |
@@ -312,29 +307,26 @@ __copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size) | |||
312 | " popl %0\n" | 307 | " popl %0\n" |
313 | " jmp 8b\n" | 308 | " jmp 8b\n" |
314 | ".previous\n" | 309 | ".previous\n" |
315 | ".section __ex_table,\"a\"\n" | 310 | _ASM_EXTABLE(0b,16b) |
316 | " .align 4\n" | 311 | _ASM_EXTABLE(1b,16b) |
317 | " .long 0b,16b\n" | 312 | _ASM_EXTABLE(2b,16b) |
318 | " .long 1b,16b\n" | 313 | _ASM_EXTABLE(21b,16b) |
319 | " .long 2b,16b\n" | 314 | _ASM_EXTABLE(3b,16b) |
320 | " .long 21b,16b\n" | 315 | _ASM_EXTABLE(31b,16b) |
321 | " .long 3b,16b\n" | 316 | _ASM_EXTABLE(4b,16b) |
322 | " .long 31b,16b\n" | 317 | _ASM_EXTABLE(41b,16b) |
323 | " .long 4b,16b\n" | 318 | _ASM_EXTABLE(10b,16b) |
324 | " .long 41b,16b\n" | 319 | _ASM_EXTABLE(51b,16b) |
325 | " .long 10b,16b\n" | 320 | _ASM_EXTABLE(11b,16b) |
326 | " .long 51b,16b\n" | 321 | _ASM_EXTABLE(61b,16b) |
327 | " .long 11b,16b\n" | 322 | _ASM_EXTABLE(12b,16b) |
328 | " .long 61b,16b\n" | 323 | _ASM_EXTABLE(71b,16b) |
329 | " .long 12b,16b\n" | 324 | _ASM_EXTABLE(13b,16b) |
330 | " .long 71b,16b\n" | 325 | _ASM_EXTABLE(81b,16b) |
331 | " .long 13b,16b\n" | 326 | _ASM_EXTABLE(14b,16b) |
332 | " .long 81b,16b\n" | 327 | _ASM_EXTABLE(91b,16b) |
333 | " .long 14b,16b\n" | 328 | _ASM_EXTABLE(6b,9b) |
334 | " .long 91b,16b\n" | 329 | _ASM_EXTABLE(7b,16b) |
335 | " .long 6b,9b\n" | ||
336 | " .long 7b,16b\n" | ||
337 | ".previous" | ||
338 | : "=&c"(size), "=&D" (d0), "=&S" (d1) | 330 | : "=&c"(size), "=&D" (d0), "=&S" (d1) |
339 | : "1"(to), "2"(from), "0"(size) | 331 | : "1"(to), "2"(from), "0"(size) |
340 | : "eax", "edx", "memory"); | 332 | : "eax", "edx", "memory"); |
@@ -414,29 +406,26 @@ static unsigned long __copy_user_zeroing_intel_nocache(void *to, | |||
414 | " popl %0\n" | 406 | " popl %0\n" |
415 | " jmp 8b\n" | 407 | " jmp 8b\n" |
416 | ".previous\n" | 408 | ".previous\n" |
417 | ".section __ex_table,\"a\"\n" | 409 | _ASM_EXTABLE(0b,16b) |
418 | " .align 4\n" | 410 | _ASM_EXTABLE(1b,16b) |
419 | " .long 0b,16b\n" | 411 | _ASM_EXTABLE(2b,16b) |
420 | " .long 1b,16b\n" | 412 | _ASM_EXTABLE(21b,16b) |
421 | " .long 2b,16b\n" | 413 | _ASM_EXTABLE(3b,16b) |
422 | " .long 21b,16b\n" | 414 | _ASM_EXTABLE(31b,16b) |
423 | " .long 3b,16b\n" | 415 | _ASM_EXTABLE(4b,16b) |
424 | " .long 31b,16b\n" | 416 | _ASM_EXTABLE(41b,16b) |
425 | " .long 4b,16b\n" | 417 | _ASM_EXTABLE(10b,16b) |
426 | " .long 41b,16b\n" | 418 | _ASM_EXTABLE(51b,16b) |
427 | " .long 10b,16b\n" | 419 | _ASM_EXTABLE(11b,16b) |
428 | " .long 51b,16b\n" | 420 | _ASM_EXTABLE(61b,16b) |
429 | " .long 11b,16b\n" | 421 | _ASM_EXTABLE(12b,16b) |
430 | " .long 61b,16b\n" | 422 | _ASM_EXTABLE(71b,16b) |
431 | " .long 12b,16b\n" | 423 | _ASM_EXTABLE(13b,16b) |
432 | " .long 71b,16b\n" | 424 | _ASM_EXTABLE(81b,16b) |
433 | " .long 13b,16b\n" | 425 | _ASM_EXTABLE(14b,16b) |
434 | " .long 81b,16b\n" | 426 | _ASM_EXTABLE(91b,16b) |
435 | " .long 14b,16b\n" | 427 | _ASM_EXTABLE(6b,9b) |
436 | " .long 91b,16b\n" | 428 | _ASM_EXTABLE(7b,16b) |
437 | " .long 6b,9b\n" | ||
438 | " .long 7b,16b\n" | ||
439 | ".previous" | ||
440 | : "=&c"(size), "=&D" (d0), "=&S" (d1) | 429 | : "=&c"(size), "=&D" (d0), "=&S" (d1) |
441 | : "1"(to), "2"(from), "0"(size) | 430 | : "1"(to), "2"(from), "0"(size) |
442 | : "eax", "edx", "memory"); | 431 | : "eax", "edx", "memory"); |
@@ -505,29 +494,26 @@ static unsigned long __copy_user_intel_nocache(void *to, | |||
505 | "9: lea 0(%%eax,%0,4),%0\n" | 494 | "9: lea 0(%%eax,%0,4),%0\n" |
506 | "16: jmp 8b\n" | 495 | "16: jmp 8b\n" |
507 | ".previous\n" | 496 | ".previous\n" |
508 | ".section __ex_table,\"a\"\n" | 497 | _ASM_EXTABLE(0b,16b) |
509 | " .align 4\n" | 498 | _ASM_EXTABLE(1b,16b) |
510 | " .long 0b,16b\n" | 499 | _ASM_EXTABLE(2b,16b) |
511 | " .long 1b,16b\n" | 500 | _ASM_EXTABLE(21b,16b) |
512 | " .long 2b,16b\n" | 501 | _ASM_EXTABLE(3b,16b) |
513 | " .long 21b,16b\n" | 502 | _ASM_EXTABLE(31b,16b) |
514 | " .long 3b,16b\n" | 503 | _ASM_EXTABLE(4b,16b) |
515 | " .long 31b,16b\n" | 504 | _ASM_EXTABLE(41b,16b) |
516 | " .long 4b,16b\n" | 505 | _ASM_EXTABLE(10b,16b) |
517 | " .long 41b,16b\n" | 506 | _ASM_EXTABLE(51b,16b) |
518 | " .long 10b,16b\n" | 507 | _ASM_EXTABLE(11b,16b) |
519 | " .long 51b,16b\n" | 508 | _ASM_EXTABLE(61b,16b) |
520 | " .long 11b,16b\n" | 509 | _ASM_EXTABLE(12b,16b) |
521 | " .long 61b,16b\n" | 510 | _ASM_EXTABLE(71b,16b) |
522 | " .long 12b,16b\n" | 511 | _ASM_EXTABLE(13b,16b) |
523 | " .long 71b,16b\n" | 512 | _ASM_EXTABLE(81b,16b) |
524 | " .long 13b,16b\n" | 513 | _ASM_EXTABLE(14b,16b) |
525 | " .long 81b,16b\n" | 514 | _ASM_EXTABLE(91b,16b) |
526 | " .long 14b,16b\n" | 515 | _ASM_EXTABLE(6b,9b) |
527 | " .long 91b,16b\n" | 516 | _ASM_EXTABLE(7b,16b) |
528 | " .long 6b,9b\n" | ||
529 | " .long 7b,16b\n" | ||
530 | ".previous" | ||
531 | : "=&c"(size), "=&D" (d0), "=&S" (d1) | 517 | : "=&c"(size), "=&D" (d0), "=&S" (d1) |
532 | : "1"(to), "2"(from), "0"(size) | 518 | : "1"(to), "2"(from), "0"(size) |
533 | : "eax", "edx", "memory"); | 519 | : "eax", "edx", "memory"); |
@@ -574,12 +560,9 @@ do { \ | |||
574 | "3: lea 0(%3,%0,4),%0\n" \ | 560 | "3: lea 0(%3,%0,4),%0\n" \ |
575 | " jmp 2b\n" \ | 561 | " jmp 2b\n" \ |
576 | ".previous\n" \ | 562 | ".previous\n" \ |
577 | ".section __ex_table,\"a\"\n" \ | 563 | _ASM_EXTABLE(4b,5b) \ |
578 | " .align 4\n" \ | 564 | _ASM_EXTABLE(0b,3b) \ |
579 | " .long 4b,5b\n" \ | 565 | _ASM_EXTABLE(1b,2b) \ |
580 | " .long 0b,3b\n" \ | ||
581 | " .long 1b,2b\n" \ | ||
582 | ".previous" \ | ||
583 | : "=&c"(size), "=&D" (__d0), "=&S" (__d1), "=r"(__d2) \ | 566 | : "=&c"(size), "=&D" (__d0), "=&S" (__d1), "=r"(__d2) \ |
584 | : "3"(size), "0"(size), "1"(to), "2"(from) \ | 567 | : "3"(size), "0"(size), "1"(to), "2"(from) \ |
585 | : "memory"); \ | 568 | : "memory"); \ |
@@ -616,12 +599,9 @@ do { \ | |||
616 | " popl %0\n" \ | 599 | " popl %0\n" \ |
617 | " jmp 2b\n" \ | 600 | " jmp 2b\n" \ |
618 | ".previous\n" \ | 601 | ".previous\n" \ |
619 | ".section __ex_table,\"a\"\n" \ | 602 | _ASM_EXTABLE(4b,5b) \ |
620 | " .align 4\n" \ | 603 | _ASM_EXTABLE(0b,3b) \ |
621 | " .long 4b,5b\n" \ | 604 | _ASM_EXTABLE(1b,6b) \ |
622 | " .long 0b,3b\n" \ | ||
623 | " .long 1b,6b\n" \ | ||
624 | ".previous" \ | ||
625 | : "=&c"(size), "=&D" (__d0), "=&S" (__d1), "=r"(__d2) \ | 605 | : "=&c"(size), "=&D" (__d0), "=&S" (__d1), "=r"(__d2) \ |
626 | : "3"(size), "0"(size), "1"(to), "2"(from) \ | 606 | : "3"(size), "0"(size), "1"(to), "2"(from) \ |
627 | : "memory"); \ | 607 | : "memory"); \ |