Commit 663aa96d authored by Glauber Costa's avatar Glauber Costa Committed by Ingo Molnar

x86: change testing logic in putuser_64.S.

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: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0ada3164
...@@ -46,48 +46,39 @@ ENDPROC(__put_user_1) ...@@ -46,48 +46,39 @@ ENDPROC(__put_user_1)
ENTRY(__put_user_2) ENTRY(__put_user_2)
CFI_STARTPROC CFI_STARTPROC
GET_THREAD_INFO(%rbx) GET_THREAD_INFO(%rbx)
addq $1,%rcx mov TI_addr_limit(%rbx),%rbx
jc 20f sub $1, %rbx
cmpq TI_addr_limit(%rbx),%rcx cmpq %rbx ,%rcx
jae 20f jae bad_put_user
decq %rcx
2: movw %ax,(%rcx) 2: movw %ax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret ret
20: decq %rcx
jmp bad_put_user
CFI_ENDPROC CFI_ENDPROC
ENDPROC(__put_user_2) ENDPROC(__put_user_2)
ENTRY(__put_user_4) ENTRY(__put_user_4)
CFI_STARTPROC CFI_STARTPROC
GET_THREAD_INFO(%rbx) GET_THREAD_INFO(%rbx)
addq $3,%rcx mov TI_addr_limit(%rbx),%rbx
jc 30f sub $3, %rbx
cmpq TI_addr_limit(%rbx),%rcx cmp %rbx, %rcx
jae 30f jae bad_put_user
subq $3,%rcx
3: movl %eax,(%rcx) 3: movl %eax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret ret
30: subq $3,%rcx
jmp bad_put_user
CFI_ENDPROC CFI_ENDPROC
ENDPROC(__put_user_4) ENDPROC(__put_user_4)
ENTRY(__put_user_8) ENTRY(__put_user_8)
CFI_STARTPROC CFI_STARTPROC
GET_THREAD_INFO(%rbx) GET_THREAD_INFO(%rbx)
addq $7,%rcx mov TI_addr_limit(%rbx),%rbx
jc 40f sub $7, %rbx
cmpq TI_addr_limit(%rbx),%rcx cmp %rbx, %rcx
jae 40f jae bad_put_user
subq $7,%rcx
4: movq %rax,(%rcx) 4: movq %rax,(%rcx)
xorl %eax,%eax xorl %eax,%eax
ret ret
40: subq $7,%rcx
jmp bad_put_user
CFI_ENDPROC CFI_ENDPROC
ENDPROC(__put_user_8) ENDPROC(__put_user_8)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment