]> err.no Git - linux-2.6/commitdiff
x86: change testing logic in putuser_64.S.
authorGlauber Costa <gcosta@redhat.com>
Tue, 24 Jun 2008 19:51:59 +0000 (16:51 -0300)
committerIngo Molnar <mingo@elte.hu>
Wed, 9 Jul 2008 07:14:09 +0000 (09:14 +0200)
Instead of operating over a register we need to put back
into normal state afterwards (the memory position), just
sub from rbx, which is trashed anyway. We can save a few instructions.

Also, this is the i386 way.

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>
arch/x86/lib/putuser_64.S

index ce5fcd5d8c16c425c4b2c219afddeee9efd05034..a96bd8a5298ef684dc4d1c8e1eeec4635576ade5 100644 (file)
@@ -46,48 +46,39 @@ ENDPROC(__put_user_1)
 ENTRY(__put_user_2)
        CFI_STARTPROC
        GET_THREAD_INFO(%rbx)
-       addq $1,%rcx
-       jc 20f
-       cmpq TI_addr_limit(%rbx),%rcx
-       jae 20f
-       decq %rcx
+       mov TI_addr_limit(%rbx),%rbx
+       sub  $1, %rbx
+       cmpq %rbx ,%rcx
+       jae  bad_put_user
 2:     movw %ax,(%rcx)
        xorl %eax,%eax
        ret
-20:    decq %rcx
-       jmp bad_put_user
        CFI_ENDPROC
 ENDPROC(__put_user_2)
 
 ENTRY(__put_user_4)
        CFI_STARTPROC
        GET_THREAD_INFO(%rbx)
-       addq $3,%rcx
-       jc 30f
-       cmpq TI_addr_limit(%rbx),%rcx
-       jae 30f
-       subq $3,%rcx
+       mov TI_addr_limit(%rbx),%rbx
+       sub  $3, %rbx
+       cmp  %rbx, %rcx
+       jae bad_put_user
 3:     movl %eax,(%rcx)
        xorl %eax,%eax
        ret
-30:    subq $3,%rcx
-       jmp bad_put_user
        CFI_ENDPROC
 ENDPROC(__put_user_4)
 
 ENTRY(__put_user_8)
        CFI_STARTPROC
        GET_THREAD_INFO(%rbx)
-       addq $7,%rcx
-       jc 40f
-       cmpq TI_addr_limit(%rbx),%rcx
-       jae 40f
-       subq $7,%rcx
+       mov TI_addr_limit(%rbx),%rbx
+       sub  $7, %rbx
+       cmp  %rbx, %rcx
+       jae bad_put_user
 4:     movq %rax,(%rcx)
        xorl %eax,%eax
        ret
-40:    subq $7,%rcx
-       jmp bad_put_user
        CFI_ENDPROC
 ENDPROC(__put_user_8)