x86: commonize __range_not_ok.
authorGlauber Costa <gcosta@redhat.com>
Wed, 25 Jun 2008 13:14:13 +0000 (10:14 -0300)
committerIngo Molnar <mingo@elte.hu>
Wed, 9 Jul 2008 07:14:13 +0000 (09:14 +0200)
For i386, __range_not_ok is a better name than __range_ok, since
it returns 0 when it is in fact okay. Other than that,
both versions does not need the word size specifiers, and we remove them.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/asm-x86/uaccess_32.h
include/asm-x86/uaccess_64.h

index f8abc12a77c26083d51bc82d4068f0c037e78892..8d3f02d3562c924e2c413f955c264db9a97e5d0b 100644 (file)
@@ -56,11 +56,11 @@ extern struct movsl_mask {
  *
  * This needs 33-bit arithmetic. We have a carry...
  */
-#define __range_ok(addr, size)                                         \
+#define __range_not_ok(addr, size)                                     \
 ({                                                                     \
        unsigned long flag, roksum;                                     \
        __chk_user_ptr(addr);                                           \
-       asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0"           \
+       asm("add %3,%1 ; sbb %0,%0; cmp %1,%4; sbb $0,%0"               \
            :"=&r" (flag), "=r" (roksum)                                \
            :"1" (addr), "g" ((int)(size)),                             \
            "rm" (current_thread_info()->addr_limit.seg));              \
@@ -86,7 +86,7 @@ extern struct movsl_mask {
  * checks that the pointer is in the user space range - after calling
  * this function, memory access functions may still return -EFAULT.
  */
-#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0))
+#define access_ok(type, addr, size) (likely(__range_not_ok(addr, size) == 0))
 
 /*
  * The exception table consists of pairs of addresses: the first is the
index f822a36cc1c036f8e20213364c696ec5a647c412..012cba3972d72e1514d73eee0b7bdbc44346c1a5 100644 (file)
@@ -41,8 +41,7 @@
 ({                                                                     \
        unsigned long flag, roksum;                                     \
        __chk_user_ptr(addr);                                           \
-       asm("# range_ok\n\r"                                            \
-           "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0"         \
+       asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0"             \
            : "=&r" (flag), "=r" (roksum)                               \
            : "1" (addr), "g" ((long)(size)),                           \
              "g" (current_thread_info()->addr_limit.seg));             \